Search Results for

    Show / Hide Table of Contents

    Class SiteCollection

    This class can be used to create modern site collections

    Inheritance
    System.Object
    SiteCollection
    Namespace: PnP.Framework.Sites
    Assembly: PnP.Framework.dll
    Syntax
    public static class SiteCollection : object

    Methods

    AliasExistsAsync(ClientContext, String)

    Checks if a given alias is already in use or not

    Declaration
    public static async Task<bool> AliasExistsAsync(ClientContext context, string alias)
    Parameters
    ClientContext context

    Context to operate against

    System.String alias

    Alias to check

    Returns
    Task<System.Boolean>

    True if in use, false otherwise

    Create(ClientContext, CommunicationSiteCollectionCreationInformation, Int32, Boolean)

    Creates a new Communication Site Collection and waits for it to be created

    Declaration
    public static ClientContext Create(ClientContext clientContext, CommunicationSiteCollectionCreationInformation siteCollectionCreationInformation, int delayAfterCreation = 0, bool noWait = false)
    Parameters
    ClientContext clientContext

    ClientContext object of a regular site

    CommunicationSiteCollectionCreationInformation siteCollectionCreationInformation

    information about the site to create

    System.Int32 delayAfterCreation

    Defines the number of seconds to wait after creation

    System.Boolean noWait

    If specified the site will be created and the process will be finished asynchronously

    Returns
    ClientContext

    ClientContext object for the created site collection

    Create(ClientContext, TeamNoGroupSiteCollectionCreationInformation, Int32, Boolean)

    Creates a new Team Site Collection with no group and waits for it to be created

    Declaration
    public static ClientContext Create(ClientContext clientContext, TeamNoGroupSiteCollectionCreationInformation siteCollectionCreationInformation, int delayAfterCreation = 0, bool noWait = false)
    Parameters
    ClientContext clientContext

    ClientContext object of a regular site

    TeamNoGroupSiteCollectionCreationInformation siteCollectionCreationInformation

    information about the site to create

    System.Int32 delayAfterCreation

    Defines the number of seconds to wait after creation

    System.Boolean noWait

    If specified the site will be created and the process will be finished asynchronously

    Returns
    ClientContext

    ClientContext object for the created site collection

    Create(ClientContext, TeamSiteCollectionCreationInformation, Int32, Boolean, String, AzureEnvironment)

    Creates a new Team Site Collection and waits for it to be created

    Declaration
    public static ClientContext Create(ClientContext clientContext, TeamSiteCollectionCreationInformation siteCollectionCreationInformation, int delayAfterCreation = 0, bool noWait = false, string graphAccessToken = null, AzureEnvironment azureEnvironment = default(AzureEnvironment))
    Parameters
    ClientContext clientContext

    ClientContext object of a regular site

    TeamSiteCollectionCreationInformation siteCollectionCreationInformation

    information about the site to create

    System.Int32 delayAfterCreation

    Defines the number of seconds to wait after creation

    System.Boolean noWait

    If specified the site will be created and the process will be finished asynchronously

    System.String graphAccessToken

    An optional Access Token for Microsoft Graph to use for creeating the site within an App-Only context

    AzureEnvironment azureEnvironment

    Defines the Azure Cloud Deployment. This is used to determine the MS Graph EndPoint to call which differs per Azure Cloud deployments. Defaults to Production (graph.microsoft.com).

    Returns
    ClientContext

    ClientContext object for the created site collection

    CreateAsync(ClientContext, CommunicationSiteCollectionCreationInformation, Int32, Boolean)

    Creates a new Communication Site Collection

    Declaration
    public static async Task<ClientContext> CreateAsync(ClientContext clientContext, CommunicationSiteCollectionCreationInformation siteCollectionCreationInformation, int delayAfterCreation = 0, bool noWait = false)
    Parameters
    ClientContext clientContext

    ClientContext object of a regular site

    CommunicationSiteCollectionCreationInformation siteCollectionCreationInformation

    information about the site to create

    System.Int32 delayAfterCreation

    Defines the number of seconds to wait after creation

    System.Boolean noWait

    If specified the site will be created and the process will be finished asynchronously

    Returns
    Task<ClientContext>

    ClientContext object for the created site collection

    CreateAsync(ClientContext, TeamNoGroupSiteCollectionCreationInformation, Int32, Boolean)

    Creates a new Team Site Collection with no group

    Declaration
    public static async Task<ClientContext> CreateAsync(ClientContext clientContext, TeamNoGroupSiteCollectionCreationInformation siteCollectionCreationInformation, int delayAfterCreation = 0, bool noWait = false)
    Parameters
    ClientContext clientContext

    ClientContext object of a regular site

    TeamNoGroupSiteCollectionCreationInformation siteCollectionCreationInformation

    information about the site to create

    System.Int32 delayAfterCreation

    Defines the number of seconds to wait after creation

    System.Boolean noWait

    If specified the site will be created and the process will be finished asynchronously

    Returns
    Task<ClientContext>

    ClientContext object for the created site collection

    CreateAsync(ClientContext, TeamSiteCollectionCreationInformation, Int32, Int32, Int32, Boolean, String, AzureEnvironment)

    Creates a new Modern Team Site Collection (so with an Office 365 group connected)

    Declaration
    public static async Task<ClientContext> CreateAsync(ClientContext clientContext, TeamSiteCollectionCreationInformation siteCollectionCreationInformation, int delayAfterCreation = 0, int maxRetryCount = 12, int retryDelay = null, bool noWait = false, string graphAccessToken = null, AzureEnvironment azureEnvironment = default(AzureEnvironment))
    Parameters
    ClientContext clientContext

    ClientContext object of a regular site

    TeamSiteCollectionCreationInformation siteCollectionCreationInformation

    information about the site to create

    System.Int32 delayAfterCreation

    Defines the number of seconds to wait after creation

    System.Int32 maxRetryCount

    Maximum number of retries for a pending site provisioning. Default 12 retries.

    System.Int32 retryDelay

    Delay between retries for a pending site provisioning. Default 10 seconds.

    System.Boolean noWait

    If specified the site will be created and the process will be finished asynchronously

    System.String graphAccessToken

    An optional Access Token for Microsoft Graph to use for creeating the site within an App-Only context

    AzureEnvironment azureEnvironment

    Defines the Azure Cloud Deployment. This is used to determine the MS Graph EndPoint to call which differs per Azure Cloud deployments. Defaults to Production (graph.microsoft.com).

    Returns
    Task<ClientContext>

    ClientContext object for the created site collection

    CreateTeamSiteViaGraphAsync(ClientContext, TeamSiteCollectionCreationInformation, Int32, Int32, Int32, Boolean, String, AzureEnvironment)

    Creates a new Modern Team Site Collection (so with an Office 365 group connected) using Microsoft Graph

    Declaration
    public static async Task<ClientContext> CreateTeamSiteViaGraphAsync(ClientContext clientContext, TeamSiteCollectionCreationInformation siteCollectionCreationInformation, int delayAfterCreation = 0, int maxRetryCount = 12, int retryDelay = null, bool noWait = false, string graphAccessToken = null, AzureEnvironment azureEnvironment = default(AzureEnvironment))
    Parameters
    ClientContext clientContext

    ClientContext object of a regular site

    TeamSiteCollectionCreationInformation siteCollectionCreationInformation

    information about the site to create

    System.Int32 delayAfterCreation

    Defines the number of seconds to wait after creation

    System.Int32 maxRetryCount

    Maximum number of retries for a pending site provisioning. Default 12 retries.

    System.Int32 retryDelay

    Delay between retries for a pending site provisioning. Default 10 seconds.

    System.Boolean noWait

    If specified the site will be created and the process will be finished asynchronously

    System.String graphAccessToken

    An optional Access Token for Microsoft Graph to use for creeating the site within an App-Only context

    AzureEnvironment azureEnvironment

    Defines the Azure Cloud Deployment. This is used to determine the MS Graph EndPoint to call which differs per Azure Cloud deployments. Defaults to Production (graph.microsoft.com).

    Returns
    Task<ClientContext>

    ClientContext object for the created site collection

    DeleteSiteAsync(ClientContext)

    Deletes a Communication site or a Group-less Modern team site.

    Declaration
    public static async Task<bool> DeleteSiteAsync(ClientContext context)
    Parameters
    ClientContext context

    Context to operate against

    Returns
    Task<System.Boolean>

    EnableCommunicationSite(ClientContext)

    Turns a team site into a communication site

    Declaration
    public static async Task EnableCommunicationSite(ClientContext context)
    Parameters
    ClientContext context

    ClientContext of the team site to update to a communication site

    Returns
    Task

    EnableCommunicationSite(ClientContext, Guid)

    Turns a team site into a communication site

    Declaration
    public static async Task EnableCommunicationSite(ClientContext context, Guid designPackageId)
    Parameters
    ClientContext context

    ClientContext of the team site to update to a communication site

    Guid designPackageId

    Design package id to be applied, 96c933ac-3698-44c7-9f4a-5fd17d71af9e (Topic = default), 6142d2a0-63a5-4ba0-aede-d9fefca2c767 (Showcase) or f6cc5403-0d63-442e-96c0-285923709ffc (Blank)

    Returns
    Task

    GetGroupInfo(ClientContext, String)

    Checks if a given alias is already in use or not

    Declaration
    public static async Task<Dictionary<string, string>> GetGroupInfo(ClientContext context, string alias)
    Parameters
    ClientContext context

    Context to operate against

    System.String alias

    Alias to check

    Returns
    Task<Dictionary<System.String, System.String>>

    True if in use, false otherwise

    GetGroupInfoAsync(ClientContext, String)

    Checks if a given alias is already in use or not

    Declaration
    public static async Task<Dictionary<string, string>> GetGroupInfoAsync(ClientContext context, string alias)
    Parameters
    ClientContext context

    Context to operate against

    System.String alias

    Alias to check

    Returns
    Task<Dictionary<System.String, System.String>>

    True if in use, false otherwise

    GetGroupInfoByGroupIdAsync(ClientContext, String)

    Gets group alias information by group Id

    Declaration
    public static async Task<Dictionary<string, object>> GetGroupInfoByGroupIdAsync(ClientContext context, string groupId)
    Parameters
    ClientContext context

    Context to operate against

    System.String groupId

    Id of the group

    Returns
    Task<Dictionary<System.String, System.Object>>

    True if in use, false otherwise

    GetIsAliasAvailableAsync(ClientContext, String)

    Allows validation if the provided alias is valid to be used to create a new site collection

    Declaration
    public static async Task<bool> GetIsAliasAvailableAsync(ClientContext context, string alias)
    Parameters
    ClientContext context

    SharePoint ClientContext to use to communicate with SharePoint

    System.String alias

    The alias to check for availability

    Returns
    Task<System.Boolean>

    True if the provided alias is available to be used, false if it is not

    GetValidSiteUrlFromAliasAsync(ClientContext, String)

    Checks if the provided alias is valid to be used to create a new site collection and will return an alternative available proposal if it is not. Use GetIsAliasAvailableAsync(ClientContext, String) instead if you are just interested in knowing whether or not a certain alias is still available to be used.

    Declaration
    public static async Task<string> GetValidSiteUrlFromAliasAsync(ClientContext context, string alias)
    Parameters
    ClientContext context

    SharePoint ClientContext to use to communicate with SharePoint

    System.String alias

    The alias to check for availability

    Returns
    Task<System.String>

    The full SharePoint URL proposed to be used. If that URL ends with the alias you provided, it means it is still available. If its not available, it will return an alternative proposal to use.

    GroupifyAsync(ClientContext, TeamSiteCollectionGroupifyInformation)

    Groupifies a classic team site by creating a group for it and connecting the site with the newly created group

    Declaration
    public static async Task<ClientContext> GroupifyAsync(ClientContext clientContext, TeamSiteCollectionGroupifyInformation siteCollectionGroupifyInformation)
    Parameters
    ClientContext clientContext

    ClientContext object of a regular site

    TeamSiteCollectionGroupifyInformation siteCollectionGroupifyInformation

    information about the site to create

    Returns
    Task<ClientContext>

    ClientContext object for the created site collection

    HideTeamifyPromptAsync(ClientContext)

    Hide the teamify prompt/banner displayed in O365 group connected sites

    Declaration
    public static async Task<bool> HideTeamifyPromptAsync(ClientContext context)
    Parameters
    ClientContext context

    ClientContext of the site to operate against

    Returns
    Task<System.Boolean>

    IsTeamifyPromptHiddenAsync(ClientContext)

    Checks if the Teamify prompt/banner is displayed in the O365 group connected sites.

    Declaration
    public static async Task<bool> IsTeamifyPromptHiddenAsync(ClientContext context)
    Parameters
    ClientContext context

    ClientContext of the site to operate against

    Returns
    Task<System.Boolean>

    SetGroupImage(ClientContext, Byte[], String)

    Declaration
    public static async Task<bool> SetGroupImage(ClientContext context, byte[] file, string mimeType)
    Parameters
    ClientContext context

    System.Byte[] file

    System.String mimeType

    Returns
    Task<System.Boolean>

    SetGroupImageAsync(ClientContext, Byte[], String)

    Sets the image for an Office 365 group

    Declaration
    public static async Task<bool> SetGroupImageAsync(ClientContext context, byte[] file, string mimeType)
    Parameters
    ClientContext context

    Context to operate on

    System.Byte[] file

    Byte array containing the group image

    System.String mimeType

    Image mime type

    Returns
    Task<System.Boolean>

    true if succeeded

    TeamifySiteAsync(ClientContext, String, AzureEnvironment)

    Enable Microsoft Teams team in an O365 group connected team site Will also enable it on a newly Groupified classic site

    Declaration
    public static async Task<string> TeamifySiteAsync(ClientContext context, string graphAccessToken = null, AzureEnvironment azureEnvironment = default(AzureEnvironment))
    Parameters
    ClientContext context

    Context to operate against

    System.String graphAccessToken

    Graph Access token

    AzureEnvironment azureEnvironment

    Azure environment to operate

    Returns
    Task<System.String>

    Back to top PnP Framework
    Generated by DocFX with Material UI
    spacer