1

我想以编程方式为 Sharepoint 2010 创建一个 Webpart 页面(.aspx 文件)。我已经找到了这个代码片段:

public static PublishingPage CreatePage(string fileName, string title)
  {
     PublishingWeb pWeb = PublishingWeb.GetPublishingWeb(Web);
     PageLayout[] layouts = pWeb.GetAvailablePageLayouts();
     PageLayout layout = layouts[0];
     foreach (PageLayout p in layouts)
     {

        if (p.Name.Equals("BlankWebPartPage.aspx"))
        {
           layout = p;
           break;
        }
     }
     try
     {
        PublishingPage newPage = pWeb.GetPublishingPages().Add(fileName, layout);
        newPage.Title = title;
        newPage.Update();
        return newPage;
     }
     catch (Exception)
     {
           return null;
     }
  }

但我的问题是 SharePoint Foundation Server 没有发布部分,但我必须在 SharePoint Foundation Server 上运行它。是否可以在没有 PublishingWeb 的情况下创建 Webpart 页面?

打招呼

4

1 回答 1

3

发布基础结构是仅在 SharePoint Server Standard 或 Enterprise 中可用的功能之一。它不包含在 SharePoint Foundation 2010 中。它也不包含在 Windows SharePoint Servives (WSS) 中。发布始终需要购买的产品版本。

于 2012-06-03T17:44:48.917 回答