예제 #1
0
        static void Main(string[] args)
        {
            try
            {
                string tenantAdminUrl = "https://contoso-admin.sharepoint.com";
                string userName       = "******";

                using (var clientContext = new ClientContext(tenantAdminUrl))
                {
                    clientContext.Credentials = new SharePointOnlineCredentials(userName, GetSecureString($"Password for {userName}"));

                    // Check the readme file to learn how to register an application in azure ad and replace these values
                    MultiGeoManager multiGeoManager = new MultiGeoManager(clientContext);
                    var             geos            = multiGeoManager.GetTenantGeoLocations();
                    foreach (var geo in geos)
                    {
                        Console.WriteLine($"{geo.GeoLocation} - {geo.RootSiteUrl} - {geo.TenantAdminUrl}");
                    }

                    Console.WriteLine("Press a key to continue...");
                    Console.ReadLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Multi-geo exception: ${ex.ToString()}");
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            try
            {
                // Check the readme file to learn how to register an application in azure ad and replace these values
                MultiGeoManager multiGeoManager = new MultiGeoManager("<application id>", "<application password>", "<Azure AD domain>");
                var             geos            = multiGeoManager.GetTenantGeoLocations();
                foreach (var geo in geos)
                {
                    Console.WriteLine($"{geo.GeoLocation} - {geo.RootSiteUrl} - {geo.TenantAdminUrl}");
                }

                Console.WriteLine("Press a key to continue...");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Multi-geo exception: ${ex.ToString()}");
            }
        }