Spsite allwebs unauthorizedaccessexception
You will see little help and/or pity from other developers on forums when newbies hit these obstacles because most of the information is there in the SDK to be sorted out if you take the time. However, there comes a time when your understanding is shaken when encountering a new and interesting error. Make sure you use an URL defined in Alternate Access Mappings, not something that redirects your requests thereto.If you are running this from the server, you will need to make sure you "run as administrator" also, the farm account is the account that is used for the identity for Central Admin. The only inkling that we’re crossing boundaries is the Services or vice-versa. This is compounded by the fact that from the Portal context I can access a SPSite. Alerts and there seems to be nothing wrong with this on the surface.
This is where I ran in to trouble and started catching Un Authorized Access Exception. I test the release exe file on the server with Share Point Server 2007 sp1,then the new problem below occur: (I'm the one of the admin of the server,why it tell me unauthorized?? (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft. ) ************** Exception Text ************** System. Below is the example from the SDK which is really there to just baffle you further because you think if they bother to show an example and I can’t even get that to work SPAlert Collection class has an example I can’t even get to work: The above code is so simple that to have obtained the exception I was certain that it was a simple permissions problem rather than a coding problem. Is In Role(@”BUILTIN\Administrators”) true //////// // First site (the root) from SPSite.