class CreatablesInfo
A SharePoint entity class that provides information about what types of content (folders, items, files) can be created in a SharePoint list, along with links to create them.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/creatables_info.py
5 - 58
moderate
Purpose
CreatablesInfo represents metadata about creation capabilities for a SharePoint list. It indicates whether users can create folders, items (Office documents), or upload files, and provides a collection of CreatableItemInfo objects with links to creation interfaces. This class is used to determine UI options and permissions for content creation in SharePoint lists.
Source Code
class CreatablesInfo(Entity):
"""
Returns an object that describes what this list can create, and a collection of links to visit in order to create
those things. If it can't create certain things, it contains an error message describing why.
The consumer MUST append the encoded URL of the current page to the links returned here.
(This page the link goes to needs it as a query parameter to function correctly.) The consumer SHOULD also consider
appending &IsDlg=1 to the link, to remove the UI from the linked page, if desired.
"""
@property
def can_create_folders(self):
"""
Indicates if the user is able to create folders in the current list. The user MUST have the appropriate
permissions and the list MUST allow folder creation.
:rtype: bool or None
"""
return self.properties.get("CanCreateFolders", None)
@property
def can_create_items(self):
"""
Indicates whether this list can create items (such as documents (Word/Excel/PowerPoint))
using Microsoft Office Online.
:rtype: bool or None
"""
return self.properties.get("CanCreateItems", None)
@property
def can_upload_files(self):
"""
Indicates whether the user is able to upload files to this list.
:rtype: bool or None
"""
return self.properties.get("CanUploadFiles", None)
@property
def creatables_collection(self):
"""
Represents a collection of CreatableItemInfo (section 3.2.5.283) objects describing what can be created,
one CreatableItemInfo for each creatable type.
"""
return self.properties.get(
"CreatablesCollection", CreatableItemInfoCollection()
)
def get_property(self, name, default_value=None):
if default_value is None:
property_mapping = {"CreatablesCollection": self.creatables_collection}
default_value = property_mapping.get(name, None)
return super(CreatablesInfo, self).get_property(name, default_value)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
__init__: Inherits from Entity base class. The constructor accepts standard Entity parameters which typically include context and resource_path for SharePoint API communication. Properties are populated from SharePoint API responses.
Return Value
Instantiation returns a CreatablesInfo object that exposes properties for checking creation permissions (can_create_folders, can_create_items, can_upload_files) and accessing a collection of creatable item types (creatables_collection). Property getters return bool/None for permission flags and CreatableItemInfoCollection for the collection.
Class Interface
Methods
@property can_create_folders() -> bool | None
property
Purpose: Indicates if the user has permissions and the list allows folder creation
Returns: Boolean indicating folder creation capability, or None if not available/loaded
@property can_create_items() -> bool | None
property
Purpose: Indicates whether the list can create Office documents (Word/Excel/PowerPoint) using Microsoft Office Online
Returns: Boolean indicating item creation capability, or None if not available/loaded
@property can_upload_files() -> bool | None
property
Purpose: Indicates whether the user has permissions to upload files to this list
Returns: Boolean indicating file upload capability, or None if not available/loaded
@property creatables_collection() -> CreatableItemInfoCollection
property
Purpose: Returns a collection of CreatableItemInfo objects describing what types of content can be created
Returns: CreatableItemInfoCollection containing one CreatableItemInfo for each creatable type, or empty collection if not populated
get_property(name: str, default_value: Any = None) -> Any
Purpose: Retrieves a property value by name with custom mapping for complex properties like CreatablesCollection
Parameters:
name: The name of the property to retrievedefault_value: Default value to return if property not found; if None, uses internal property mapping
Returns: The property value if found, otherwise the default_value or mapped default
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
properties |
dict | Inherited from Entity base class; stores the raw property data from SharePoint API responses including CanCreateFolders, CanCreateItems, CanUploadFiles, and CreatablesCollection | instance |
Dependencies
office365.sharepoint.entityoffice365.sharepoint.lists.creatable_item_info
Required Imports
from office365.sharepoint.entity import Entity
from office365.sharepoint.lists.creatable_item_info import CreatableItemInfoCollection
Usage Example
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.lists.creatables_info import CreatablesInfo
# Assuming you have a SharePoint context and list object
ctx = ClientContext(site_url).with_credentials(credentials)
list_obj = ctx.web.lists.get_by_title('Documents')
# Get creatables info (typically accessed as a property of a list)
creatables = list_obj.creatables_info
ctx.load(creatables)
ctx.execute_query()
# Check creation capabilities
if creatables.can_create_folders:
print('User can create folders')
if creatables.can_create_items:
print('User can create Office documents')
if creatables.can_upload_files:
print('User can upload files')
# Access collection of creatable types
for creatable in creatables.creatables_collection:
print(f'Can create: {creatable.display_name}')
print(f'Link: {creatable.link}')
Best Practices
- Always load the CreatablesInfo object using ctx.load() and ctx.execute_query() before accessing properties to ensure data is fetched from SharePoint
- Check permission properties (can_create_folders, can_create_items, can_upload_files) before attempting creation operations
- When using links from creatables_collection, append the encoded URL of the current page as a query parameter as required by SharePoint
- Consider appending '&IsDlg=1' to creation links to remove UI chrome if embedding in dialogs
- Handle None values from properties gracefully as they may be None if not loaded or not available
- This object is typically accessed as a property of a SharePoint List object rather than instantiated directly
- The creatables_collection property returns an empty CreatableItemInfoCollection by default if not populated
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class CreatableItemInfo 79.1% similar
-
class ListItemCreationInformation 68.7% similar
-
class CreatableItemInfoCollection 67.5% similar
-
class ListItemCreationInformationUsingPath 65.7% similar
-
class ContentTypeCreationInformation 61.9% similar