Roger Da

Roger Da

  • NA
  • 26
  • 429

CSOM Library of ContentType or Get list of ContentTypes of a Library

Apr 15 2021 4:22 PM
I can easily get a list of Libraries
 
I can easily get a list of all ContentTypes
 
But having trouble getting a list if libraries and what contenttypes belong to that library.
 
Can anyone assist wtih this request? We utilize a library and have a small list of content types in a library.
 
Thanks in advance.
 
This gets me the list of Libraries.
  1. List<string> sOut = new List<string>();  
  2. var context = new ClientContext(url);  
  3. context.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;  
  4. var web = context.Web;  
  5. ListCollection collList = web.Lists;  
  6. context.Load(collList);  
  7. context.ExecuteQuery();  
  8. foreach (List oList in collList)  
  9. {  
  10. Console.WriteLine("Title: {0} Created: {1}", oList.Title, oList.Created.ToString());  
  11. }  

Answers (2)