Sharepoint 2010 Development, Branding
Tel: +91.22.2837.5300
Email: info@iotap.com
 

Blog Details

Share this blog : twitter

Feb 13

Written by: moss.iotap@iotap.com
Sat, 13 Feb 2010 18:38:02 GMT 

Here I'm going to give you a simple snippet of "Retrieving the content type enabled lists" from the site using Client Object Model.

            ClientContext context = new ClientContext("http://localhost");
            Web web = context.Web;

   //Load all the lists from web
            ListCollection listCollection = web.Lists;   
   //Filters the lists has the content type enabled
            context.Load(listCollection,
                lists => lists
                    .Include(list => list.Title)
                    .Where(list => list.ContentTypesEnabled)                   
                );
   //Execute the Query
            context.ExecuteQuery();                    
            Console.WriteLine("Lists enabled with ContentType:");
   //Print the Content type enabled lists
            foreach (var list in listCollection)
            {
                Console.WriteLine(list.Title);
            }

The above code only returns the List collection from particular web, those are content type enabled.

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel