开发者

How to get all items provided by sharepoint based on its basetype

I need to get the list of items provided by sharepoint. For ex., If I create a document library, here the item is will be a document. Similarly, if I create a picture library, the item will be picture and 开发者_StackOverflowif I create a pages library, the item will be Page and so on. I want to get the list of all these items such as Page, Document, Image, Contact etc. using Sharepoint Object Model.

How can I get it?


GetAllSubSitesListsAndContentTypesUnderContext()
{
SPWebCollection subSites = siteCollection.AllWebs;

for (int i = 0; i < subSites.Count; i++)
{
System.Console.WriteLine(“…” + subSites[i].Title.ToString() + ” – Site”);

            SPListCollection lists = subSites[i].Lists;
            for (int j = 0; j < lists.Count; j++)
{
System.Console.WriteLine(“……” + lists[j].Title.ToString() + ” – List”);

                  SPContentTypeCollection types = lists[j].ContentTypes;
                  for (int k = 0; k < types.Count; k++)
                  {
System.Console.WriteLine(“………” + types[k].Name.ToString() + ” – Content Type”);
                  }
}
subSites[i].Dispose()
}
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