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
siteGroupConnectOptionsConnectSiteToGroupOptionsInformation needed to handle the connection of the site collection to a new Microsoft 365 group.
creationOptionsCreationOptionsOptions 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
siteGroupConnectOptionsConnectSiteToGroupOptionsInformation needed to handle the connection of the site collection to a new Microsoft 365 group.
creationOptionsCreationOptionsOptions to control the connect to site process
Returns
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
siteToCreateCommonSiteOptionsInformation about the site collection to create. Pass in a CommunicationSiteOptions, TeamSiteOptions, TeamSiteWithoutGroupOptions or ClassicSiteOptions instance.
creationOptionsSiteCreationOptionsOptions that control the site creation process
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteToCreateCommonSiteOptionsInformation about the site collection to create. Pass in a CommunicationSiteOptions, TeamSiteOptions, TeamSiteWithoutGroupOptions or ClassicSiteOptions instance.
creationOptionsSiteCreationOptionsOptions that control the site creation process
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteToDeleteUriSite collection to delete from the recycle bin
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteToDeleteUriSite collection to delete from the recycle bin
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
Returns
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
siteToDeleteUriSite collection to delete
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteToDeleteUriSite collection to delete
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
Returns
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
siteUriUrl 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
siteUriUrl of the team site collection to enable communication site features for
designPackageIdGuidDesign 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
siteUriUrl of the team site collection to enable communication site features for
Returns
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
siteUriUrl of the team site collection to enable communication site features for
designPackageIdGuidDesign package id to apply
Returns
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
includeExpiredPrincipalsboolAlso include the legacy service principals for which the password credential has expired
vanityUrlOptionsVanityUrlOptionsOptionally 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
includeExpiredPrincipalsboolAlso include the legacy service principals for which the password credential has expired
vanityUrlOptionsVanityUrlOptionsOptionally 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
vanityUrlOptionsVanityUrlOptionsOptionally 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
vanityUrlOptionsVanityUrlOptionsOptionally 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
includeSubsitesboolAlso load the Azure ACS principals for the subsites. This is relevant when a principal was granted web or list permissions but no site permissions
vanityUrlOptionsVanityUrlOptionsOptionally 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
includeSubsitesboolAlso load the Azure ACS principals for the subsites. This is relevant when a principal was granted web or list permissions but no site permissions
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteUriUrl of the site collection to get the administrators for
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteUriUrl of the site collection to get the administrators for
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteUriSite collection to get the properties for
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteUriSite collection to get the properties for
vanityUrlOptionsVanityUrlOptionsOptionally 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
includeSubsitesboolAlso load the SharePoint AddIns for the subsites
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
loadLegacyPrincipalDataboolOptionally 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
includeSubsitesboolAlso load the SharePoint AddIns for the subsites
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
loadLegacyPrincipalDataboolOptionally 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
urlUriOptional URL of the site collection to get the sub sites for. If null the sub sites are retreived for the current site collection
skipAppWebsboolSkips 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
urlUriOptional URL of the site collection to get the sub sites for. If null the sub sites are retreived for the current site collection
skipAppWebsboolSkips 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
urlUriUri of the site collection to get details for
vanityUrlOptionsVanityUrlOptionsOptionally 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
urlUriUri of the site collection to get details for
vanityUrlOptionsVanityUrlOptionsOptionally 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
ignoreUserIsSharePointAdminboolWhen set to true and when the user is SharePoint admin then only return the site collections accessible by the user
filterSiteCollectionFilterOptional filter to scope the returned site collections
vanityUrlOptionsVanityUrlOptionsOptionally 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
ignoreUserIsSharePointAdminboolWhen set to true and when the user is SharePoint admin then only return the site collections accessible by the user
filterSiteCollectionFilterOptional filter to scope the returned site collections
vanityUrlOptionsVanityUrlOptionsOptionally 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
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
includeSharedAndPrivateTeamChannelSitesboolOptionally 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
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
includeSharedAndPrivateTeamChannelSitesboolOptionally 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
legacyServicePrincipalsList<ILegacyServicePrincipal>List of legacy service principals to include
vanityUrlOptionsVanityUrlOptionsOptionally 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
legacyServicePrincipalsList<ILegacyServicePrincipal>List of legacy service principals to include
vanityUrlOptionsVanityUrlOptionsOptionally 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
legacyServicePrincipalsList<ILegacyServicePrincipal>List of legacy service principals to include
includeSubsitesboolAlso load the Azure ACS principals for the subsites. This is relevant when a principal was granted web or list permissions but no site permissions
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
Returns
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
legacyServicePrincipalsList<ILegacyServicePrincipal>List of legacy service principals to include
includeSubsitesboolAlso load the Azure ACS principals for the subsites. This is relevant when a principal was granted web or list permissions but no site permissions
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteUriUrl 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
siteUriUrl of the site collection to hide the Add Teams prompt for
Returns
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
siteUriUrl 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
siteUriUrl of the site collection to check the Add Teams prompt status for
Returns
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
siteToDeleteUriSite collection to recycle
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteToDeleteUriSite collection to recycle
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
Returns
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
siteToRestoreUriSite collection to restore
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteToRestoreUriSite collection to restore
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
Returns
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
siteUriUrl of the site collection to set the administrators for
sharePointAdminLoginNamesList<string>List of SharePoint Admins login names (e.g. i:0#.f|membership|anna@contoso.onmicrosoft.com) to set as admin
ownerGroupAzureAdUserIdsList<Guid>List of Azure AD user ids to set as admin via adding them to the connected Microsoft 365 group owners
collectionUpdateOptionsCollectionUpdateOptionsAdd new admins to the list of admins with 'AddOnly' (default), or set exactly the submitted list using 'SetExact'
vanityUrlOptionsVanityUrlOptionsOptionally 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
siteUriUrl of the site collection to set the administrators for
sharePointAdminLoginNamesList<string>List of SharePoint Admins login names (e.g. i:0#.f|membership|anna@contoso.onmicrosoft.com) to set as admin
ownerGroupAzureAdUserIdsList<Guid>List of Azure AD user ids to set as admin via adding them to the connected Microsoft 365 group owners
collectionUpdateOptionsCollectionUpdateOptionsAdd new admins to the list of admins with 'AddOnly' (default), or set exactly the submitted list using 'SetExact'
vanityUrlOptionsVanityUrlOptionsOptionally specify the custom vanity URI's used by this tenant
Returns
SiteExists(Uri)
Check if site exists
bool SiteExists(Uri url)
Parameters
urlUriSite url
Returns
- bool
True if the site exists, false otherwise
SiteExistsAsync(Uri)
Check if site exists
Task<bool> SiteExistsAsync(Uri url)
Parameters
urlUriSite url