1

In the new Sharepoint Framework need to build a reusable web part by having a list selection dropdown on the web part property pane. Hence, in order to build the property pane of the web part, need to make a rest call to get all the lists having a specific content type set as the lists default content type (the content type to be default is not necessary just that the list must have the content type). These lists would appear in the drop down field of the property pane from where the user can select a list.

Above stated is the end to end requirement but if you can just get me the solution to get all lists of the same site having a specific content type that would be enough, getting all list and then filtering is not a solution I'm searching for, and also avoiding Search REST API calls.

  • Alas this needs a Where is Wally approach; applying ContentTypes to a List/Lib creates a copy without the Parent ContentType knowing/registering/recording where a copy was created. So you have to scan every List/Lib (for Wally) ContentTypes. If your issue is Performance you can built such an (ContentType) index yourself so your WebPart can query a single list(index); but make sure to update it on every ContentType change. – Danny '365CSI' Engelman Dec 18 '17 at 11:17
  • Search API would be the best solution:var searchApi = '/_api/search/query?querytext=%27ContentType:"ContentType Name".. Else you have to get all the lists and then filter it out – Deepmala Dec 18 '17 at 11:31

Your Answer

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

Browse other questions tagged or ask your own question.