1

I would like to add a webpart to my page with all the Titles of all my lists from contenttype X. How can I implement this?

For example I have 4 lists which are using contenttype X:

ListA
ListB
ListC
ListD

In my webpart I would like to have all these list instances with some a href to the list:

ListA
ListB
ListC
ListD
3

Use SPContentTypeUsage.GetUsages method to get the list instances where a content type has been used. Example:

SPContentType ct = site.RootWeb.ContentTypes["ContentType"];
IList<SPContentTypeUsage> usages = SPContentTypeUsage.GetUsages(ct);
foreach (SPContentTypeUsage usage in usages)
{
    if (usage.IsUrlToList)
    {
        SPList list = web.GetList(usage.Url);       
    }
}
  • Thanks for the solution programmatically. I am looking for some solution OOTB or in SharePoint designer. – Ola Apr 28 '14 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.