I need to get the folder object, SPFolder
using C# in my SP 2013 on-prem site collection.
Below code, I have created a new folder programmatically.
Now how can I get this SPFolder
object and later I wanna apply Contribute
permissions for this folder?
It would be good, if i can get GUID
approach.
There is only one param, we need to pass , thats GUID
, but how to retrieve the GUID
of the folder.
try
{
SPList marketrsrchDocLib = paramCurrentWeb.Lists.TryGetList("MarketResearch");
if (marketrsrchDocLib != null)
{
listitemDivisionFolder = marketrsrchDocLib.Items.Add("",
SPFileSystemObjectType.Folder, strDivisionNameCreated);
listitemDivisionFolder.Update();
}
marketrsrchDocLib.Update();
//now apply permissionsfor the folder -
SPFolder folder = paramCurrentWeb.GetFolder(???)
//?? what should be the correct code here
}