🔍 Code Extractor

class SharedDocumentInfo

Maturity: 36

A SharePoint entity class representing metadata and information about a shared document, including its activity and author details.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/shared_document_info.py
Lines:
5 - 20
Complexity:
simple

Purpose

SharedDocumentInfo is a data model class that encapsulates information about documents shared in SharePoint. It inherits from Entity and provides access to document sharing metadata such as activity logs and author information. This class is typically used when retrieving or managing shared document information through the SharePoint REST API, allowing developers to access sharing-related properties in a structured, object-oriented manner.

Source Code

class SharedDocumentInfo(Entity):
    """"""

    @property
    def activity(self):
        """"""
        return self.properties.get("Activity", None)

    @property
    def author(self):
        """"""
        return self.properties.get("Author", Principal())

    @property
    def entity_type_name(self):
        return "SP.Sharing.SharedDocumentInfo"

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

__init__: Inherits constructor from Entity base class. The Entity base class typically accepts properties dictionary or context parameters for SharePoint API communication, though exact parameters depend on the Entity implementation.

Return Value

Instantiation returns a SharedDocumentInfo object that provides property-based access to shared document metadata. The 'activity' property returns activity information (type unspecified, can be None). The 'author' property returns a Principal object representing the document author, defaulting to an empty Principal() if not available.

Class Interface

Methods

@property activity(self) -> Any property

Purpose: Retrieves the activity information associated with the shared document

Returns: Activity information from the properties dictionary, or None if not present. The exact type depends on SharePoint API response structure.

@property author(self) -> Principal property

Purpose: Retrieves the author/principal who shared or owns the document

Returns: A Principal object representing the document author. Returns an empty Principal() instance if no author is set in properties.

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type identifier for this class

Returns: String literal 'SP.Sharing.SharedDocumentInfo' which identifies this entity type in SharePoint REST API

Attributes

Name Type Description Scope
properties dict Inherited from Entity base class. Dictionary containing the raw property data from SharePoint API responses, including 'Activity' and 'Author' keys instance

Dependencies

  • office365

Required Imports

from office365.sharepoint.entity import Entity
from office365.sharepoint.sharing.principal import Principal

Usage Example

from office365.sharepoint.sharing.shared_document_info import SharedDocumentInfo
from office365.sharepoint.client_context import ClientContext

# Assuming you have a ClientContext set up
ctx = ClientContext(site_url).with_credentials(credentials)

# Typically obtained from SharePoint API response
shared_doc_info = SharedDocumentInfo(ctx)
shared_doc_info.properties = {
    'Activity': 'Document was shared',
    'Author': {'LoginName': 'user@domain.com'}
}

# Access properties
activity = shared_doc_info.activity
author = shared_doc_info.author
type_name = shared_doc_info.entity_type_name

print(f"Activity: {activity}")
print(f"Author: {author}")
print(f"Entity Type: {type_name}")

Best Practices

  • This class is typically instantiated by the Office365 library when retrieving shared document information, not manually created by users
  • Properties are read-only and accessed via property decorators; do not attempt to set them directly
  • The 'author' property returns an empty Principal() object if no author is set, so always check for meaningful data before using
  • The 'activity' property can be None, so implement null checks before accessing its value
  • This class follows the SharePoint REST API entity pattern and should be used within a proper ClientContext
  • The entity_type_name property returns the SharePoint internal type identifier and is used for API serialization
  • Inherits all methods and properties from the Entity base class, including properties dictionary management

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class ObjectSharingInformation 74.9% similar

    A class that provides comprehensive information about the sharing state of SharePoint securable objects (documents, list items, sites), including permissions, sharing links, and user access details.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/object_sharing_information.py
  • class SharedWithMeDocument 74.6% similar

    Represents a shared document in SharePoint with metadata about authors, editors, modification dates, and document properties.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/userprofiles/sharedwithme/document.py
  • class DocumentsSharedWithGroup 69.1% similar

    A class representing a SharePoint list that manages documents shared with a SharePoint Group on a user's personal site.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/portal/userprofiles/documents_shared_with_group.py
  • class MembersInfo 68.2% similar

    MembersInfo is a SharePoint entity class that represents directory members information in the SharePoint API.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/members_info.py
  • class SharingDetail 68.1% similar

    A data class representing detailed information about how a document or resource was shared in Microsoft 365, including who shared it, when, and through what method.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/insights/sharing_detail.py
← Back to Browse