sharepoint网络部分。从页面删除Web部件
示例
ClientContext oClientContext = new ClientContext("http://MyServer/sites/MySiteCollection");
File oFile = oClientContext.Web.GetFileByServerRelativeUrl("/sites/MySiteCollection/SitePages/Home.aspx ");
LimitedWebPartManager limitedWebPartManager = oFile.GetLimitedWebPartManager(PersonalizationScope.Shared);
oClientContext.Load(limitedWebPartManager.WebParts);
oClientContext.ExecuteQuery();
if (limitedWebPartManager.WebParts.Count == 0)
{
throw new Exception("没有要删除的Web部件。");
}
WebPartDefinition webPartDefinition = limitedWebPartManager.WebParts[0];
webPartDefinition.DeleteWebPart();
oClientContext.ExecuteQuery();
热门推荐
10 中班哥哥姐姐祝福语简短
11 空军婚礼祝福语简短
12 新年给大哥祝福语简短
13 作者签名祝福语大全简短
14 感恩父亲贺卡祝福语简短
15 校长转岗祝福语大全简短
16 生日朋友惊喜祝福语简短
17 过满月祝福语女生简短
18 老师简短祝福语有哪些