Resolution: In SharePoint Object model you can use SPFolder.Item property. But SCOM Folder doesn't have such prop. You need to use CAML query to get this item:
m_rootTrgUrl = web URL
mm_trgParentWebId = web ID
m_trgListId = existing list ID
srvRelativeURL = folder server-relative URL
using (var clientContext = new ClientContext(m_rootTrgUrl))
{
var trgWeb = clientContext.Site.OpenWebById(m_trgParentWebId);
var trgList = trgWeb.Lists.GetById(m_trgListId);
var query = new CamlQuery();
query.ViewXml = "<View Scope=\"RecursiveAll\"> " +
"<Query>" +
"<Where>" +
"<And>" +
"<Eq>" +
"<FieldRef Name=\"FSObjType\" />" +
"<Value Type=\"Integer\">1</Value>" +
"</Eq>" +
"<Eq>" +
"<FieldRef Name=\"Title\"/>" +
"<Value Type=\"Text\">" + folderName + "</Value>" +
"</Eq>" +
"</And>" +
"</Where>" +
"</Query>" +
"</View>";
query.FolderServerRelativeUrl = srvRelativeURL;
var folderItems = trgList.GetItems(query);
clientContext.Load(trgList);
clientContext.Load(folderItems);
clientContext.ExecuteQuery();
switch (folderItems.Count)
{
// process query result
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.