Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Usually when we need to get all the document libraries from a SharePoint site, we can follow the given code snippet:-

SPListCollection lstCol = oSite.OpenWeb().GetListsOfType(SPBaseType.DocumentLibrary);

But how to get the same result using SharePoint Client Object Model? Thanks in advance...:)

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Hi u just get all list from site and just check it's BaseType like this

using (ClientContext clientcontext= new ClientContext("http://your server"))
{

    //Load Libraries from SharePoint
    clientcontext.Load(clientcontext.Web.Lists);
    clientcontext.ExecuteQuery();
    foreach (List list in clientcontext.Web.Lists)
    {
       try
       {
            if (list.BaseType.ToString() == "DocumentLibrary")
             {
                 // here u get all document library
             }
       }
       catch()
       {}
    }
}
share|improve this answer
    
Thanks V_B.Thanks a lot...:) –  DeathRider Aug 27 '12 at 12:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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