sharepoint: 如何获取页面上webpart列表

目前由于项目需要,自己在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/

 

仅供参考!

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值