Friday, August 22, 2014

Check List Exists in Sharepoint 2010 Site using Client Object Model

Referred URL 

public
 List GetListByTitleCS(ClientContext clientContext, String listTitle)
{
    List existingList;
 
    Web web = clientContext.Web;
    ListCollection lists = web.Lists;
 
    IEnumerable<List> existingLists = clientContext.LoadQuery(
            lists.Where(
            list => list.Title == listTitle)
            );
    clientContext.ExecuteQuery();
 
    existingList = existingLists.FirstOrDefault();
 
    return existingList;
}

No comments: