Thanks Ishai and Sezai, that make more sense now. Cheers
Ken Date: Tue, 14 Jul 2009 09:39:33 +0800 From: [email protected] Subject: Re: Access is denied when create a subsite To: [email protected] How have you created parentWeb? It is likely that parentWeb was created in a non-elevated context, see these examples for an explanation of this problem. http://daniellarson.spaces.live.com/blog/cns!D3543C5837291E93!927entry http://www.davehunter.co.uk/Blog/Lists/Posts/Post.aspx?List=f0e16a1a%2D6fa9%2D4130%2Dbcab%2Dbaeb97ccc4ff&ID=43 You basically need to create parentWeb again via creation of a new SPSite, SPWeb etc. within the RunWithElevatedPrivileges block. Sezai On Tue, Jul 14, 2009 at 8:59 AM, ken zheng <[email protected]> wrote: Hi Guys: I got Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) error when user runs SPSecurity.RunWithElevatedPrivileges(new SPSecurity.CodeToRunElevated(delegate() { web = parentWeb.Webs.Add(relativeUrl, title, description, LCID, template, useUniquePermissions, convertIfThere); })); It is indeed a permission problem as I (Site Admin) has no issue. I think SPSecurity.RunWithElevatedPrivileges should be able to do it, is it right? Cheers Ken Support procedure: https://www.codify.com/lists/support List address: [email protected] Subscribe: [email protected] Unsubscribe: [email protected] List FAQ: http://www.codify.com/lists/ozmoss Other lists you might want to join: http://www.codify.com/lists Support procedure: https://www.codify.com/lists/support List address: [email protected] Subscribe: [email protected] Unsubscribe: [email protected] List FAQ: http://www.codify.com/lists/ozmoss Other lists you might want to join: http://www.codify.com/lists-------------------------------------------------------------------------------- Support procedure: http://www.codify.com/lists/support List address: [email protected] Subscribe: [email protected] Unsubscribe: [email protected] List FAQ: http://www.codify.com/lists/ozmoss Other lists you might want to join: http://www.codify.com/lists
