Table of Contents

Interface ISiteCollectionManager

Namespace
PnP.Core.Admin.Model.SharePoint
Assembly
PnP.Core.Admin.dll

SharePoint Site Collection features

public interface ISiteCollectionManager

Methods

ConnectSiteCollectionToGroup(ConnectSiteToGroupOptions, CreationOptions)

Connects an existing site collection to a new Microsoft 365 group

void ConnectSiteCollectionToGroup(ConnectSiteToGroupOptions siteGroupConnectOptions, CreationOptions creationOptions = null)

Parameters

siteGroupConnectOptions ConnectSiteToGroupOptions

Information needed to handle the connection of the site collection to a new Microsoft 365 group.

creationOptions CreationOptions

Options to control the connect to site process

ConnectSiteCollectionToGroupAsync(ConnectSiteToGroupOptions, CreationOptions)

Connects an existing site collection to a new Microsoft 365 group

Task ConnectSiteCollectionToGroupAsync(ConnectSiteToGroupOptions siteGroupConnectOptions, CreationOptions creationOptions = null)

Parameters

siteGroupConnectOptions ConnectSiteToGroupOptions

Information needed to handle the connection of the site collection to a new Microsoft 365 group.

creationOptions CreationOptions

Options to control the connect to site process

Returns

Task

CreateSiteCollection(CommonSiteOptions, SiteCreationOptions, VanityUrlOptions)

Creates a site collection and returns a PnPContext to start using the created site collection

