🔍 Code Extractor

class SocialRestFeedManager

Maturity: 54

SocialRestFeedManager is a REST API manager class for SharePoint social features, enabling operations like creating posts, modifying threads, and consuming feeds on behalf of the current user.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/feed/rest_manager.py
Lines:
6 - 20
Complexity:
moderate

Purpose

This class serves as the primary interface for interacting with SharePoint's social feed functionality via REST API (MS-CSOMREST protocol). It provides methods to access social actors, manage social feeds, create posts, and interact with social threads. The class is specifically designed for REST-based communication and is not available through the CSOM protocol. It inherits from Entity, providing base functionality for SharePoint entity operations.

Source Code

class SocialRestFeedManager(Entity):
    """he SocialRestFeedManager class provides REST methods for creating posts, modifying threads,
    and consuming feeds on behalf of the current user. The SocialRestFeedManager class is available
    when the protocol client sends an OData request to a protocol server using [MS-CSOMREST].
    It is not available using [MS-CSOM]."""

    def __init__(self, content):
        super(SocialRestFeedManager, self).__init__(
            content, ResourcePath("SP.Social.SocialRestFeedManager")
        )

    def my(self):
        """The My method gets a SocialRestActor object that represents the current user. See section 3.1.5.35 for
        details on the SocialRestActor type."""
        return SocialRestActor(self.context, ResourcePath("My", self.resource_path))

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

content: The context or content object required for initializing the Entity base class. This parameter provides the necessary connection and authentication context for making REST API calls to the SharePoint server. It typically contains information about the current session, authentication tokens, and server endpoints.

Return Value

Instantiation returns a SocialRestFeedManager object that represents the social feed manager for the current user. The object provides access to social feed operations through its methods. The my() method returns a SocialRestActor object representing the current user, which can be used to access user-specific social properties and perform user-related social operations.

Class Interface

Methods

__init__(self, content) -> None

Purpose: Initializes the SocialRestFeedManager instance with the provided context and sets up the resource path for REST API operations

Parameters:

  • content: The context object containing authentication and connection information for SharePoint REST API calls

Returns: None - constructor initializes the instance

my(self) -> SocialRestActor

Purpose: Retrieves a SocialRestActor object representing the current authenticated user, providing access to user-specific social properties and operations

Returns: SocialRestActor object representing the current user with properties like name, account name, and social feed information

Attributes

Name Type Description Scope
context ClientContext Inherited from Entity base class. Stores the SharePoint client context used for making REST API requests and managing authentication instance
resource_path ResourcePath Inherited from Entity base class. Contains the REST API resource path 'SP.Social.SocialRestFeedManager' used for constructing API endpoints instance

Dependencies

  • office365

Required Imports

from office365.runtime.paths.resource_path import ResourcePath
from office365.sharepoint.entity import Entity
from office365.sharepoint.social.rest_actor import SocialRestActor

Usage Example

from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.social.rest_feed_manager import SocialRestFeedManager

# Authenticate and create context
ctx = ClientContext('https://yourtenant.sharepoint.com')
ctx.with_credentials(user_credentials)

# Create feed manager instance
feed_manager = SocialRestFeedManager(ctx)

# Get current user's social actor
my_actor = feed_manager.my()
ctx.load(my_actor)
ctx.execute_query()

# Access user properties
print(f"User: {my_actor.name}")
print(f"Account: {my_actor.account_name}")

Best Practices

  • Always ensure proper authentication context is established before instantiating SocialRestFeedManager
  • Call ctx.execute_query() after loading objects to retrieve data from the server
  • This class requires MS-CSOMREST protocol support and will not work with MS-CSOM
  • Handle network exceptions and authentication errors when making REST API calls
  • The class inherits from Entity, so it follows the standard Office365 entity lifecycle pattern
  • Use the my() method to get the current user's social actor before performing user-specific operations
  • Ensure the user has appropriate permissions for social feed operations in SharePoint
  • The resource path 'SP.Social.SocialRestFeedManager' is automatically set during initialization

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SocialRestFeed 86.4% similar

    SocialRestFeed is a SharePoint entity class that represents a social feed containing threads with root posts and response posts, accessible via OData requests using MS-CSOMREST protocol.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/feed/rest.py
  • class MicrofeedManager 78.2% similar

    MicrofeedManager is a SharePoint entity class that manages microfeed functionality, inheriting from the Entity base class and representing the SP.Microfeed.MicrofeedManager resource in SharePoint.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/microfeed/manager.py
  • class SocialFeedManager 76.5% similar

    The SocialFeedManager class provides access to social feeds. It provides methods to create posts, delete posts, read posts, and perform other operations on posts.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/feed/manager.py
  • class SocialRestFollowingManager 76.1% similar

    A SharePoint Social REST API manager class that provides methods for managing a user's list of followed actors, including users, documents, sites, and tags, as well as retrieving followers.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/following/rest_manager.py
  • class SocialFeed 76.0% similar

    SocialFeed is a data class representing a social media feed containing threads of posts, with metadata about processed items and unread mentions.

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