C# Класс Microsoft.SharePoint.Client.TenantExtensions

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddAdministrators ( this tenant, IEnumerable adminLogins, Uri siteUrl, bool addToOwnersGroup = false ) : void

Add a site collection administrator to a site collection

CheckIfSiteExists ( this tenant, string siteFullUrl, string status ) : bool

Returns if a site collection is in a particular status. If the url contains a sub site then returns true is the sub site exists, false if not. Status is irrelevant for sub sites

CreateSiteCollection ( this tenant, OfficeDevPnP.Core.Entities.SiteEntity properties, bool removeFromRecycleBin = false, bool wait = true ) : System.Guid

Adds a SiteEntity by launching site collection creation and waits for the creation to finish

CreateSiteCollection ( this tenant, string siteFullUrl, string title, string siteOwnerLogin, string template, int storageMaximumLevel, int storageWarningLevel, int timeZoneId, int userCodeMaximumLevel, int userCodeWarningLevel, uint lcid, bool removeFromRecycleBin = false, bool wait = true ) : System.Guid

Launches a site collection creation and waits for the creation to finish

CreateSiteCollection ( this tenant, OfficeDevPnP.Core.Entities.SiteEntity properties ) : void

Adds a SiteEntity by launching site collection creation and waits for the creation to finish

DeleteSiteCollection ( this tenant, string siteFullUrl, bool useRecycleBin ) : bool

Deletes a site collection

DeleteSiteCollection ( this tenant, string siteFullUrl ) : void

Deletes a site collection

DeleteSiteCollectionFromRecycleBin ( this tenant, string siteFullUrl, bool wait = true ) : bool

Deletes a site collection from the site collection recycle bin

GetOneDriveSiteCollections ( this tenant ) : IList

Get OneDrive site collections by iterating through all user profiles.

GetSiteCollections ( this tenant, int startIndex, int endIndex = 500000, bool includeDetail = true, bool includeOD4BSites = false ) : IList

Returns all site collections in the current Tenant based on a startIndex. IncludeDetail adds additional properties to the SPSite object.

GetSiteGuidByUrl ( this tenant, Uri siteFullUrl ) : System.Guid

Gets the ID of site collection with specified URL

GetSiteGuidByUrl ( this tenant, string siteFullUrl ) : System.Guid

Gets the ID of site collection with specified URL

GetUserProfileServiceClient ( this tenant ) : UserProfileService

Gets the UserProfileService proxy to enable calls to the UPA web service.

GetWebTemplates ( this tenant, uint lcid, int compatibilityLevel ) : SPOTenantWebTemplateCollection

Returns available webtemplates/site definitions

IsSiteActive ( this tenant, string siteFullUrl ) : bool

Checks if a site collection is Active

SetSiteLockState ( this tenant, string siteFullUrl, SiteLockState lockState, bool wait = false ) : void

Sets a site to Unlock access or NoAccess. This operation may occur immediately, but the site lock may take a short while before it goes into effect.

SetSiteProperties ( this tenant, string siteFullUrl, string title = null, bool allowSelfServiceUpgrade = null, SharingCapabilities sharingCapability = null, long storageMaximumLevel = null, long storageWarningLevel = null, double userCodeMaximumLevel = null, double userCodeWarningLevel = null, bool noScriptSite = null ) : void

Sets tenant site Properties

SiteExists ( this tenant, string siteFullUrl ) : bool

Checks if a site collection exists, relies on tenant admin API. Sites that are recycled also return as existing sites

SubSiteExists ( this tenant, string siteFullUrl ) : bool

Checks if a sub site exists

Приватные методы

Метод Описание
IsCannotGetSiteException ( Exception ex ) : bool
IsCannotRemoveSiteException ( Exception ex ) : bool
IsUnableToAccessSiteException ( Exception ex ) : bool
WaitForIsComplete ( Tenant tenant, SpoOperation op ) : void

Описание методов

