Monday, March 29, 2010

Getting SharePoint subwebs

You may encounter access denied problems when you try to run the code web.Webs using a non-admin account. This problem may occur even when the user account has access to all the subsite of the particular web. The entire page in which the webpart is in becomes "Access Denied" although only the webpart is affected.

SPSecurity.CatchAccessDeniedException = false; will allow the user to access the page, but the webpart would display an "Unauthorised Access Exception".

A more accurate function would be web.GetSubwebsForCurrentUser()

No comments:

Post a Comment