class SocialPostReference
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.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/posts/reference.py
5 - 29
simple
Purpose
The SocialPostReference class encapsulates metadata about a referenced post from another thread in SharePoint's social functionality. It is used to represent relationships between posts such as tags, likes, mentions, or replies. This class is specifically designed for server-generated threads and provides access to the referenced post, its containing thread information, and thread ownership details. It inherits from ClientValue, making it suitable for client-server communication in SharePoint contexts.
Source Code
class SocialPostReference(ClientValue):
"""The SocialPostReference class specifies a reference to a post in another thread. The referenced post can be a
post with a tag, a post that is liked, a post that mentions a user, or a post that is a reply. Threads that contain
a SocialPostReference in the PostReference property (see section 3.1.5.42.1.1.6) are threads with root posts that
are generated on the server and not created by a client."""
def __init__(
self, digest=None, post=SocialPost(), thread_id=None, thread_owner_index=None
):
"""
:param SocialThread digest: The Digest property provides a digest of the thread containing the referenced post.
:param SocialPost post: The Post property provides access to the post being referenced
:param str thread_id: The ThreadId property specifies the unique identifier of the thread containing the
referenced post.
:param int thread_owner_index: The ThreadOwnerIndex property specifies the current owner of the thread as an
index into the SocialThread Actors array
"""
self.Digest = digest
self.Post = post
self.ThreadId = thread_id
self.ThreadOwnerIndex = thread_owner_index
@property
def entity_type_name(self):
return "SP.Social.SocialPostReference"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
digest: Optional. A SocialThread object providing a digest/summary of the thread containing the referenced post. Defaults to None if not provided.
post: A SocialPost object representing the actual post being referenced. Defaults to a new empty SocialPost() instance if not provided. This gives access to the content and metadata of the referenced post.
thread_id: Optional. A string specifying the unique identifier of the thread that contains the referenced post. Used to locate the thread in the SharePoint social system. Defaults to None.
thread_owner_index: Optional. An integer specifying the index position of the current thread owner within the SocialThread's Actors array. Used to identify who owns the thread. Defaults to None.
Return Value
Instantiation returns a SocialPostReference object with four instance attributes (Digest, Post, ThreadId, ThreadOwnerIndex) initialized with the provided or default values. The entity_type_name property returns the string 'SP.Social.SocialPostReference', which identifies this object type in SharePoint's type system.
Class Interface
Methods
__init__(self, digest=None, post=SocialPost(), thread_id=None, thread_owner_index=None)
Purpose: Initializes a new SocialPostReference instance with reference metadata for a post in another thread
Parameters:
digest: Optional SocialThread object providing a digest of the thread containing the referenced postpost: SocialPost object representing the post being referenced, defaults to empty SocialPost()thread_id: Optional string specifying the unique identifier of the thread containing the referenced postthread_owner_index: Optional integer specifying the current owner of the thread as an index into the SocialThread Actors array
Returns: None (constructor)
@property entity_type_name(self) -> str
property
Purpose: Returns the SharePoint entity type name for this class, used for type identification in the SharePoint type system
Returns: String 'SP.Social.SocialPostReference' identifying this object type in SharePoint
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Digest |
SocialThread or None | Stores a digest of the thread containing the referenced post, providing summary information about the thread | instance |
Post |
SocialPost | Stores the actual post object being referenced, providing access to the post's content and metadata | instance |
ThreadId |
str or None | Stores the unique identifier of the thread containing the referenced post, used for thread lookup | instance |
ThreadOwnerIndex |
int or None | Stores the index of the current thread owner in the SocialThread's Actors array, identifying thread ownership | instance |
Dependencies
office365.runtime.client_valueoffice365.sharepoint.social.posts.post
Required Imports
from office365.runtime.client_value import ClientValue
from office365.sharepoint.social.posts.post import SocialPost
Usage Example
from office365.runtime.client_value import ClientValue
from office365.sharepoint.social.posts.post import SocialPost
from office365.sharepoint.social.posts.reference import SocialPostReference
# Create a referenced post
referenced_post = SocialPost()
# Create a post reference with minimal information
post_ref = SocialPostReference(
post=referenced_post,
thread_id='thread-123',
thread_owner_index=0
)
# Access the entity type name
entity_type = post_ref.entity_type_name # Returns 'SP.Social.SocialPostReference'
# Access the referenced post
post = post_ref.Post
# Access thread information
thread_id = post_ref.ThreadId
owner_index = post_ref.ThreadOwnerIndex
# Create with full information including digest
full_post_ref = SocialPostReference(
digest=some_social_thread,
post=referenced_post,
thread_id='thread-456',
thread_owner_index=1
)
Best Practices
- This class is designed for server-generated threads, not client-created ones. Use it to represent references to existing posts rather than creating new posts.
- Always provide a valid SocialPost object for the 'post' parameter to ensure the reference has meaningful content.
- The thread_id should be a valid unique identifier from the SharePoint social system to properly link to the containing thread.
- The thread_owner_index should correspond to a valid index in the SocialThread's Actors array to correctly identify thread ownership.
- This class inherits from ClientValue, making it suitable for serialization in client-server communication with SharePoint.
- The entity_type_name property is read-only and should not be modified; it's used by SharePoint's type system for object identification.
- When working with post references, ensure the digest parameter (if provided) accurately represents the thread state to maintain data consistency.
- This is an immutable-style data class; attributes are set during initialization and typically not modified afterward in normal usage patterns.
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class SocialThread 77.4% similar
-
class SocialPost 75.3% similar
-
class SocialFeed 70.2% similar
-
class SocialLink 68.8% similar
-
class SocialRestThread 68.2% similar