AddAdministrators() публичный статический Метод

Add a site collection administrator to a site collection
public static AddAdministrators ( this tenant, IEnumerable adminLogins, Uri siteUrl, bool addToOwnersGroup = false ) : void
tenant this A tenant object pointing to the context of a Tenant Administration site
adminLogins IEnumerable Array of admins loginnames to add
siteUrl System.Uri Url of the site to operate on
addToOwnersGroup bool Optionally the added admins can also be added to the Site owners group
Результат void

CheckIfSiteExists() публичный статический Метод

Returns if a site collection is in a particular status. If the url contains a sub site then returns true is the sub site exists, false if not. Status is irrelevant for sub sites
public static CheckIfSiteExists ( this tenant, string siteFullUrl, string status ) : bool
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string Url to the site collection
status string Status to check (Active, Creating, Recycled)
Результат bool

CreateSiteCollection() публичный статический Метод

Adds a SiteEntity by launching site collection creation and waits for the creation to finish
public static CreateSiteCollection ( this tenant, OfficeDevPnP.Core.Entities.SiteEntity properties, bool removeFromRecycleBin = false, bool wait = true ) : System.Guid
tenant this A tenant object pointing to the context of a Tenant Administration site
properties OfficeDevPnP.Core.Entities.SiteEntity Describes the site collection to be created
removeFromRecycleBin bool It true and site is present in recycle bin, it will be removed first from the recycle bin
wait bool If true, processing will halt until the site collection has been created
Результат System.Guid

CreateSiteCollection() публичный статический Метод

Launches a site collection creation and waits for the creation to finish
public static CreateSiteCollection ( this tenant, string siteFullUrl, string title, string siteOwnerLogin, string template, int storageMaximumLevel, int storageWarningLevel, int timeZoneId, int userCodeMaximumLevel, int userCodeWarningLevel, uint lcid, bool removeFromRecycleBin = false, bool wait = true ) : System.Guid
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string The SPO url
title string The site title
siteOwnerLogin string Owner account
template string Site template being used
storageMaximumLevel int Site quota in MB
storageWarningLevel int Site quota warning level in MB
timeZoneId int TimeZoneID for the site. "(UTC+01:00) Brussels, Copenhagen, Madrid, Paris" = 3
userCodeMaximumLevel int The user code quota in points
userCodeWarningLevel int The user code quota warning level in points
lcid uint The site locale. See http://technet.microsoft.com/en-us/library/ff463597.aspx for a complete list of Lcid's
removeFromRecycleBin bool If true, any existing site with the same URL will be removed from the recycle bin
wait bool Wait for the site to be created before continuing processing
Результат System.Guid

CreateSiteCollection() публичный статический Метод

Adds a SiteEntity by launching site collection creation and waits for the creation to finish
public static CreateSiteCollection ( this tenant, OfficeDevPnP.Core.Entities.SiteEntity properties ) : void
tenant this A tenant object pointing to the context of a Tenant Administration site
properties OfficeDevPnP.Core.Entities.SiteEntity Describes the site collection to be created
Результат void

DeleteSiteCollection() публичный статический Метод

Deletes a site collection
public static DeleteSiteCollection ( this tenant, string siteFullUrl, bool useRecycleBin ) : bool
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string Url of the site collection to delete
useRecycleBin bool Leave the deleted site collection in the site collection recycle bin
Результат bool

DeleteSiteCollection() публичный статический Метод

Deletes a site collection
public static DeleteSiteCollection ( this tenant, string siteFullUrl ) : void
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string Url of the site collection to delete
Результат void

DeleteSiteCollectionFromRecycleBin() публичный статический Метод

Deletes a site collection from the site collection recycle bin
public static DeleteSiteCollectionFromRecycleBin ( this tenant, string siteFullUrl, bool wait = true ) : bool
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string URL of the site collection to delete
wait bool If true, processing will halt until the site collection has been deleted from the recycle bin
Результат bool

