Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION)) in SharePoint Part 2

Posted by BeraCim on Stack Overflow See other posts from Stack Overflow or by BeraCim
Published on 2010-04-17T08:47:44Z Indexed on 2010/04/17 8:53 UTC
Read the original article Hit count: 311

Filed under:
|

Hi all:

Following this post which I posted some time ago, I now get the same error every time I try to rewire 2 web's URLs.

Basically, this is the code. It runs in a LongRunningOperationJob:

SPWeb existingWeb = null;
using (existingWeb = site.OpenWeb(wedId))
{
    SPWeb destinationWeb = createNewSite(existingWeb);
    existingWeb.AllowUnsafeUpdates = true;
    existingWeb.Name = existingWeb.Name + "_old";
    existingWeb.Title = existingWeb.Title + "_old";
    existingWeb.Description = existingWeb.Description + "_old";

    existingWeb.Update()
    existingWeb.AllowUnsafeUpdates = false;

    destinationWeb.AllowUnsafeUpdates = true;
    destinationWeb.Name = existingWeb.Name;
    destinationWeb.Title = existingWeb.Title;
    destinationWeb.Description = existingWeb.Description;

    destinationWeb.Update();
    destinationWeb.AllowUnsafeUpdates = false;

    // null this for what its worth
    existingWeb = null;
    destinationWeb = null;
} // <---- Exception raised here

Basically, the code is trying to rename the existing site's URL to something else, and have the destination web's url point to the old site's URL.

When I run this for the first time, I received the Exception mentioned in the subject.

However, every run after, I do not see the exception anymore.

The webs DO get rewired... but at the cost of the app dying an unnecessary and terrible death.

I'm at a complete lost as to what is going on and needs urgent help. Does sharepoint keep any hidden table from me or is the logic above has fatal problems?

Thanks.

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about sharepoint2007