Question : Getting Unauthorized access exception in SharePoint

Hi,
Below is my program

class Program
    {
        static void Main(string[] args)
        {
            SPSite siteCollection = new SPSite(<SPSITE>);
            SPWebCollection sites = siteCollection.AllWebs;

           foreach (SPWeb site in sites)
            {
                SPListCollection lists = site.Lists;

                Console.WriteLine("Site: " + site.Name + "  Lists: "
                   + lists.Count.ToString());
            }

            Console.WriteLine("Press ENTER to continue");
            Console.ReadLine();

        }
    }

While I try to get in the for loop I get the following exception:

{"Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"}

Void HandleUnauthorizedAccessException(System.UnauthorizedAccessException)
"   at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex)\r\n   at Microsoft.SharePoint.Library.SPRequest.GetAllWebsOfSite(String bstrUrl, Object& pvarWebs, Object& pvarWebIds, Object& pvarParentWebs, Object& pvarLangs, Object& pvarTitles)\r\n   at Microsoft.SharePoint.SPSite.SPWebCollectionProvider.GetWebsData(String[]& strNames, String[]& strServiceRelUrls, Guid[]& guidWebIds, Int32[]& nLanguages, String[]& strTitles, String[]& strDescriptions, String[]& strCreationTimes, String[]& strModifiedTimes, Boolean[]& bUserIsWebAdmins, Int32[]& nWebTempla

Answer : Getting Unauthorized access exception in SharePoint

So, here is the thing if you are have 2 Exchange servers the primary Exchange will have to route the traffic to the other Exchange in the remote site so you would still be using your low bandwidth no matter what. The mail still must travel through your slow connection between sites.
Random Solutions  
 
programming4us programming4us