class SiteLinkingManager
SiteLinkingManager is a SharePoint Portal entity class that manages site linking operations, specifically retrieving linked sites information.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/portal/linkedsites/manager.py
9 - 24
moderate
Purpose
This class provides functionality to interact with SharePoint's site linking features. It inherits from Entity and is designed to retrieve information about linked sites within a SharePoint portal environment. The primary use case is to fetch site links through the GetSiteLinks service operation, which returns a LinkedSitesListContract containing information about sites that are linked together in SharePoint.
Source Code
class SiteLinkingManager(Entity):
""""""
def __init__(self, context, resource_path=None):
super(SiteLinkingManager, self).__init__(context, resource_path)
def get_site_links(self):
""" """
result = ClientResult(self.context, LinkedSitesListContract())
qry = ServiceOperationQuery(self, "GetSiteLinks", None, None, None, result)
self.context.add_query(qry)
return result
@property
def entity_type_name(self):
return "Microsoft.SharePoint.Portal.SiteLinkingManager"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
context: The client context object that provides the connection and authentication information for SharePoint operations. This is required for all SharePoint API interactions and manages the request/response lifecycle.
resource_path: Optional parameter specifying the resource path for the entity in SharePoint. If not provided, defaults to None. This path identifies the specific resource location within the SharePoint site hierarchy.
Return Value
Instantiation returns a SiteLinkingManager object that can be used to query site linking information. The get_site_links() method returns a ClientResult object containing a LinkedSitesListContract, which holds the collection of linked sites and their metadata. The ClientResult is a deferred execution object that will be populated when the query is executed by the context.
Class Interface
Methods
__init__(self, context, resource_path=None)
Purpose: Initializes a new instance of SiteLinkingManager with the provided SharePoint context and optional resource path
Parameters:
context: The SharePoint client context object for API communicationresource_path: Optional resource path string identifying the entity location in SharePoint
Returns: None (constructor)
get_site_links(self) -> ClientResult
Purpose: Retrieves the list of linked sites associated with the current SharePoint portal
Returns: ClientResult object containing a LinkedSitesListContract with information about linked sites. The result is populated after calling context.execute_query()
@property entity_type_name(self) -> str
property
Purpose: Returns the fully qualified entity type name used by SharePoint's internal API framework
Returns: String 'Microsoft.SharePoint.Portal.SiteLinkingManager' representing the entity type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
context |
ClientContext | Inherited from Entity base class. Stores the SharePoint client context used for all API operations | instance |
resource_path |
str or None | Inherited from Entity base class. Stores the resource path identifying this entity's location in SharePoint | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_result import ClientResult
from office365.runtime.queries.service_operation import ServiceOperationQuery
from office365.sharepoint.entity import Entity
from office365.sharepoint.portal.linkedsites.list_contract import LinkedSitesListContract
Usage Example
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.portal.site_linking_manager import SiteLinkingManager
# Setup SharePoint context
site_url = 'https://yourtenant.sharepoint.com/sites/yoursite'
username = 'user@yourtenant.onmicrosoft.com'
password = 'your_password'
ctx = ClientContext(site_url).with_credentials(username, password)
# Create SiteLinkingManager instance
site_linking_mgr = SiteLinkingManager(ctx)
# Get site links
linked_sites_result = site_linking_mgr.get_site_links()
ctx.execute_query()
# Access the linked sites data
linked_sites = linked_sites_result.value
for site in linked_sites.sites:
print(f'Site URL: {site.url}, Title: {site.title}')
Best Practices
- Always call ctx.execute_query() after calling get_site_links() to actually execute the deferred query and populate the result
- Ensure the SharePoint context has appropriate permissions to access site linking information before instantiating this class
- The class follows the deferred execution pattern - queries are queued and executed in batch when execute_query() is called on the context
- Reuse the same SiteLinkingManager instance for multiple operations within the same context to optimize performance
- Handle potential authentication and permission errors when executing queries
- The entity_type_name property is used internally by the SharePoint API framework and should not be modified
- This class is designed to work with SharePoint Portal features and may not be available in all SharePoint configurations
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class MySiteLinks 73.3% similar
-
class LinkedSiteContract 67.8% similar
-
class Link 67.3% similar
-
class LinkedSitesListContract 66.5% similar
-
class VivaSiteManager 65.6% similar