class LinkInvitation
A data class representing an invitation to a tokenized SharePoint sharing link, tracking who was invited, by whom, and when.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/invitation/link.py
5 - 23
simple
Purpose
This class encapsulates information about invitations to SharePoint tokenized sharing links. It inherits from ClientValue (a SharePoint client library base class) and is used to track invitation metadata including the inviter (invited_by), the invitee, and the timestamp of the invitation (invited_on). This is typically used in SharePoint sharing and collaboration scenarios to manage and audit link-based access permissions.
Source Code
class LinkInvitation(ClientValue):
"""This class is used to identify the specific invitees for a tokenized sharing link,
along with who invited them and when."""
def __init__(self, invited_by=Principal(), invited_on=None, invitee=Principal()):
"""
:param Principal invited_by: Indicates the principal who invited the invitee to the tokenized sharing link.
:param str invited_on: String representation of nullable DateTime value indicating when the invitee was
invited to the tokenized sharing link.
:param Principal invitee: Indicates a principal who is invited to the tokenized sharing link.
"""
super(LinkInvitation, self).__init__()
self.invitedBy = invited_by
self.invitedOn = invited_on
self.invitee = invitee
@property
def entity_type_name(self):
return "SP.Sharing.LinkInvitation"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
invited_by: A Principal object representing the user or entity who created and sent the invitation to the sharing link. Defaults to an empty Principal() instance if not provided.
invited_on: A string representation of a nullable DateTime value indicating the timestamp when the invitation was sent. Can be None if the invitation time is not specified or not yet set.
invitee: A Principal object representing the user or entity who received the invitation to access the tokenized sharing link. Defaults to an empty Principal() instance if not provided.
Return Value
Instantiation returns a LinkInvitation object that stores invitation metadata. The object has a property 'entity_type_name' that returns the string 'SP.Sharing.LinkInvitation', which is used for SharePoint API serialization and type identification.
Class Interface
Methods
__init__(invited_by=Principal(), invited_on=None, invitee=Principal())
Purpose: Initializes a new LinkInvitation instance with invitation metadata
Parameters:
invited_by: Principal object representing who sent the invitation (defaults to empty Principal)invited_on: String datetime representation of when invitation was sent (defaults to None)invitee: Principal object representing who received the invitation (defaults to empty Principal)
Returns: None (constructor)
@property entity_type_name(self) -> str
property
Purpose: Returns the SharePoint entity type identifier for this class, used in API serialization
Returns: String 'SP.Sharing.LinkInvitation' representing the SharePoint entity type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
invitedBy |
Principal | Stores the Principal object representing the user who created and sent the invitation | instance |
invitedOn |
str or None | Stores the string representation of the datetime when the invitation was sent, can be None | instance |
invitee |
Principal | Stores the Principal object representing the user who received the invitation | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
from office365.sharepoint.sharing.principal import Principal
Usage Example
from office365.runtime.client_value import ClientValue
from office365.sharepoint.sharing.principal import Principal
from office365.sharepoint.sharing.link_invitation import LinkInvitation
# Create Principal objects for inviter and invitee
inviter = Principal()
inviter.email = 'john.doe@example.com'
inviter.loginName = 'i:0#.f|membership|john.doe@example.com'
invitee = Principal()
invitee.email = 'jane.smith@example.com'
invitee.loginName = 'i:0#.f|membership|jane.smith@example.com'
# Create a LinkInvitation instance
invitation = LinkInvitation(
invited_by=inviter,
invited_on='2024-01-15T10:30:00Z',
invitee=invitee
)
# Access the entity type name for SharePoint API operations
entity_type = invitation.entity_type_name # Returns 'SP.Sharing.LinkInvitation'
# Access invitation details
print(f"Invited by: {invitation.invitedBy.email}")
print(f"Invited on: {invitation.invitedOn}")
print(f"Invitee: {invitation.invitee.email}")
Best Practices
- Always provide valid Principal objects for invited_by and invitee parameters to ensure proper tracking of invitation relationships
- Use ISO 8601 formatted datetime strings for the invited_on parameter to maintain consistency with SharePoint API expectations
- This class is primarily a data container and should be used in conjunction with SharePoint sharing APIs rather than standalone
- The entity_type_name property should not be modified as it's used by the SharePoint client library for serialization
- Instances of this class are typically created when retrieving sharing link information from SharePoint or when preparing data to send to SharePoint sharing APIs
- The class inherits from ClientValue, which provides serialization capabilities for SharePoint REST API communication
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ShareLinkRequest 76.4% similar
-
class SharingLinkAccessRequest 74.3% similar
-
class ShareLinkResponse 74.2% similar
-
class SPInvitationCreationResult 72.7% similar
-
class SharingLinkAbilities 71.2% similar