🔍 Code Extractor

class SocialAttachment

Maturity: 42

SocialAttachment is a class representing an image, document preview, or video preview attachment in SharePoint Social features.

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

Purpose

This class serves as a data model for social media attachments in SharePoint Online/Office 365. It inherits from ClientValue, which is a base class for client-side value objects that can be serialized and sent to SharePoint REST APIs. The class is used to represent various types of media attachments (images, documents, videos) that can be associated with social posts, feeds, or other social features in SharePoint.

Source Code

class SocialAttachment(ClientValue):
    """The SocialAttachment class represents an image, document preview, or video preview attachment."""

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

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 SharePoint entity properties for social attachments, such as attachment URL, name, type, and metadata.

Return Value

Instantiation returns a SocialAttachment object that can be used to represent attachment data in SharePoint social operations. The entity_type_name property returns the string 'SP.Social.SocialAttachment', which identifies the SharePoint entity type for serialization purposes.

Class Interface

Methods

@property entity_type_name(self) -> str property

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

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

Attributes

Name Type Description Scope
entity_type_name str Read-only property that returns the SharePoint entity type identifier 'SP.Social.SocialAttachment' instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue
from office365.sharepoint.social.social_attachment import SocialAttachment

Usage Example

from office365.sharepoint.social.social_attachment import SocialAttachment

# Create a social attachment instance
attachment = SocialAttachment()
attachment.set_property('AttachmentKind', 1)  # Image type
attachment.set_property('Name', 'example.jpg')
attachment.set_property('Uri', 'https://example.sharepoint.com/image.jpg')

# Get the entity type name
entity_type = attachment.entity_type_name  # Returns 'SP.Social.SocialAttachment'

# Use with SharePoint social feed operations
# attachment can be passed to social post creation methods

Best Practices

  • This class is primarily used as a data transfer object (DTO) for SharePoint social API operations
  • Instantiate the class and set properties using set_property() method inherited from ClientValue
  • The entity_type_name property is used internally by the Office 365 SDK for proper serialization to SharePoint REST API
  • Do not modify entity_type_name as it must match the SharePoint server-side type definition
  • Use this class in conjunction with SharePoint social feed operations like creating posts with attachments
  • Ensure attachment URIs are valid and accessible within the SharePoint context
  • The class is immutable in terms of its type definition but properties can be set after instantiation

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SocialAttachmentAction 79.1% similar

    SocialAttachmentAction is a class that specifies user actions allowed for social attachment objects in Office 365, inheriting from ClientValue.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/attachment_action.py
  • class SocialPost 78.1% similar

    SocialPost is a data class that represents a social media post retrieved from a SharePoint server, encapsulating post content, attachments, overlays, source information, and user engagement data.

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

    A SharePoint entity class representing a Microfeed attachment store, which manages attachments associated with SharePoint microfeed items.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/microfeed/attachment_store.py
  • class SocialLink 66.9% similar

    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.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/link.py
  • class Attachment 66.3% similar

    Represents a file or item (contact, event, or message) attached to an event or message in Office 365, providing methods to download and access attachment content and metadata.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/mail/attachments/attachment.py
← Back to Browse