🔍 Code Extractor

class SocialLink

Maturity: 41

SocialLink is a class that represents a social media or web link with a URI and text representation, used to define the location of a website in SharePoint Social contexts.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/link.py
Lines:
4 - 10
Complexity:
simple

Purpose

This class serves as a data structure for representing social links in SharePoint Online/Office 365 environments. It inherits from ClientValue, making it compatible with SharePoint's client-side object model. The class is primarily used to encapsulate link information (URI and text) for social features like user profiles, posts, or other social interactions within SharePoint.

Source Code

class SocialLink(ClientValue):
    """The SocialLink class defines a link that includes a URI and text representation. This class is used to represent
    the location of a web site."""

    @property
    def entity_type_name(self):
        return "SP.Social.SocialLink"

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

__init__: The constructor parameters are inherited from ClientValue base class. Typically accepts keyword arguments that map to the entity's properties such as 'Uri' (the URL string) and 'Text' (the display text for the link). These are set as instance attributes dynamically by the parent ClientValue class.

Return Value

Instantiation returns a SocialLink object that represents a social link entity. The entity_type_name property returns the string 'SP.Social.SocialLink', which identifies this object's type in the SharePoint client object model for serialization and API communication purposes.

Class Interface

Methods

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name identifier for this class, used for serialization and API communication

Returns: String 'SP.Social.SocialLink' representing the SharePoint entity type

Attributes

Name Type Description Scope
Uri str The URI/URL of the social link (inherited from ClientValue, set dynamically) instance
Text str The text representation or display name of the link (inherited from ClientValue, set dynamically) instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.sharepoint.social.social_link import SocialLink

Usage Example

from office365.sharepoint.social.social_link import SocialLink

# Create a social link instance
social_link = SocialLink()
social_link.Uri = 'https://example.com'
social_link.Text = 'Example Website'

# Access the entity type name
entity_type = social_link.entity_type_name  # Returns 'SP.Social.SocialLink'

# Typically used in SharePoint social feed operations
# For example, when creating a post with links:
# post_data = SocialPostCreationData()
# post_data.ContentItems = [social_link]
# social_feed.create_post(post_data)

Best Practices

  • This class is typically instantiated and populated with Uri and Text properties before being used in SharePoint social API calls
  • The class inherits from ClientValue, which provides automatic serialization/deserialization for SharePoint REST API communication
  • Do not modify the entity_type_name property as it is used internally by the SharePoint client library for type identification
  • When creating instances, set the Uri property to a valid URL string and Text property to a human-readable description
  • This class is immutable in terms of its type identity (entity_type_name) but mutable in terms of its data properties (Uri, Text)
  • Instances are typically used as part of larger SharePoint social objects like SocialPost or SocialActor rather than standalone

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SharingLinkDefaultTemplate 72.5% similar

    A data class representing a default template for sharing links in SharePoint, containing link details information.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/links/default_template.py
  • class ShareLinkResponse 71.0% similar

    A response class that encapsulates information about a tokenized sharing link in SharePoint, including its retrieval or creation/update status.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/links/share_response.py
  • class SocialPostReference 68.8% similar

    A class representing a reference to a post in another social thread, used for posts with tags, likes, mentions, or replies in SharePoint social features.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/posts/reference.py
  • class Link 68.5% similar

    A SharePoint Link entity class that represents a directory link object in SharePoint, inheriting from the Entity base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/link.py
  • class ShareLinkRequest 68.5% similar

    A data class representing a request for retrieving or creating a tokenized sharing link in SharePoint, encapsulating all necessary parameters for link configuration.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/links/share_request.py
← Back to Browse