hi,
i was creating the folder within a doc lib with the below code, but i am getting the below error:
using (SPSite objchildsite = new SPSite(singleWeb.Url))
{
using (SPWeb objchildweb = objchildsite.OpenWeb())
{
objchildweb.AllowUnsafeUpdates = true;
string objchildsweburl = objchildweb.Url;
if (objchildweb.Lists.Count > 0)
{
foreach (SPList singlelist in objchildweb.Lists)
{
if (singlelist.BaseType == SPBaseType.DocumentLibrary)
{
SPDocumentLibrary bifSingleDocLib = singlelist
as SPDocumentLibrary;
if (bifSingleDocLib.IsCatalog == false)
{
var restriFolderrVar=
bifSingleDocLib.Items.Add("", SPFileSystemObjectType.Folder, restrictedFolderName);
restriFolderrVar.Update();
var nonrestrVar= bifSingleDocLib.Items.Add("",
SPFileSystemObjectType.Folder, non_restrictedFolderName);
nonrestrVar.Update();
}
}
}
}
objchildweb.AllowUnsafeUpdates = false;
}
}
Collection was modified; enumeration operation may not execute.