class SharePointDirectoryProvider
A SharePoint directory provider entity class that represents the SP.Directory.Provider.SharePointDirectoryProvider resource in SharePoint's REST API.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/provider/provider.py
5 - 15
simple
Purpose
This class serves as a client-side representation of SharePoint's directory provider functionality. It inherits from Entity and provides access to SharePoint directory provider operations through the Office365 REST API. The class is used to interact with SharePoint's directory services, which typically handle user and group directory information within SharePoint environments.
Source Code
class SharePointDirectoryProvider(Entity):
def __init__(self, context, resource_path=None):
if resource_path is None:
resource_path = ResourcePath(
"SP.Directory.Provider.SharePointDirectoryProvider"
)
super(SharePointDirectoryProvider, self).__init__(context, resource_path)
@property
def entity_type_name(self):
return "SP.Directory.Provider.SharePointDirectoryProvider"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
context: The client context object that manages the connection and authentication to the SharePoint service. This is required for making API calls and maintaining the session state.
resource_path: Optional ResourcePath object that specifies the API endpoint path. If not provided, defaults to 'SP.Directory.Provider.SharePointDirectoryProvider'. This path is used to construct the REST API URL for operations on this entity.
Return Value
Instantiation returns a SharePointDirectoryProvider object that represents a SharePoint directory provider entity. This object can be used to interact with SharePoint's directory services through the inherited Entity methods. The entity_type_name property returns the string 'SP.Directory.Provider.SharePointDirectoryProvider'.
Class Interface
Methods
__init__(self, context, resource_path=None)
Purpose: Initializes a new instance of SharePointDirectoryProvider with the given context and optional resource path
Parameters:
context: The client context object for SharePoint API communicationresource_path: Optional ResourcePath object specifying the API endpoint, defaults to 'SP.Directory.Provider.SharePointDirectoryProvider'
Returns: None (constructor)
@property entity_type_name(self) -> str
property
Purpose: Returns the SharePoint entity type name for this provider
Returns: String 'SP.Directory.Provider.SharePointDirectoryProvider' representing the entity type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
context |
ClientContext | Inherited from Entity. The client context used for API communication with SharePoint | instance |
resource_path |
ResourcePath | Inherited from Entity. The resource path identifying this entity in the SharePoint REST API | instance |
Dependencies
office365
Required Imports
from office365.runtime.paths.resource_path import ResourcePath
from office365.sharepoint.entity import Entity
Usage Example
from office365.sharepoint.client_context import ClientContext
from office365.runtime.auth.user_credential import UserCredential
from office365.sharepoint.directory.provider.sharepoint_directory_provider import SharePointDirectoryProvider
# Setup authentication and context
site_url = 'https://yourtenant.sharepoint.com/sites/yoursite'
username = 'user@yourtenant.onmicrosoft.com'
password = 'your_password'
credentials = UserCredential(username, password)
ctx = ClientContext(site_url).with_credentials(credentials)
# Instantiate the SharePointDirectoryProvider
provider = SharePointDirectoryProvider(ctx)
# Access entity type name
print(provider.entity_type_name)
# The provider can now be used with inherited Entity methods
# to interact with SharePoint directory services
Best Practices
- Always ensure the context object is properly authenticated before instantiating this class
- The context object should have appropriate permissions to access SharePoint directory provider services
- This class inherits from Entity, so all Entity methods and properties are available for use
- The resource_path parameter should typically be left as default unless you need to target a specific custom endpoint
- Properly dispose of the context object after operations are complete to release resources
- Handle authentication errors and permission issues when working with directory services
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class Link 71.4% similar
-
class DirectorySession 70.2% similar
-
class Group_v1 68.2% similar
-
class User_v2 67.9% similar
-
class AppPrincipalIdentityProvider 67.8% similar