class Link
A SharePoint Link entity class that represents a directory link object in SharePoint, inheriting from the Entity base class.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/link.py
4 - 7
simple
Purpose
This class represents a SharePoint directory link entity and provides the entity type name identifier for SharePoint API operations. It serves as a model for Link objects in the SharePoint directory structure, allowing interaction with SharePoint link resources through the office365 SDK.
Source Code
class Link(Entity):
@property
def entity_type_name(self):
return "SP.Directory.Link"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
__init__: Inherits constructor from Entity base class. The specific parameters depend on the Entity parent class implementation, typically including context and resource path information for SharePoint API communication.
Return Value
Instantiation returns a Link object that represents a SharePoint directory link entity. The entity_type_name property returns the string 'SP.Directory.Link' which identifies this entity type in SharePoint API calls.
Class Interface
Methods
@property entity_type_name(self) -> str
property
Purpose: Returns the SharePoint entity type name identifier for Link objects
Returns: String 'SP.Directory.Link' which is the SharePoint entity type identifier for directory links
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
entity_type_name |
str | Read-only property that returns the SharePoint entity type name 'SP.Directory.Link' used for API operations | instance |
Dependencies
office365
Required Imports
from office365.sharepoint.directory.link import Link
from office365.sharepoint.entity import Entity
Usage Example
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.directory.link import Link
# Initialize SharePoint context
ctx = ClientContext('https://yourtenant.sharepoint.com/sites/yoursite')
ctx.with_credentials(user_credentials)
# Link objects are typically retrieved from SharePoint rather than instantiated directly
# Example: Getting a link from SharePoint
link = ctx.web.get_property('SomeLink')
print(link.entity_type_name) # Outputs: 'SP.Directory.Link'
# Execute the query to load data
ctx.execute_query()
Best Practices
- Link objects are typically retrieved from SharePoint API rather than instantiated directly by users
- Always ensure proper authentication context is established before working with Link entities
- Use the entity_type_name property when making SharePoint API calls that require entity type identification
- The Link class inherits all functionality from Entity base class, so refer to Entity documentation for full method availability
- Execute queries using the ClientContext.execute_query() method after setting up operations on Link objects
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class SharePointDirectoryProvider 71.4% similar
-
class SocialLink 68.5% similar
-
class SiteLinkingManager 67.3% similar
-
class ShareLinkResponse 66.4% similar
-
class SharingLinkDefaultTemplate 66.1% similar