private static IAadClient CreateAadClient(OrganizationId organizationId, GraphProxyVersions graphProxyVersion) { if (TestHooks.GraphApi_GetAadClient != null) { return(TestHooks.GraphApi_GetAadClient(organizationId)); } return(AADClientFactory.Create(organizationId, graphProxyVersion)); }
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)); }
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)); }