【发布时间】:2021-10-08 20:24:55
【问题描述】:
我正在尝试将以下代码 SSOM 转换为向 SharePoint 2013 页面添加文档库的 CSOM。
SSOM
SPFile ofile = web.Getfile("Pages/Home.aspx");
using(SPLimitedWebPartManager wpm = ofile.GetLimitedWebPartManager(PersonalizationScope.Shared))
{
SPList oList = web.Lists["TestDocument"];
SPView oView = oList.Views["WebPart"];
XsltListViewWebPart aWp = new XsltListViewWebPart
{
ListName = oList.ID.ToString("B").ToUpper(),
Title = "Practice Announcements",
ViewContentTypeId = oView.ContentTypeId.ToString(),
ViewGuid = oView.ID.ToString("B").ToUpper(),
Width = "400px",
ChromeType = PartChromeType.TitleOnly
};
wpm.AddWebPart(aWp,"CenterLeftColumn",1);
oList.Update();
}
任何文章,链接都可以提供帮助
【问题讨论】:
标签: sharepoint-2013 web-parts csom