http://msdn.microsoft.com/en-us/library/ms462161.aspxの例を見て、すべてのサイトとリストを取得しました。ドロップダウンにバインドしていますが、各サイトのすべてのリストを取得するので、サイト名はドロップダウンに何度も表示されます欲しいです。すべてのリストを取得せずにサイトコレクションのすべてのサイトを取得しますか?
私のコードは次のとおりです。
private void getSites()
{
SPSite oSiteCollection = SPContext.Current.Site;
SPWebCollection collWebsite = oSiteCollection.AllWebs;
for (int i = 0; i < collWebsite.Count; i++)
{
using (SPWeb oWebsite = collWebsite[i])
{
SPListCollection collList = oWebsite.Lists;
for (int j = 0; j < collList.Count; j++)
{
ddlParentSite.Items.Add(new ListItem(SPEncode.HtmlEncode(collWebsite[i].Title)));
}
}
}
}
にはどうすればいいのサイトだけではなく自分のリストを得ることができますか?
ありがとうございます。
嫌なピーターですが、そのコードが何をしているのか理解しようと努力しましたか? – Ryan