Below code finds if the Folder is present or not in a SharePoint List or library from client side
public void
CheckFolderExists(string siteURL)
{
ClientContext
clientContext = new ClientContext(siteURL);
List oList = clientContext.Web.Lists.GetByTitle("ListA");
CamlQuery camlQuery = new
CamlQuery();
camlQuery.ViewXml = "<View
Scope='RecursiveAll'>"
+ "<Query>"
+ "
<Where>"
+ " <Eq><FieldRef Name='FSObjType'
/><Value Type='Integer'>1</Value></Eq>"
+ "
</Where>"
+ "</Query>"
+ "</View>";
ListItemCollection collListItem =
oList.GetItems(camlQuery);
clientContext.Load(collListItem);
clientContext.ExecuteQuery();
string a = "";
foreach (ListItem
oListItem in collListItem)
{
a = a + oListItem["Title"];
}
label1.Text = a;
}
The code will give you all the folders in the list ,you can play with CAML query or object to get the folder which you need
No comments:
Post a Comment