I am developing a SharePoint job. In the public override void Execute(Guid targetInstanceId)
method, my code goes:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
int count = this.WebApplication.Sites.Count;
for (int i = 0; i < count; i++)
{
using (SPSite site = new SPSite(this.WebApplication.Sites[i].ID))
{
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
documentLibraries = web.GetListsOfType(SPBaseType.DocumentLibrary);
foreach (SPDocumentLibrary documentLibrary in documentLibraries)
{
foreach (SPListItem document in documentLibrary.Items)
{
document[periodicReviewStatusField] = "Review is needed";
document.UpdateOverwriteVersion();
}
}
web.AllowUnsafeUpdates = false;
}
}
}
});
My code fails on the first document update in the line document.UpdateOverwriteVersion();
with the error message:
Additions to this Web site have been blocked. Please contact the administrator to resolve this problem.
I know for a fact that the site collection is not locked (which was the only answer I found online) and that there are no locks on any of the documents. Can you help me resolve this? It's killing me for a couple of days now ...