Retrieve files from a sub folder SharePoint document library with CSOM

Saturday, June 1, 2013

public static void GetAllListItemsInFolder()
{
            ClientContext clientContext = new ClientContext("http://xxxxxx:000");
            List list = clientContext.Web.Lists.GetByTitle("MainLib");
            CamlQuery camlQuery = new CamlQuery();
            camlQuery.ViewXml = @"
                                   
                                   
                               
";            camlQuery.FolderServerRelativeUrl = "/MainLib/HR";
            ListItemCollection listItems = list.GetItems(camlQuery);
            clientContext.Load(listItems);
            clientContext.ExecuteQuery();
            ListItem itemOfInterest = listItems[0];
            string Itemcreator = itemOfInterest.FieldValues["Created_x0020_By"].ToString();
            string Itemtitle = itemOfInterest.FieldValues["Title"].ToString();
        }

share this post
Share to Facebook Share to Twitter Share to Google+ Share to Stumble Upon Share to Evernote Share to Blogger Share to Email Share to Yahoo Messenger More...

0 comments: