如何在Sharepoint WikiPage上添加WebPart?

时间:2015-09-16 11:02:22

标签: c# sharepoint sharepoint-2013

如何在Sharepoint WikiPage上添加WebPart?

例如: 如何在Sharepoint 2013主页(SitePages / Home.aspx)上添加GettingStartedWebPart?

我在网站集中使用了“团队网站”模板。并删除默认值 “开始使用您的网站”网络部分。

我在尝试:

locales.local.php

但它不起作用。你知道怎么做吗?感谢您的时间:)和解决方案。

编辑:

我找到了解决方案。首先,您可以使用标准方法“Wiki Page”WikiEditPage.InsertWebPartIntoWikiPage。但是,此方法无法正常工作...如果您阅读有关SharePoint 2010的文章,则可以找到更多此类和可能的修复方法之一(SharePoint 2013中的WikiEditPage.InsertWebPartIntoWikiPage的实现与SharePoint 2010中的相同) :http://habaneroconsulting.com/insights/programmatically-change-content-on-a-wiki-page-in-sharepoint-2010#.VgAEAfmqpBd

另外:http://maxshulga.blogspot.com/2010/06/wikieditpageinsertwebpartintowikipage.html

1 个答案:

答案 0 :(得分:0)

过去我用

做过类似的事情
private void AddWebPartToPage(SPWeb web, string filepath, string zoneidname, int zoneIndex)
    {
        SPLimitedWebPartManager wpm = web.GetLimitedWebPartManager(filepath, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);

        wpm.AddWebPart(wp, zoneidname, zoneIndex);


    }

AddWebPartToPage(web, web.Url + "SitePages/Home.aspx", "CentreLeft", 0);

你需要测试一下。

希望这有帮助。

干杯 Truez