views:

117

answers:

1

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 'AllowUnsafeUpdates' property on SPWeb.

yet i've set AllUnsafeUpdates to true. Is it me, am I missing something?

A: 

Did you try running web.update() before running the contentDeploymentJob? It looks to me that you are setting the property but not saving it.

UJ
i moved the web.update to the line above the contentdeployment job but still receive the same error.
Rob