C# 以编程方式获取SharePoint页面正在使用的页面布局
想知道是否有可能遍历页面库中保存的页面并确定每个页面使用的页面布局?任何c#代码示例都值得欣赏C# 以编程方式获取SharePoint页面正在使用的页面布局,c#,sharepoint,C#,Sharepoint,想知道是否有可能遍历页面库中保存的页面并确定每个页面使用的页面布局?任何c#代码示例都值得欣赏 非常感谢您提前您可以通过PublishingPage对象获得对某个对象的引用,该对象具有 下面我已经删减了两页的示例代码,以获得接近您需要的内容 using (SPWeb web = site.OpenWeb(HttpUtility.UrlDecode(webUri.AbsolutePath))) { PublishingWeb pWeb =
非常感谢您提前您可以通过PublishingPage对象获得对某个对象的引用,该对象具有 下面我已经删减了两页的示例代码,以获得接近您需要的内容
using (SPWeb web = site.OpenWeb(HttpUtility.UrlDecode(webUri.AbsolutePath)))
{
PublishingWeb pWeb = null;
if (!web.Exists || !PublishingWeb.IsPublishingWeb(web))
{
return;
}
pWeb = PublishingWeb.GetPublishingWeb(web);
PublishingPageCollection publishingPages = publishingWeb.GetPublishingPages();
foreach (PublishingPage publishingPage in publishingPages)
{
//do something here with publishingPage.Layout
}
}
您可以获得一个对象的引用,并通过PublishingPage对象获得一个 下面我已经删减了两页的示例代码,以获得接近您需要的内容
using (SPWeb web = site.OpenWeb(HttpUtility.UrlDecode(webUri.AbsolutePath)))
{
PublishingWeb pWeb = null;
if (!web.Exists || !PublishingWeb.IsPublishingWeb(web))
{
return;
}
pWeb = PublishingWeb.GetPublishingWeb(web);
PublishingPageCollection publishingPages = publishingWeb.GetPublishingPages();
foreach (PublishingPage publishingPage in publishingPages)
{
//do something here with publishingPage.Layout
}
}