Beispiel #1
0
        static void RetrieveAADInfo()
        {
            Console.WriteLine("Start to sync AADInfo ...");
            VerifiedDomain initialDomain = new VerifiedDomain();
            VerifiedDomain defaultDomain = new VerifiedDomain();
            AADInfoEntity aadInfo = null;
            ITenantDetail tenant = null;
            try
            {
                List<ITenantDetail> tenantsList = activeDirectoryClient.TenantDetails
                    .Where(tenantDetail => tenantDetail.ObjectId.Equals(Constants.TenantId))
                    .ExecuteAsync().Result.CurrentPage.ToList();
                if (tenantsList.Count > 0)
                {
                    tenant = tenantsList.First();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("\nError getting TenantDetails {0} {1}", e.Message, e.InnerException != null ? e.InnerException.Message : "");
            }

            if (tenant == null)
            {
                Console.WriteLine("Tenant not found");
            }
            else
            {
                TenantDetail tenantDetail = (TenantDetail)tenant;                

                // Get the Tenant's Verified Domains 
                initialDomain = tenantDetail.VerifiedDomains.First(x => x.Initial.HasValue && x.Initial.Value);
                defaultDomain = tenantDetail.VerifiedDomains.First(x => [email protected] && [email protected]);
                aadInfo = new AADInfoEntity(tenantDetail.ObjectId, initialDomain.Name);
                aadInfo.DefaultDomainName = defaultDomain.Name;
                aadInfo.ObjectType = tenantDetail.ObjectType;
                aadInfo.DisplayName = tenantDetail.DisplayName; 
                // Get Tenant's Tech Contacts
                foreach (string techContact in tenantDetail.TechnicalNotificationMails)
                {
                    aadInfo.TechContacts += techContact + ";";
                }
                foreach (string marketContact in tenantDetail.MarketingNotificationEmails)
                {
                    aadInfo.TechContacts += marketContact + ";";
                }
                aadInfo.PreferredLanguage = tenantDetail.PreferredLanguage;
                aadInfo.CountryLetter = tenantDetail.CountryLetterCode;
                aadInfo.Country = tenantDetail.Country;
                aadInfo.State = tenantDetail.State;
                aadInfo.City = tenantDetail.City;
                aadInfo.Street = tenantDetail.Street;
                aadTableOper.InsertAADInfo(aadInfo);
            }
        }
Beispiel #2
0
 public bool InsertAADInfo(AADInfoEntity Aad)
 {
     var operation = TableOperation.InsertOrReplace(Aad);
     _table.Execute(operation);
     return true;
 }