/// <summary> /// Returns the first tenant with the given verified domain from the current tenants collection. /// </summary> /// <param name="domain">The verified domain, e.g. <c>yourtenant.onmicrosoft.com</c></param> public static async Task <ITenantDetail> ByDomainAsync(this ITenantDetailCollection tenants, string domain) { var result = await tenants.ByPredicateAsync((t) => { var dom = t.VerifiedDomains.FirstOrDefault(x => x.Name.Equals(domain, StringComparison.OrdinalIgnoreCase)); return(dom != null); }); return(result.FirstOrDefault()); }
public static async Task <ITenantDetail> ByTenantIdAsync(this ITenantDetailCollection tenants, Guid tenantId) { return(await tenants.ByTenantIdAsync(tenantId.ToString())); }
/// <summary> /// Returns the tenant from the current tenants collection with the given tenant id. /// </summary> /// <param name="tenantId">The object ID of the tenant to return.</param> public static async Task <ITenantDetail> ByTenantIdAsync(this ITenantDetailCollection tenants, string tenantId) { return(await tenants.Where(x => x.ObjectId == tenantId).ExecuteSingleAsync()); }
/// <summary> /// Returns the tenant from the current tenants collection with the given tenant id. /// </summary> /// <param name="tenantId">The object ID of the tenant to return.</param> public static ITenantDetail ByTenantId(this ITenantDetailCollection tenants, string tenantId) { return(AsyncHelper.RunSync(async() => await tenants.ByTenantIdAsync(tenantId))); }
/// <summary> /// Returns the first tenant with the given verified domain from the current tenants collection. /// </summary> /// <param name="domain">The verified domain, e.g. <c>yourtenant.onmicrosoft.com</c></param> public static ITenantDetail ByDomain(this ITenantDetailCollection tenants, string domain) { return(AsyncHelper.RunSync(async() => await tenants.ByDomainAsync(domain))); }