class SocialAttachment
SocialAttachment is a class representing an image, document preview, or video preview attachment in SharePoint Social features.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/attachment.py
4 - 9
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
-
class SocialPost 78.1% similar
-
class MicrofeedAttachmentStore 67.4% similar
-
class SocialLink 66.9% similar
-
class Attachment 66.3% similar