0
我在從其他網站集檢索列表項時遇到問題。嘗試從當前網站集中收到列表項時,我沒有問題。例如,http://myintranet.com/Departments/IT的作品。但是http://myintranet.com/sites/Departments/IT會返回錯誤。從SharePoint 2010中的其他網站集檢索列表項
if (!String.IsNullOrEmpty(SiteName) && !String.IsNullOrEmpty(SPContext.Current.Web.Url))
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite intranetSite = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb currentWeb = intranetSite.AllWebs["/sites/projects/Physics"])
{
SPList postList = currentWeb.Lists.TryGetList("Issues");
if (postList != null)
{
IssueList.DataSource = postList.Items.GetDataTable();
IssueList.DataBind();
}
}
}
});
}
我沒有使用任何不同的代碼來試圖接收列表項。唯一的區別是,這次我從另一個網站集獲取列表項。
感謝您的幫助!
現在我終於開始明白這個管理路徑的業務。一整天都在引起我的問題。謝謝你的幫助。我會盡力實施這個明天。 – R100 2011-02-17 20:39:20