Skip to content

Commit

Permalink
Merge branch 'SupportVanityDomain' of https://github.com/KoenZomers/p…
Browse files Browse the repository at this point in the history
  • Loading branch information
jansenbe committed Apr 17, 2024
2 parents 1dc5503 + e78de59 commit b43b391
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/PnP.Framework/Extensions/TenantExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@ public static List<string> GetHubSiteChildUrls(this Tenant tenant, Guid hubsiteI
/// <param name="tenant">A tenant object pointing to the context of a Tenant Administration site</param>
/// <param name="siteId">The id of the site collection</param>
/// <param name="detailed">Boolean indicating if detailed information should be returned of the site (true - default) or only the basics (false)</param>
/// <param name="tenantAdminUrl">The URL to use to connect to the tenant admin site. Typically only provided in the case of a vanity domain tenant. If not provided, tenant-admin will be assumed.</param>
/// <returns>SiteProperties of the site collection or NULL of no site collection found with the provided Id</returns>
public static SiteProperties GetSitePropertiesById(this Tenant tenant, Guid siteId, bool detailed = true)
public static SiteProperties GetSitePropertiesById(this Tenant tenant, Guid siteId, bool detailed = true, string tenantAdminUrl = null)
{
// Create a context to the SharePoint Online Admin site
using (var tenantContext = tenant.Context.Clone((tenant.Context as ClientContext).Web.GetTenantAdministrationUrl()))
using (var tenantContext = tenant.Context.Clone(tenantAdminUrl ?? (tenant.Context as ClientContext).Web.GetTenantAdministrationUrl()))
{
// Utilize the hidden list in the SharePoint Online Admin site to search for a site collection with matching Id using a CAML Query
var siteList = tenantContext.Web.Lists.GetByTitle(SPO_ADMIN_SITECOL_LIST_TITLE);
Expand Down

0 comments on commit b43b391

Please sign in to comment.