Programmatically get all files in a document set sharepoint 2010
To Programmatically retrieve files in a DocumentSet -
* We will first check if its a item or a Folder.
* Then check if its a DocumentSet of a SPFolder.
* At last Retrive the files in the document set.
bool _isDocumentset = IsDocumentSet(_item)
public static bool IsDocumentSet(this SPListItem item)
{
bool documentSetItem = false;
DocumentSet documentSet = null;
if (null != item && item.IsFolder())
{
documentSet = DocumentSet.GetDocumentSet(item.Folder);
if (null != documentSet)
documentSetItem = true;
}
return documentSetItem;
}
3. If document set then get its files
if(isDocumentset)
{
SPFolder documentsetFolder = _item.Folder;
SPFile file = documentsetFolder.Files[0]; -> Get files
}
* We will first check if its a item or a Folder.
* Then check if its a DocumentSet of a SPFolder.
* At last Retrive the files in the document set.
bool _isDocumentset = IsDocumentSet(_item)
public static bool IsDocumentSet(this SPListItem item)
{
bool documentSetItem = false;
DocumentSet documentSet = null;
if (null != item && item.IsFolder())
{
documentSet = DocumentSet.GetDocumentSet(item.Folder);
if (null != documentSet)
documentSetItem = true;
}
return documentSetItem;
}
3. If document set then get its files
if(isDocumentset)
{
SPFolder documentsetFolder = _item.Folder;
SPFile file = documentsetFolder.Files[0]; -> Get files
}
Good post thanks!
ReplyDelete1337x
baby shower gifts
Borgata Hotel Casino & Spa: Employee Reviews & Overview
ReplyDeleteThe 군포 출장마사지 Borgata Hotel Casino 오산 출장안마 & Spa has a restaurant, 남원 출장샵 casino and spa. The casino was very nice. 김해 출장샵 You'll never go to a 구미 출장마사지 pool or go to a bar. They Rating: 4 · 1 review