PnPContext CreateSiteCollection(CommonSiteOptions siteToCreate, SiteCreationOptions creationOptions = null, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToCreate CommonSiteOptions

Information about the site collection to create. Pass in a CommunicationSiteOptions, TeamSiteOptions, TeamSiteWithoutGroupOptions or ClassicSiteOptions instance.

creationOptions SiteCreationOptions

Options that control the site creation process

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

PnPContext

A PnPContext to start using the created site collection

CreateSiteCollectionAsync(CommonSiteOptions, SiteCreationOptions, VanityUrlOptions)

Creates a site collection and returns a PnPContext to start using the created site collection

Task<PnPContext> CreateSiteCollectionAsync(CommonSiteOptions siteToCreate, SiteCreationOptions creationOptions = null, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToCreate CommonSiteOptions

Information about the site collection to create. Pass in a CommunicationSiteOptions, TeamSiteOptions, TeamSiteWithoutGroupOptions or ClassicSiteOptions instance.

creationOptions SiteCreationOptions

Options that control the site creation process

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<PnPContext>

A PnPContext to start using the created site collection

DeleteRecycledSiteCollection(Uri, VanityUrlOptions)

Deletes a site collection from the recycle bin.

void DeleteRecycledSiteCollection(Uri siteToDelete, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToDelete Uri

Site collection to delete from the recycle bin

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

DeleteRecycledSiteCollectionAsync(Uri, VanityUrlOptions)

Deletes a site collection from the recycle bin.

Task DeleteRecycledSiteCollectionAsync(Uri siteToDelete, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToDelete Uri

Site collection to delete from the recycle bin

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task

DeleteSiteCollection(Uri, VanityUrlOptions)

Deletes a site collection. The deleted site collection is also removed from the recycle bin!

void DeleteSiteCollection(Uri siteToDelete, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToDelete Uri

Site collection to delete

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

DeleteSiteCollectionAsync(Uri, VanityUrlOptions)

Deletes a site collection. The deleted site collection is also removed from the recycle bin!

Task DeleteSiteCollectionAsync(Uri siteToDelete, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToDelete Uri

Site collection to delete

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task

EnableCommunicationSiteFeatures(Uri)

Enables the communication site features on this team site using the Topic design. Requirements:

  • Only works when the site collection was not connected to an Microsoft 365 group
  • Web is root web of the site collection, cannot be applied to sub sites
  • Web template is "STS#0" or "EHS#1" (so TeamSite)
void EnableCommunicationSiteFeatures(Uri site)

Parameters

site Uri

Url of the team site collection to enable communication site features for

EnableCommunicationSiteFeatures(Uri, Guid)

Enables the communication site features on this team site using the Topic design. Requirements:

  • Use 96c933ac-3698-44c7-9f4a-5fd17d71af9e (Topic), 6142d2a0-63a5-4ba0-aede-d9fefca2c767 (Showcase) or f6cc5403-0d63-442e-96c0-285923709ffc (Blank) as design package id
  • Only works when the site collection was not connected to an Microsoft 365 group
  • Web is root web of the site collection, cannot be applied to sub sites
  • Web template is "STS#0" or "EHS#1" (so TeamSite)
void EnableCommunicationSiteFeatures(Uri site, Guid designPackageId)

Parameters

site Uri

Url of the team site collection to enable communication site features for

designPackageId Guid

Design package id to apply

EnableCommunicationSiteFeaturesAsync(Uri)

Enables the communication site features on this team site using the Topic design. Requirements:

  • Only works when the site collection was not connected to an Microsoft 365 group
  • Web is root web of the site collection, cannot be applied to sub sites
  • Web template is "STS#0" or "EHS#1" (so TeamSite)
Task EnableCommunicationSiteFeaturesAsync(Uri site)

Parameters

site Uri

Url of the team site collection to enable communication site features for

Returns

Task

EnableCommunicationSiteFeaturesAsync(Uri, Guid)

Enables the communication site features on this team site using the Topic design. Requirements:

  • Use 96c933ac-3698-44c7-9f4a-5fd17d71af9e (Topic), 6142d2a0-63a5-4ba0-aede-d9fefca2c767 (Showcase) or f6cc5403-0d63-442e-96c0-285923709ffc (Blank) as design package id
  • Only works when the site collection was not connected to an Microsoft 365 group
  • Web is root web of the site collection, cannot be applied to sub sites
  • Web template is "STS#0" or "EHS#1" (so TeamSite)
Task EnableCommunicationSiteFeaturesAsync(Uri site, Guid designPackageId)

Parameters

site Uri

Url of the team site collection to enable communication site features for

designPackageId Guid

Design package id to apply

Returns

Task

GetLegacyServicePrincipals(bool, VanityUrlOptions)

Gets a list of legacy service principals which are required when using the GetTenantAndSiteCollectionACSPrincipals(List<ILegacyServicePrincipal>, bool, VanityUrlOptions) method.

List<ILegacyServicePrincipal> GetLegacyServicePrincipals(bool includeExpiredPrincipals = false, VanityUrlOptions vanityUrlOptions = null)

Parameters

includeExpiredPrincipals bool

Also include the legacy service principals for which the password credential has expired

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

List<ILegacyServicePrincipal>

List of legacy service principals

GetLegacyServicePrincipalsAsync(bool, VanityUrlOptions)

Gets a list of legacy service principals which are required when using the GetTenantAndSiteCollectionACSPrincipalsAsync(List<ILegacyServicePrincipal>, bool, VanityUrlOptions) method.

Task<List<ILegacyServicePrincipal>> GetLegacyServicePrincipalsAsync(bool includeExpiredPrincipals = false, VanityUrlOptions vanityUrlOptions = null)

Parameters

includeExpiredPrincipals bool

Also include the legacy service principals for which the password credential has expired

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<List<ILegacyServicePrincipal>>

List of legacy service principals

GetRecycledSiteCollections(VanityUrlOptions)

Returns a list of the recycled site collections in the current tenant including details about the site. This method queries a hidden list in the SharePoint Tenant Admin site and therefore requires the user or application to have the proper permissions

List<IRecycledSiteCollection> GetRecycledSiteCollections(VanityUrlOptions vanityUrlOptions = null)

Parameters

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

List<IRecycledSiteCollection>

A list of site collections with details

GetRecycledSiteCollectionsAsync(VanityUrlOptions)

Returns a list of the recycled site collections in the current tenant including details about the site. This method queries a hidden list in the SharePoint Tenant Admin site and therefore requires the user or application to have the proper permissions

Task<List<IRecycledSiteCollection>> GetRecycledSiteCollectionsAsync(VanityUrlOptions vanityUrlOptions = null)

Parameters

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<List<IRecycledSiteCollection>>

A list of site collections with details

GetSiteCollectionACSPrincipals(bool, VanityUrlOptions)

Gets a list of Azure ACS principals that are scoped to the current site and optionally it's subsites. A Azure ACS principal granted tenant level permissions will not be included here. If you need that then use the GetTenantAndSiteCollectionACSPrincipals(List<ILegacyServicePrincipal>, bool, VanityUrlOptions) method.

List<IACSPrincipal> GetSiteCollectionACSPrincipals(bool includeSubsites = true, VanityUrlOptions vanityUrlOptions = null)

Parameters

includeSubsites bool

Also load the Azure ACS principals for the subsites. This is relevant when a principal was granted web or list permissions but no site permissions

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

List<IACSPrincipal>

A list of Azure ACS principals

GetSiteCollectionACSPrincipalsAsync(bool, VanityUrlOptions)

Gets a list of Azure ACS principals that are scoped to the current site and optionally it's subsites. A Azure ACS principal granted tenant level permissions will not be included here. If you need that then use the GetTenantAndSiteCollectionACSPrincipalsAsync(List<ILegacyServicePrincipal>, bool, VanityUrlOptions) method.

Task<List<IACSPrincipal>> GetSiteCollectionACSPrincipalsAsync(bool includeSubsites = true, VanityUrlOptions vanityUrlOptions = null)

Parameters

includeSubsites bool

Also load the Azure ACS principals for the subsites. This is relevant when a principal was granted web or list permissions but no site permissions

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<List<IACSPrincipal>>

A list of Azure ACS principals

GetSiteCollectionAdmins(Uri, VanityUrlOptions)

Gets the administrators of the site collection

List<ISiteCollectionAdmin> GetSiteCollectionAdmins(Uri site, VanityUrlOptions vanityUrlOptions = null)

Parameters

site Uri

Url of the site collection to get the administrators for

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

List<ISiteCollectionAdmin>

The list of site collection administrators

GetSiteCollectionAdminsAsync(Uri, VanityUrlOptions)

Gets the administrators of the site collection

Task<List<ISiteCollectionAdmin>> GetSiteCollectionAdminsAsync(Uri site, VanityUrlOptions vanityUrlOptions = null)

Parameters

site Uri

Url of the site collection to get the administrators for

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<List<ISiteCollectionAdmin>>

The list of site collection administrators

GetSiteCollectionProperties(Uri, VanityUrlOptions)

Returns the properties of a site collection

ISiteCollectionProperties GetSiteCollectionProperties(Uri site, VanityUrlOptions vanityUrlOptions = null)

Parameters

site Uri

Site collection to get the properties for

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

ISiteCollectionProperties

The site collection properties

GetSiteCollectionPropertiesAsync(Uri, VanityUrlOptions)

Returns the properties of a site collection

Task<ISiteCollectionProperties> GetSiteCollectionPropertiesAsync(Uri site, VanityUrlOptions vanityUrlOptions = null)

Parameters

site Uri

Site collection to get the properties for

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<ISiteCollectionProperties>

The site collection properties

GetSiteCollectionSharePointAddIns(bool, VanityUrlOptions, bool)

Gets a list of SharePoint AddIns that are scoped to the current site and optionally it's subsites.

List<ISharePointAddIn> GetSiteCollectionSharePointAddIns(bool includeSubsites = true, VanityUrlOptions vanityUrlOptions = null, bool loadLegacyPrincipalData = true)

Parameters

includeSubsites bool

Also load the SharePoint AddIns for the subsites

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

loadLegacyPrincipalData bool

Optionally do not load the related legacy principal with permission data

Returns

List<ISharePointAddIn>

A list of SharePoint AddIns

GetSiteCollectionSharePointAddInsAsync(bool, VanityUrlOptions, bool)

Gets a list of SharePoint AddIns that are scoped to the current site and optionally it's subsites.

Task<List<ISharePointAddIn>> GetSiteCollectionSharePointAddInsAsync(bool includeSubsites = true, VanityUrlOptions vanityUrlOptions = null, bool loadLegacyPrincipalData = true)

Parameters

includeSubsites bool

Also load the SharePoint AddIns for the subsites

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

loadLegacyPrincipalData bool

Optionally do not load the related legacy principal with permission data

Returns

Task<List<ISharePointAddIn>>

A list of SharePoint AddIns

GetSiteCollectionWebsWithDetails(Uri, bool)

Returns a list of all sub sites for the passed in site collection If the current context or passed url are for a sub web then the all sub webs of that sub web are returned

List<IWebWithDetails> GetSiteCollectionWebsWithDetails(Uri url = null, bool skipAppWebs = true)

Parameters

url Uri

Optional URL of the site collection to get the sub sites for. If null the sub sites are retreived for the current site collection

skipAppWebs bool

Skips the SharePoint app webs (APP#0)

Returns

List<IWebWithDetails>

List of webs with details

GetSiteCollectionWebsWithDetailsAsync(Uri, bool)

Returns a list of all sub sites for the passed in site collection If the current context or passed url are for a sub web then the all sub webs of that sub web are returned

Task<List<IWebWithDetails>> GetSiteCollectionWebsWithDetailsAsync(Uri url = null, bool skipAppWebs = true)

Parameters

url Uri

Optional URL of the site collection to get the sub sites for. If null the sub sites are retreived for the current site collection

skipAppWebs bool

Skips the SharePoint app webs (APP#0)

Returns

Task<List<IWebWithDetails>>

List of webs with details

GetSiteCollectionWithDetails(Uri, VanityUrlOptions)

Returns details about the requested site. This method queries a hidden list in the SharePoint Tenant Admin site and therefore requires the user or application to have the proper permissions

ISiteCollectionWithDetails GetSiteCollectionWithDetails(Uri url, VanityUrlOptions vanityUrlOptions = null)

Parameters

url Uri

Uri of the site collection to get details for

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

ISiteCollectionWithDetails

Site collection details, null if the passed site was not found

GetSiteCollectionWithDetailsAsync(Uri, VanityUrlOptions)

Returns details about the requested site. This method queries a hidden list in the SharePoint Tenant Admin site and therefore requires the user or application to have the proper permissions

Task<ISiteCollectionWithDetails> GetSiteCollectionWithDetailsAsync(Uri url, VanityUrlOptions vanityUrlOptions = null)

Parameters

url Uri

Uri of the site collection to get details for

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<ISiteCollectionWithDetails>

Site collection details, null if the passed site was not found

GetSiteCollections(bool, SiteCollectionFilter, VanityUrlOptions)

Returns the list of site collections. When using application permissions or a delegated permissions for a SharePoint admin account all site collections are returned, otherwise only the site collections accessible by the requesting user are returned. Under the covers this method uses different approaches:

  • Application permissions: using the Sites endpoint via Graph
  • Delegated permissions, user is SharePoint Tenant Admin: querying the sites list maintained in the SharePoint Tenant Admin site
  • Delegated permissions, non admin: using the Search endpoint via Graph
List<ISiteCollection> GetSiteCollections(bool ignoreUserIsSharePointAdmin = false, SiteCollectionFilter filter = SiteCollectionFilter.Default, VanityUrlOptions vanityUrlOptions = null)

Parameters

ignoreUserIsSharePointAdmin bool

When set to true and when the user is SharePoint admin then only return the site collections accessible by the user

filter SiteCollectionFilter

Optional filter to scope the returned site collections

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

List<ISiteCollection>

A list of site collections

GetSiteCollectionsAsync(bool, SiteCollectionFilter, VanityUrlOptions)

Returns the list of site collections. When using application permissions or a delegated permissions for a SharePoint admin account all site collections are returned, otherwise only the site collections accessible by the requesting user are returned. Under the covers this method uses different approaches:

  • Application permissions: using the Sites endpoint via Graph
  • Delegated permissions, user is SharePoint Tenant Admin: querying the sites list maintained in the SharePoint Tenant Admin site
  • Delegated permissions, non admin: using the Search endpoint via Graph
Task<List<ISiteCollection>> GetSiteCollectionsAsync(bool ignoreUserIsSharePointAdmin = false, SiteCollectionFilter filter = SiteCollectionFilter.Default, VanityUrlOptions vanityUrlOptions = null)

Parameters

ignoreUserIsSharePointAdmin bool

When set to true and when the user is SharePoint admin then only return the site collections accessible by the user

filter SiteCollectionFilter

Optional filter to scope the returned site collections

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<List<ISiteCollection>>

A list of site collections

GetSiteCollectionsWithDetails(VanityUrlOptions, bool)

Returns a list of the site collections in the current tenant including details about the site. This method queries a hidden list in the SharePoint Tenant Admin site and therefore requires the user or application to have the proper permissions

List<ISiteCollectionWithDetails> GetSiteCollectionsWithDetails(VanityUrlOptions vanityUrlOptions = null, bool includeSharedAndPrivateTeamChannelSites = false)

Parameters

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

includeSharedAndPrivateTeamChannelSites bool

Optionally include the site collections behind shared and private Microsoft Teams channels

Returns

List<ISiteCollectionWithDetails>

A list of site collections with details

GetSiteCollectionsWithDetailsAsync(VanityUrlOptions, bool)

Returns a list of the site collections in the current tenant including details about the site. This method queries a hidden list in the SharePoint Tenant Admin site and therefore requires the user or application to have the proper permissions

Task<List<ISiteCollectionWithDetails>> GetSiteCollectionsWithDetailsAsync(VanityUrlOptions vanityUrlOptions = null, bool includeSharedAndPrivateTeamChannelSites = false)

Parameters

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

includeSharedAndPrivateTeamChannelSites bool

Optionally include the site collections behind shared and private Microsoft Teams channels

Returns

Task<List<ISiteCollectionWithDetails>>

A list of site collections with details

GetTenantACSPrincipals(List<ILegacyServicePrincipal>, VanityUrlOptions)

Gets a list of Azure ACS principals that are scoped tenant wide. For performance reason this method requires the input of a List<T> which can be retrieved using the GetLegacyServicePrincipalsAsync(bool, VanityUrlOptions) method.

List<IACSPrincipal> GetTenantACSPrincipals(List<ILegacyServicePrincipal> legacyServicePrincipals, VanityUrlOptions vanityUrlOptions = null)

Parameters

legacyServicePrincipals List<ILegacyServicePrincipal>

List of legacy service principals to include

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

List<IACSPrincipal>

A list of Azure ACS principals

GetTenantACSPrincipalsAsync(List<ILegacyServicePrincipal>, VanityUrlOptions)

Gets a list of Azure ACS principals that are scoped tenant wide. For performance reason this method requires the input of a List<T> which can be retrieved using the GetLegacyServicePrincipalsAsync(bool, VanityUrlOptions) method.

Task<List<IACSPrincipal>> GetTenantACSPrincipalsAsync(List<ILegacyServicePrincipal> legacyServicePrincipals, VanityUrlOptions vanityUrlOptions = null)

Parameters

legacyServicePrincipals List<ILegacyServicePrincipal>

List of legacy service principals to include

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<List<IACSPrincipal>>

A list of Azure ACS principals

GetTenantAndSiteCollectionACSPrincipals(List<ILegacyServicePrincipal>, bool, VanityUrlOptions)

Gets a list of Azure ACS principals that are scoped to the current site and/or scoped tenant wide. For performance reason this method requires the input of a List<T> which can be retrieved using the GetLegacyServicePrincipals(bool, VanityUrlOptions) method.

List<IACSPrincipal> GetTenantAndSiteCollectionACSPrincipals(List<ILegacyServicePrincipal> legacyServicePrincipals, bool includeSubsites = true, VanityUrlOptions vanityUrlOptions = null)

Parameters

legacyServicePrincipals List<ILegacyServicePrincipal>

List of legacy service principals to include

includeSubsites bool

Also load the Azure ACS principals for the subsites. This is relevant when a principal was granted web or list permissions but no site permissions

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

List<IACSPrincipal>

GetTenantAndSiteCollectionACSPrincipalsAsync(List<ILegacyServicePrincipal>, bool, VanityUrlOptions)

Gets a list of Azure ACS principals that are scoped to the current site and/or scoped tenant wide. For performance reason this method requires the input of a List<T> which can be retrieved using the GetLegacyServicePrincipalsAsync(bool, VanityUrlOptions) method.

Task<List<IACSPrincipal>> GetTenantAndSiteCollectionACSPrincipalsAsync(List<ILegacyServicePrincipal> legacyServicePrincipals, bool includeSubsites = true, VanityUrlOptions vanityUrlOptions = null)

Parameters

legacyServicePrincipals List<ILegacyServicePrincipal>

List of legacy service principals to include

includeSubsites bool

Also load the Azure ACS principals for the subsites. This is relevant when a principal was granted web or list permissions but no site permissions

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task<List<IACSPrincipal>>

A list of Azure ACS principals

HideAddTeamsPrompt(Uri)

Hides the Add Microsoft Teams banner. Only works when the site collection was already connected to an Microsoft 365 group

bool HideAddTeamsPrompt(Uri site)

Parameters

site Uri

Url of the site collection to hide the Add Teams prompt for

Returns

bool

True if hidden

HideAddTeamsPromptAsync(Uri)

Hides the Add Microsoft Teams banner. Only works when the site collection was already connected to an Microsoft 365 group

Task<bool> HideAddTeamsPromptAsync(Uri site)

Parameters

site Uri

Url of the site collection to hide the Add Teams prompt for

Returns

Task<bool>

True if hidden

IsAddTeamsPromptHidden(Uri)

Checks if the Add Microsoft Teams banner is hidden. Only works when the site collection was already connected to an Microsoft 365 group.

bool IsAddTeamsPromptHidden(Uri site)

Parameters

site Uri

Url of the site collection to check the Add Teams prompt status for

Returns

bool

True if hidden, false otherwise.

IsAddTeamsPromptHiddenAsync(Uri)

Checks if the Add Microsoft Teams banner is hidden. Only works when the site collection was already connected to an Microsoft 365 group

Task<bool> IsAddTeamsPromptHiddenAsync(Uri site)

Parameters

site Uri

Url of the site collection to check the Add Teams prompt status for

Returns

Task<bool>

True if hidden, false otherwise.

RecycleSiteCollection(Uri, VanityUrlOptions)

Recycle a site collection. The site collection ends up in the recycle bin and can be restored. When the site collection has a connected group then also that group is automatically recycled

void RecycleSiteCollection(Uri siteToDelete, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToDelete Uri

Site collection to recycle

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

RecycleSiteCollectionAsync(Uri, VanityUrlOptions)

Recycle a site collection. The site collection ends up in the recycle bin and can be restored. When the site collection has a connected group then also that group is automatically recycled

Task RecycleSiteCollectionAsync(Uri siteToDelete, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToDelete Uri

Site collection to recycle

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task

RestoreSiteCollection(Uri, VanityUrlOptions)

Restores a site collection from the recycle bin. When the site collection has a connected group then also that group is automatically restored

void RestoreSiteCollection(Uri siteToRestore, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToRestore Uri

Site collection to restore

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

RestoreSiteCollectionAsync(Uri, VanityUrlOptions)

Restores a site collection from the recycle bin. When the site collection has a connected group then also that group is automatically restored

Task RestoreSiteCollectionAsync(Uri siteToRestore, VanityUrlOptions vanityUrlOptions = null)

Parameters

siteToRestore Uri

Site collection to restore

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task

SetSiteCollectionAdmins(Uri, List<string>, List<Guid>, CollectionUpdateOptions, VanityUrlOptions)

Sets the administrators of the site collection by providing the list of login names. The first in the list will be the primary admin, the others will be secondary admins. When the site collection is group connected you can also opt to set group owners as they are also SharePoint site collection administrators. To stay in sync with with SharePoint Tenant admin center does, when adding a group owner the user is also added as group member. Note that this method does not remove existing admins, it only adds the provided admins.

void SetSiteCollectionAdmins(Uri site, List<string> sharePointAdminLoginNames = null, List<Guid> ownerGroupAzureAdUserIds = null, CollectionUpdateOptions collectionUpdateOptions = CollectionUpdateOptions.AddOnly, VanityUrlOptions vanityUrlOptions = null)

Parameters

site Uri

Url of the site collection to set the administrators for

sharePointAdminLoginNames List<string>

List of SharePoint Admins login names (e.g. i:0#.f|membership|anna@contoso.onmicrosoft.com) to set as admin

ownerGroupAzureAdUserIds List<Guid>

List of Azure AD user ids to set as admin via adding them to the connected Microsoft 365 group owners

collectionUpdateOptions CollectionUpdateOptions

Add new admins to the list of admins with 'AddOnly' (default), or set exactly the submitted list using 'SetExact'

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

SetSiteCollectionAdminsAsync(Uri, List<string>, List<Guid>, CollectionUpdateOptions, VanityUrlOptions)

Sets the administrators of the site collection by providing the list of login names. The first in the list will be the primary admin, the others will be secondary admins. When the site collection is group connected you can also opt to set group owners as they are also SharePoint site collection administrators. To stay in sync with with SharePoint Tenant admin center does, when adding a group owner the user is also added as group member. Note that this method does not remove existing admins, it only adds the provided admins.

Task SetSiteCollectionAdminsAsync(Uri site, List<string> sharePointAdminLoginNames = null, List<Guid> ownerGroupAzureAdUserIds = null, CollectionUpdateOptions collectionUpdateOptions = CollectionUpdateOptions.AddOnly, VanityUrlOptions vanityUrlOptions = null)

Parameters

site Uri

Url of the site collection to set the administrators for

sharePointAdminLoginNames List<string>

List of SharePoint Admins login names (e.g. i:0#.f|membership|anna@contoso.onmicrosoft.com) to set as admin

ownerGroupAzureAdUserIds List<Guid>

List of Azure AD user ids to set as admin via adding them to the connected Microsoft 365 group owners

collectionUpdateOptions CollectionUpdateOptions

Add new admins to the list of admins with 'AddOnly' (default), or set exactly the submitted list using 'SetExact'

vanityUrlOptions VanityUrlOptions

Optionally specify the custom vanity URI's used by this tenant

Returns

Task

SiteExists(Uri)

Check if site exists

bool SiteExists(Uri url)

Parameters

url Uri

Site url

Returns

bool

True if the site exists, false otherwise

SiteExistsAsync(Uri)

Check if site exists

Task<bool> SiteExistsAsync(Uri url)

Parameters

url Uri

Site url

Returns

Task<bool>

True if the site exists, false otherwise