The following code can be used to check the folder exists in Sharepoint Site:
public static SPFolder CheckFolderExists(SPList targetList, string folderUrl)
{
SPFolder folder = null;
if (string.IsNullOrEmpty(folderUrl))
return targetList.RootFolder;
SPFolderCollection col = targetList.ParentWeb.Folders;
foreach (SPFolder item in col)
{
foreach (SPFolder fol1 in item.SubFolders)
{
foreach (SPFolder fol2 in fol1.SubFolders)
{
if (fol2.Name.ToLower() == folderUrl.ToLower())
{
folder = fol2;
return folder;
}
}
}
}
return folder;
}
Vinay Chavadi's Blog on Application Development in SharePoint 2010/2013/2016 & SharePoint Online
Subscribe to:
Post Comments (Atom)
-
There are 3 SPJobLockType available: 1. SPJobLockType.None -- if you set it none, the instance will run in all the available s...
-
Most of you who are working on Remote Event Receivers must have encountered this issue of "Updated event getting fired multiple times&...
No comments:
Post a Comment