🔍 Code Extractor

class SiteCreationProperties

Maturity: 36

A data class that encapsulates the properties required to create a new SharePoint site, including URL, owner, title, and template information.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/sites/creation_properties.py
Lines:
4 - 31
Complexity:
simple

Purpose

This class serves as a data transfer object (DTO) for SharePoint site creation operations. It inherits from ClientValue and represents the Microsoft.Online.SharePoint.TenantAdministration.SiteCreationProperties entity type. It is used to bundle all necessary configuration parameters when creating a new SharePoint site through the Office365 API, ensuring proper serialization and communication with SharePoint's tenant administration services.

Source Code

class SiteCreationProperties(ClientValue):
    def __init__(
        self,
        title=None,
        url=None,
        owner=None,
        owner_name=None,
        template=None,
        site_uni_name=None,
    ):
        """Sets the initial properties for a new site when it is created.

        :param str owner: Gets or sets the login name of the owner of the new site
        :param str url: Gets or sets the new site’s URL.
        :param str template: Gets or sets the web template name of the new site.
        :param str site_uni_name:
        """
        super(SiteCreationProperties, self).__init__()
        self.Url = url
        self.Owner = owner
        self.OwnerName = owner_name
        self.Title = title
        self.Template = template
        self.SiteUniName = site_uni_name

    @property
    def entity_type_name(self):
        return "Microsoft.Online.SharePoint.TenantAdministration.SiteCreationProperties"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

title: The title/display name for the new SharePoint site. This is the human-readable name that will appear in site listings and navigation. Can be None if not specified during initialization.

url: The URL where the new SharePoint site will be accessible. This should be a valid SharePoint site URL path. Can be None if not specified during initialization.

owner: The login name (typically email or username) of the user who will be the owner/administrator of the new site. This user will have full control permissions. Can be None if not specified during initialization.

owner_name: The display name of the site owner. This is typically the full name of the owner user for display purposes. Can be None if not specified during initialization.

template: The web template name that defines the structure and features of the new site (e.g., 'STS#0' for Team Site, 'BLOG#0' for Blog). This determines the initial configuration and available features. Can be None if not specified during initialization.

site_uni_name: A unique identifier or name for the site. The exact purpose may vary based on SharePoint configuration. Can be None if not specified during initialization.

Return Value

Instantiation returns a SiteCreationProperties object with all specified properties set as instance attributes. The object can be serialized and sent to SharePoint's tenant administration API for site creation. The entity_type_name property returns the string 'Microsoft.Online.SharePoint.TenantAdministration.SiteCreationProperties' which identifies this object type in SharePoint's API.

Class Interface

Methods

__init__(self, title=None, url=None, owner=None, owner_name=None, template=None, site_uni_name=None)

Purpose: Initializes a new SiteCreationProperties instance with the specified site configuration parameters

Parameters:

  • title: The title/display name for the new site
  • url: The URL where the new site will be accessible
  • owner: The login name of the site owner
  • owner_name: The display name of the site owner
  • template: The web template name for the site structure
  • site_uni_name: A unique identifier or name for the site

Returns: None (constructor)

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name used for API serialization and identification

Returns: The string 'Microsoft.Online.SharePoint.TenantAdministration.SiteCreationProperties' which identifies this object type in SharePoint's API

Attributes

Name Type Description Scope
Url str or None The URL where the new SharePoint site will be accessible instance
Owner str or None The login name of the owner of the new site instance
OwnerName str or None The display name of the site owner instance
Title str or None The title/display name for the new site instance
Template str or None The web template name that defines the site structure and features instance
SiteUniName str or None A unique identifier or name for the site instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue

Usage Example

from office365.runtime.client_value import ClientValue

# Create site creation properties for a new team site
site_props = SiteCreationProperties(
    title='Marketing Team Site',
    url='https://contoso.sharepoint.com/sites/marketing',
    owner='admin@contoso.com',
    owner_name='Site Administrator',
    template='STS#0',
    site_uni_name='marketing-site'
)

# Access properties
print(site_props.Title)  # 'Marketing Team Site'
print(site_props.Url)    # 'https://contoso.sharepoint.com/sites/marketing'
print(site_props.entity_type_name)  # 'Microsoft.Online.SharePoint.TenantAdministration.SiteCreationProperties'

# Typically used with SharePoint tenant administration API
# tenant.create_site(site_props)

Best Practices

  • Always provide at minimum the 'url' and 'owner' parameters as these are typically required for site creation
  • Ensure the URL is unique and follows SharePoint naming conventions (no spaces, special characters limited)
  • Use valid SharePoint web template identifiers for the 'template' parameter (e.g., 'STS#0', 'BLOG#0', 'DEV#0')
  • The owner must be a valid user account with appropriate licenses in the SharePoint tenant
  • This object is immutable after creation in typical usage - create a new instance if different properties are needed
  • The entity_type_name property should not be modified as it's used for API serialization
  • This class is designed to be used with SharePoint tenant administration APIs and should be passed to appropriate site creation methods

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SiteCreationData 82.8% similar

    A data class representing site creation information for SharePoint Online tenant administration, including creation count and source GUID.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/sites/creation_data.py
  • class SiteStateProperties 82.5% similar

    A data class representing SharePoint site state properties for tenant administration operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/sites/state_properties.py
  • class SiteProperties 81.9% similar

    Represents a SharePoint site collection's properties and provides methods to query and update site-level settings such as sharing capabilities, lock state, and customization permissions.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/sites/properties.py
  • class SiteCreationSource 77.1% similar

    A client value class representing a source for SharePoint site creation, containing a collection of site creation data objects.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/sites/creation_source.py
  • class SiteDesignCreationInfo 76.8% similar

    A data class representing the configuration information needed to create a SharePoint site design, including title, description, template type, and associated site scripts.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sitedesigns/creation_info.py
← Back to Browse