如何以asp.net形式获取Webpart列表
我的目的是在 ASP.NET 页面中附加 Web 部件列表。在sharepoint网页中,我们可以这样做:
SPWeb web = SPContext.Current.Web;
SPLimitedWebPartManager webPartManager = web.GetLimitedWebPartManager(
Page.Request.Path,
PersonalizationScope.Shared);
for (int i = 0; i < webPartManager.WebParts.Count; i++)
{
// We can do checking here or whatever we want......
}
但是在asp.net页面中如何做到这一点呢? 谢谢。
my intention is to get webpart list attached in asp.net page. In sharepoint web page, we can do like this :
SPWeb web = SPContext.Current.Web;
SPLimitedWebPartManager webPartManager = web.GetLimitedWebPartManager(
Page.Request.Path,
PersonalizationScope.Shared);
for (int i = 0; i < webPartManager.WebParts.Count; i++)
{
// We can do checking here or whatever we want......
}
But how to do it in asp.net page ?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先将
Microsoft.SharePoint.dll
添加到 ASP.NET Web 项目。然后,您可以使用以下方法获取 SPSite 和 SPWeb:其余代码将像现在一样工作:
本文有一些其他详细信息: 在 ASP.NET Web 应用程序中检索 SharePoint 网站信息
Start by adding the
Microsoft.SharePoint.dll
to your ASP.NET web project. Then, you can get the SPSite and SPWeb using the following method:The rest of your code will work as you have it now:
This article has some additional detail: Retrieving SharePoint Site Information in an ASP.NET Web Application