class DocumentLibraryInformation
A data class that represents metadata and configuration information for a SharePoint document library on a site.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/lists/document_library_information.py
4 - 29
simple
Purpose
This class serves as a data transfer object (DTO) to encapsulate all relevant information about a SharePoint document library, including its title, URLs, drive identifier, and configuration flags. It inherits from ClientValue, which is part of the Office365 REST API client framework, making it suitable for serialization and communication with SharePoint services. The class is primarily used to store and transport document library metadata when interacting with SharePoint sites through the Office365 Python SDK.
Source Code
class DocumentLibraryInformation(ClientValue):
"""Specifies the information for a document library on a site."""
def __init__(
self,
title=None,
absolute_url=None,
server_relative_url=None,
drive_id=None,
from_cross_farm=None,
is_default_document_library=None,
):
"""
:param str title:Identifies the title of the document library
:param str absolute_url: Absolute Url of the document library.
:param str server_relative_url: Identifies the server-relative URL of the document library.
:param str drive_id:
:param bool from_cross_farm:
:param bool is_default_document_library:
"""
self.Title = title
self.AbsoluteUrl = absolute_url
self.ServerRelativeUrl = server_relative_url
self.DriveId = drive_id
self.FromCrossFarm = from_cross_farm
self.IsDefaultDocumentLibrary = is_default_document_library
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
title: The display title/name of the document library as shown in SharePoint. This is a human-readable string identifier. Optional parameter, defaults to None.
absolute_url: The complete URL to access the document library, including protocol and domain (e.g., 'https://contoso.sharepoint.com/sites/mysite/Documents'). Optional parameter, defaults to None.
server_relative_url: The URL path relative to the SharePoint server root (e.g., '/sites/mysite/Documents'). This is used for server-side operations and navigation. Optional parameter, defaults to None.
drive_id: The unique identifier for the underlying OneDrive/SharePoint drive associated with this document library. Used for Microsoft Graph API operations. Optional parameter, defaults to None.
from_cross_farm: Boolean flag indicating whether this document library originates from a different SharePoint farm in a multi-farm environment. Optional parameter, defaults to None.
is_default_document_library: Boolean flag indicating whether this is the default document library for the site (typically the 'Documents' library created automatically with new sites). Optional parameter, defaults to None.
Return Value
Instantiation returns a DocumentLibraryInformation object with all specified attributes set. The object itself does not have methods that return values; it serves as a data container. When used with the Office365 SDK, this object can be serialized to/from JSON for API communication.
Class Interface
Methods
__init__(self, title=None, absolute_url=None, server_relative_url=None, drive_id=None, from_cross_farm=None, is_default_document_library=None)
Purpose: Initializes a new DocumentLibraryInformation instance with metadata about a SharePoint document library
Parameters:
title: The display title of the document library (str, optional)absolute_url: Complete URL to the document library (str, optional)server_relative_url: Server-relative URL path (str, optional)drive_id: Unique drive identifier for Graph API operations (str, optional)from_cross_farm: Flag indicating cross-farm origin (bool, optional)is_default_document_library: Flag indicating if this is the default library (bool, optional)
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Title |
str or None | The display title/name of the document library | instance |
AbsoluteUrl |
str or None | The complete URL to access the document library including protocol and domain | instance |
ServerRelativeUrl |
str or None | The URL path relative to the SharePoint server root | instance |
DriveId |
str or None | The unique identifier for the underlying OneDrive/SharePoint drive | instance |
FromCrossFarm |
bool or None | Indicates whether the library originates from a different SharePoint farm | instance |
IsDefaultDocumentLibrary |
bool or None | Indicates whether this is the default document library for the site | instance |
Dependencies
office365-runtime
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
# Create a document library information object
doc_lib_info = DocumentLibraryInformation(
title="Shared Documents",
absolute_url="https://contoso.sharepoint.com/sites/mysite/Shared Documents",
server_relative_url="/sites/mysite/Shared Documents",
drive_id="b!abc123def456",
from_cross_farm=False,
is_default_document_library=True
)
# Access attributes
print(doc_lib_info.Title) # Output: Shared Documents
print(doc_lib_info.AbsoluteUrl) # Output: https://contoso.sharepoint.com/sites/mysite/Shared Documents
print(doc_lib_info.IsDefaultDocumentLibrary) # Output: True
# Create with minimal information
minimal_info = DocumentLibraryInformation(title="My Library")
print(minimal_info.Title) # Output: My Library
print(minimal_info.DriveId) # Output: None
Best Practices
- This is a simple data container class with no business logic. All parameters are optional, allowing flexible instantiation based on available information.
- The class follows PascalCase naming convention for attributes (Title, AbsoluteUrl, etc.) to match SharePoint API conventions, even though Python typically uses snake_case.
- When creating instances, provide as much information as available to ensure complete metadata representation, especially URLs and drive_id for proper library identification.
- This class is immutable by convention - attributes should be set during initialization. Avoid modifying attributes after instantiation unless necessary.
- The class inherits from ClientValue, which provides serialization capabilities for Office365 REST API communication. Do not instantiate this class outside the context of Office365 SDK operations unless you understand the serialization requirements.
- All attributes can be None, so always check for None values before using them in operations to avoid AttributeError or NoneType errors.
- Use absolute_url for user-facing operations and server_relative_url for server-side API calls.
- The drive_id is particularly important when integrating with Microsoft Graph API for file operations on the document library.
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class WebCreationInformation 71.6% similar
-
class ListItemCreationInformation 69.3% similar
-
class GroupCreationInformation 68.4% similar
-
class ContentTypeCreationInformation 68.3% similar
-
class UpgradeInfo 68.3% similar