views:

115

answers:

2

Hi,

I have a Site Template with few customized lists and customized pages. I create new webs when ever needed using the site template. After creating the web, I also set up a theme and unique permissions to the web using C# code itself, then I redirect the page to the newly created web URL. My code runs within a Long running operation. It works all the time fine, but in some circumstance I get an error "file not found" when the page re-directed to the newly created web.

When I had closer look, I see that the web was properly created and the permissions were set; the pages library & other lists are also found, but the master page gallery is not found. Due to that I could not browse any pages in the page library & I could not even check web theme. When I see the Logs I found the below error.

04/09/2009 14:22:49.35 w3wp.exe (0x11B4) 0x0D0C Windows SharePoint Services General 8z1y Medium Failed to create list "Master Page Gallery" in web "http://rootsite/subsite", HRESULT=0x81020012. List XML: ""

What could cause this issue? I don't get this all time only sometimes I get this issue. There were no errors thrown on code, but the web's master page gallery was not created. Have you ever faced such problem? How can I solve this?

Thanks in advance,

~Yuva

+1  A: 

The HRESULT you're getting is from a COM error: System.Runtime.InteropServices.COMException (0x81020012): The specified name is already in use.

Make sure that the gallery you're trying to create is at the web level, not the site or webapplication level. Can you post examples of the URL when it worked vs. when it didn't?

Greg Hurlman
A: 

Isn't the master page gallery usually at the site rather than web level? Subsites can use a master page defined by the parent site, so you could be confusing things by trying to define the master pages on the subsite as well.

Tom Clarkson