目前由于项目需要,自己在technical research的时候研究了一下。
获取当前页面所有的webpart:
list =
new BulletedList();
WebPartZoneCollection zones = this.WebPartManager.Zones;
foreach (WebPartZone zone in zones)
{
WebPartCollection webparts = zone.WebParts;
foreach (WebPart webpart in webparts)
{
list.Items.Add(
string.Format("{0} ({1}), {2}",
webpart.Title, webpart.GetType().Name,
webpart.ClientID));
}
}
获取当前其他页面所有的webpart:
SPLimitedWebPartManager wpmanager = elevWeb.GetLimitedWebPartManager(pagepath, PersonalizationScope.Shared);
SPLimitedWebPartCollection
wps = wpmanager.WebParts;
//loop the list and you can get all properties from each member.
SharePoint web service: 获得页面的webpart属性:
1. 增加SPAPI_WebPartPages.js的引用
2.使用下面的方法:
var obj = new SPAPI_WebPartPages(SiteURL);
//2种不同的方法都可以取得想要的webpart属性
var webpart = obj.getWebPart2(PagePath,GuidOfWP,'Shared','Version3');
//this method is used to get the specified webpart by using the specified Guid.
var webpartproperties = obj.getWebPartProperties2 (PagePath,'Shared','Version3');
//this method is used to get a list that contains all webpart properties on the specified page.
please get the detailed from:http://sharepointwebservices.blogspot.com/
仅供参考!