Content Deployment and AllowUnsafeUpdates
I have this bit of code...
using (SPSite sitecollection = new SPSite(siteUrl))
{
using (SPWeb web = sitecollection.OpenWeb(webUrl))
{
try
{
web.AllowUnsafeUpdates = true;
ContentDeploymentJob.AddQuickDeployObject(web,
Microsoft.SharePoint.Deployment.SPDeploymentObjectType.ListItem,
itemUrl);
web.Update();
}
finally
{
web.AllowUnsafeUpdates = false;
}
}
}
which should add an item to the content deployment for the specified web. However I get this error...
Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUp开发者_StackOverflowdates' property on SPWeb.
yet i've set AllUnsafeUpdates to true. Is it me, am I missing something?
Did you try running web.update() before running the contentDeploymentJob? It looks to me that you are setting the property but not saving it.
精彩评论