예제 #1
0
 public static AADClient Create(OrganizationId organizationId, GraphProxyVersions apiVersion = GraphProxyVersions.Version14)
 {
     if (AADClientFactory.graphUrl.Value == null)
     {
         AADClientFactory.Tracer.TraceDebug(0L, "No GraphURL available, cannot create AADClient");
         return(null);
     }
     return(new AADClient(AADClientFactory.graphUrl.Value, AADClientFactory.GetTenantContextId(organizationId), AADClientFactory.GetAppCredentials(organizationId), apiVersion));
 }
예제 #2
0
 public static AADClient Create(ADUser user)
 {
     if (AADClientFactory.graphUrl.Value == null)
     {
         AADClientFactory.Tracer.TraceDebug(0L, "No GraphURL available, cannot create AADClient");
         return(null);
     }
     return(new AADClient(AADClientFactory.graphUrl.Value, AADClientFactory.GetTenantContextId(user.OrganizationId), AADClientFactory.GetActAsUserCredentials(user), GraphProxyVersions.Version14));
 }
예제 #3
0
        public static AADClient Create(string smtpAddress, GraphProxyVersions apiVersion = GraphProxyVersions.Version14)
        {
            ArgumentValidator.ThrowIfNullOrEmpty("smtpAddress", smtpAddress);
            SmtpAddress smtpAddress2 = new SmtpAddress(smtpAddress);

            if (!smtpAddress2.IsValidAddress)
            {
                AADClientFactory.Tracer.TraceDebug <string>(0L, "SMTP address {0} is not valid, cannot create AADClient", smtpAddress);
                return(null);
            }
            OrganizationId organizationId = OrganizationId.FromAcceptedDomain(smtpAddress2.Domain);

            return(AADClientFactory.Create(organizationId, apiVersion));
        }
예제 #4
0
        private static Uri GetRootSiteUrlFromAAD(OrganizationId organizationId)
        {
            AADClient aadclient = AADClientFactory.Create(organizationId, GraphProxyVersions.Version14);

            if (aadclient == null)
            {
                SharePointUrl.Tracer.TraceDebug <OrganizationId>(0L, "Failed to create AADClient for organization {0}", organizationId);
                return(null);
            }
            Uri rootSiteUrlFromServiceInfo = SharePointUrl.GetRootSiteUrlFromServiceInfo(aadclient);

            if (rootSiteUrlFromServiceInfo != null)
            {
                SharePointUrl.Tracer.TraceDebug <OrganizationId, Uri>(0L, "Found SharePoint Root Site Url in ServiceInfo for organization {0}: {1}", organizationId, rootSiteUrlFromServiceInfo);
            }
            return(rootSiteUrlFromServiceInfo);
        }