GetOneDriveSiteCollections() публичный статический Метод

Get OneDrive site collections by iterating through all user profiles.
public static GetOneDriveSiteCollections ( this tenant ) : IList
tenant this
Результат IList

GetSiteCollections() публичный статический Метод

Returns all site collections in the current Tenant based on a startIndex. IncludeDetail adds additional properties to the SPSite object.
public static GetSiteCollections ( this tenant, int startIndex, int endIndex = 500000, bool includeDetail = true, bool includeOD4BSites = false ) : IList
tenant this Tenant object to operate against
startIndex int Not relevant anymore
endIndex int Not relevant anymore
includeDetail bool Option to return a limited set of data
includeOD4BSites bool
Результат IList

GetSiteGuidByUrl() публичный статический Метод

Gets the ID of site collection with specified URL
public static GetSiteGuidByUrl ( this tenant, Uri siteFullUrl ) : System.Guid
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl System.Uri A URL that specifies a site collection to get ID.
Результат System.Guid

GetSiteGuidByUrl() публичный статический Метод

Gets the ID of site collection with specified URL
public static GetSiteGuidByUrl ( this tenant, string siteFullUrl ) : System.Guid
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string A URL that specifies a site collection to get ID.
Результат System.Guid

GetUserProfileServiceClient() публичный статический Метод

Gets the UserProfileService proxy to enable calls to the UPA web service.
public static GetUserProfileServiceClient ( this tenant ) : UserProfileService
tenant this
Результат UserProfileService

GetWebTemplates() публичный статический Метод

Returns available webtemplates/site definitions
public static GetWebTemplates ( this tenant, uint lcid, int compatibilityLevel ) : SPOTenantWebTemplateCollection
tenant this A tenant object pointing to the context of a Tenant Administration site
lcid uint
compatibilityLevel int 14 for SharePoint 2010, 15 for SharePoint 2013/SharePoint Online
Результат SPOTenantWebTemplateCollection

IsSiteActive() публичный статический Метод

Checks if a site collection is Active
public static IsSiteActive ( this tenant, string siteFullUrl ) : bool
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string URL to the site collection
Результат bool

SetSiteLockState() публичный статический Метод

Sets a site to Unlock access or NoAccess. This operation may occur immediately, but the site lock may take a short while before it goes into effect.
public static SetSiteLockState ( this tenant, string siteFullUrl, SiteLockState lockState, bool wait = false ) : void
tenant this A tenant object pointing to the context of a Tenant Administration site (i.e. https://[tenant]-admin.sharepoint.com)
siteFullUrl string The target site to change the lock state.
lockState SiteLockState The target state the site should be changed to.
wait bool If true, processing will halt until the site collection lock state has been implemented
Результат void

SetSiteProperties() публичный статический Метод

Sets tenant site Properties
public static SetSiteProperties ( this tenant, string siteFullUrl, string title = null, bool allowSelfServiceUpgrade = null, SharingCapabilities sharingCapability = null, long storageMaximumLevel = null, long storageWarningLevel = null, double userCodeMaximumLevel = null, double userCodeWarningLevel = null, bool noScriptSite = null ) : void
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string
title string
allowSelfServiceUpgrade bool
sharingCapability SharingCapabilities
storageMaximumLevel long
storageWarningLevel long
userCodeMaximumLevel double
userCodeWarningLevel double
noScriptSite bool
Результат void

SiteExists() публичный статический Метод

Checks if a site collection exists, relies on tenant admin API. Sites that are recycled also return as existing sites
public static SiteExists ( this tenant, string siteFullUrl ) : bool
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string URL to the site collection
Результат bool

SubSiteExists() публичный статический Метод

Checks if a sub site exists
public static SubSiteExists ( this tenant, string siteFullUrl ) : bool
tenant this A tenant object pointing to the context of a Tenant Administration site
siteFullUrl string URL to the sub site
Результат bool