🔍 Code Extractor

class SocialRestActor

Maturity: 49

SocialRestActor is a class representing an actor (user, document, site, or tag) retrieved from a SharePoint server via OData REST requests.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/rest_actor.py
Lines:
5 - 18
Complexity:
simple

Purpose

This class provides a wrapper for social actor information retrieved from SharePoint servers using the MS-CSOMREST protocol. It extends the Entity base class and provides access to actor data, specifically the current user through the 'me' property. This is used in SharePoint social features to represent entities that can participate in social interactions.

Source Code

class SocialRestActor(Entity):
    """The SocialRestActor type contains information about an actor retrieved from server. An actor is a user, document,
    site, or tag. The SocialRestActor type is available when the protocol client sends an OData request to a protocol
    server using [MS-CSOMREST]. It is not available using [MS-CSOM]."""

    @property
    def me(self):
        """The Me property provides access to the current user.
        See section 3.1.5.3 for details on the SocialActor type"""
        return self.properties.get("Me", SocialActor())

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

Parameters

Name Type Default Kind
bases Entity -

Parameter Details

__init__: Inherits constructor from Entity base class. No explicit constructor parameters are defined in this class. The Entity base class handles initialization, likely accepting context and properties parameters typical of SharePoint client objects.

Return Value

Instantiation returns a SocialRestActor object that inherits from Entity. The 'me' property returns a SocialActor object representing the current user, or an empty SocialActor() if not available in properties.

Class Interface

Methods

@property me(self) -> SocialActor property

Purpose: Provides access to the current user as a SocialActor object

Returns: SocialActor object representing the current user, or an empty SocialActor() if not available in properties

@property entity_type_name(self) -> str property

Purpose: Returns the SharePoint entity type name for this class

Returns: String 'SP.Social.SocialRestActor' identifying the entity type in SharePoint

Attributes

Name Type Description Scope
properties dict Dictionary inherited from Entity base class that stores actor properties including 'Me' key for current user data instance

Dependencies

  • office365.sharepoint.entity
  • office365.sharepoint.social.actor

Required Imports

from office365.sharepoint.entity import Entity
from office365.sharepoint.social.actor import SocialActor

Usage Example

# Assuming you have a SharePoint context established
from office365.sharepoint.social.rest_actor import SocialRestActor

# Typically instantiated through SharePoint context or retrieved from server
# Example of accessing the current user actor:
rest_actor = SocialRestActor(context)
current_user = rest_actor.me

# Access properties of the current user
print(current_user.name)
print(current_user.account_name)

# Check entity type
print(rest_actor.entity_type_name)  # Output: 'SP.Social.SocialRestActor'

Best Practices

  • This class is designed for use with OData REST requests (MS-CSOMREST) and is not available when using MS-CSOM protocol
  • The 'me' property provides lazy access to the current user actor, returning an empty SocialActor if not yet populated
  • This class should be instantiated through proper SharePoint context objects rather than directly
  • The properties dictionary inherited from Entity base class stores the actual actor data
  • Always ensure proper authentication and context are established before accessing actor properties
  • This is a read-only representation of server data; modifications should be done through appropriate SharePoint API methods

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SocialActor 79.6% similar

    SocialActor is a data model class representing an actor entity retrieved from a server, where an actor can be a user, document, site, or tag in a social context.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/actor.py
  • class SocialActorInfo 76.3% similar

    SocialActorInfo is a data class that represents an actor (user, document, site, or tag) in SharePoint's social features, used to identify and communicate actor information to the server.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/actor_info.py
  • class SocialRestFollowingManager 69.3% 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 SocialRestFeedManager 67.1% similar

    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.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/feed/rest_manager.py
  • class SocialRestFeed 66.3% 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
← Back to Browse