Greets,
I have a reference to a Microsoft.SharePoint.Client.Folder object:
Folder folder = _libraryClientContent.Web.GetFolderByServerRelativeUrl(PATH_DEV_DOWNLOAD + GetDirectoryNameFromPathSP(filename));
The folder MAY contain a custom property. How can I determine:
- if this property exists on the folder
- retrieve the property value if it exists?
Requirements:
- Works in SharePoint 2010 environment
- C# (or easily convertible)
- Uses all standard SharePoint resources; no add-ons, no GitHub, no CodePlex
I have a solution that works but takes way too much time. I need something small and fast.
Thanks in advance for your assistance!
Current function:
public bool IsToolDirectoryReadyForDeployment(string filename)
{
string folderName;
string IsRFD;
filename = filename.Substring(1);
CollectionsGeneric.List<string> filenameParts = new CollectionsGeneric.List<string>(filename.Split('/'));
folderName = filenameParts[0];
List list = _libraryClientContent.Web.Lists.GetByTitle(LIST_SHARED_DOCS);
_libraryClientContent.Load(
list,
property => property.RootFolder,
property => property.RootFolder.Folders
);
_libraryClientContent.ExecuteQuery();
ListItemCollection items = list.GetItems(CamlQuery.CreateAllFoldersQuery());
_libraryClientContent.Load(items,
eachItem => eachItem.Include(
item => item.DisplayName));
_libraryClientContent.ExecuteQuery();
ListItem toolItem = items.ToList<ListItem>().Single<ListItem>(li => (li.DisplayName == folderName));
_libraryClientContent.Load(toolItem.FieldValuesForEdit);
_libraryClientContent.ExecuteQuery();
if (!toolItem.FieldValuesForEdit.FieldValues.TryGetValue("z_Deploy", out IsRFD))
return false;
else
return IsRFD.Equals("Yes");
}
0 commentaires:
Enregistrer un commentaire