class SocialRestActor
SocialRestActor is a class representing an actor (user, document, site, or tag) retrieved from a SharePoint server via OData REST requests.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/social/rest_actor.py
5 - 18
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.entityoffice365.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
-
class SocialActorInfo 76.3% similar
-
class SocialRestFollowingManager 69.3% similar
-
class SocialRestFeedManager 67.1% similar
-
class SocialRestFeed 66.3% similar