class SharingDetail
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.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/insights/sharing_detail.py
6 - 28
simple
Purpose
SharingDetail is a complex type that encapsulates properties of sharedInsight items in Microsoft 365. It stores metadata about sharing events, including the identity of the person who shared the resource, the timestamp of sharing, a reference to the shared resource, the subject/context of sharing, and the method used for sharing (link, attachment, group, or site). This class inherits from ClientValue, making it suitable for serialization and transmission in Office 365 API interactions.
Source Code
class SharingDetail(ClientValue):
"""Complex type containing properties of sharedInsight items."""
def __init__(
self,
sharedBy=InsightIdentity(),
shared_datetime=None,
sharing_reference=ResourceReference(),
sharing_subject=None,
sharing_type=None,
):
"""
:param datetime.datetime shared_datetime: The date and time the file was last shared.
:param ResourceReference sharing_reference:
:param str sharing_subject: The subject with which the document was shared.
:param str sharing_type: Determines the way the document was shared,
can be by a "Link", "Attachment", "Group", "Site".
"""
self.sharedBy = sharedBy
self.sharedDateTime = shared_datetime
self.sharingReference = sharing_reference
self.sharingSubject = sharing_subject
self.sharingType = sharing_type
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
sharedBy: An InsightIdentity object representing the user who shared the resource. Defaults to an empty InsightIdentity() instance if not provided. Contains identity information about the sharer.
shared_datetime: A datetime.datetime object indicating when the file was last shared. Can be None if the sharing time is unknown or not applicable. Stored as sharedDateTime attribute.
sharing_reference: A ResourceReference object that provides a reference to the shared resource. Defaults to an empty ResourceReference() instance. Contains information to identify and locate the shared item.
sharing_subject: A string describing the subject or context with which the document was shared. Can be None if no subject was specified. Provides additional context about the sharing event.
sharing_type: A string indicating the method used to share the document. Expected values include 'Link', 'Attachment', 'Group', or 'Site'. Can be None if the sharing type is unknown.
Return Value
Instantiation returns a SharingDetail object with all sharing-related properties initialized. The object itself doesn't have methods that return values, but serves as a data container that can be serialized and used in Office 365 API operations through its ClientValue base class.
Class Interface
Methods
__init__(self, sharedBy=InsightIdentity(), shared_datetime=None, sharing_reference=ResourceReference(), sharing_subject=None, sharing_type=None)
Purpose: Initializes a new SharingDetail instance with sharing metadata properties
Parameters:
sharedBy: InsightIdentity object representing who shared the resourceshared_datetime: datetime.datetime object for when the resource was sharedsharing_reference: ResourceReference object pointing to the shared resourcesharing_subject: String describing the sharing context or subjectsharing_type: String indicating sharing method ('Link', 'Attachment', 'Group', 'Site')
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
sharedBy |
InsightIdentity | Identity information of the user who shared the resource | instance |
sharedDateTime |
datetime.datetime or None | Timestamp indicating when the file was last shared | instance |
sharingReference |
ResourceReference | Reference object containing information about the shared resource | instance |
sharingSubject |
str or None | Subject or context description for the sharing event | instance |
sharingType |
str or None | Method used for sharing (Link, Attachment, Group, or Site) | instance |
Dependencies
office365.directory.insights.identityoffice365.directory.insights.resource_referenceoffice365.runtime.client_value
Required Imports
from office365.directory.insights.identity import InsightIdentity
from office365.directory.insights.resource_reference import ResourceReference
from office365.runtime.client_value import ClientValue
Usage Example
from datetime import datetime
from office365.directory.insights.identity import InsightIdentity
from office365.directory.insights.resource_reference import ResourceReference
from office365.directory.insights.sharing_detail import SharingDetail
# Create identity for the person who shared
sharer = InsightIdentity()
sharer.displayName = 'John Doe'
sharer.id = 'user123'
# Create resource reference
resource_ref = ResourceReference()
resource_ref.id = 'doc456'
resource_ref.webUrl = 'https://example.sharepoint.com/doc456'
# Create sharing detail with all parameters
sharing_detail = SharingDetail(
sharedBy=sharer,
shared_datetime=datetime(2023, 10, 15, 14, 30, 0),
sharing_reference=resource_ref,
sharing_subject='Q4 Budget Review',
sharing_type='Link'
)
# Access properties
print(f'Shared by: {sharing_detail.sharedBy.displayName}')
print(f'Shared on: {sharing_detail.sharedDateTime}')
print(f'Sharing type: {sharing_detail.sharingType}')
print(f'Subject: {sharing_detail.sharingSubject}')
Best Practices
- Always provide meaningful values for sharedBy and sharing_reference when creating instances, as these are core identifiers for sharing events
- Use proper datetime objects for shared_datetime to ensure consistent time handling across different timezones
- Validate sharing_type against expected values ('Link', 'Attachment', 'Group', 'Site') before instantiation to maintain data consistency
- This class is immutable after creation by design - set all properties during instantiation rather than modifying them later
- When using with Office 365 APIs, ensure the parent ClientValue serialization methods are properly invoked for API transmission
- Default empty objects (InsightIdentity(), ResourceReference()) are provided for convenience but should be replaced with actual data in production use
- This class is typically instantiated by the Office 365 SDK when deserializing API responses rather than manually created by developers
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class SharingFacet 70.7% similar
-
class SharedInsight 69.7% similar
-
class SharedDocumentInfo 68.1% similar
-
class OneDriveSiteSharingInsights 67.6% similar
-
class ObjectSharingInformation 67.4% similar