🔍 Code Extractor

class SharePointDirectoryProvider

Maturity: 34

A SharePoint directory provider entity class that represents the SP.Directory.Provider.SharePointDirectoryProvider resource in SharePoint's REST API.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/provider/provider.py
Lines:
5 - 15
Complexity:
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 communication
  • resource_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

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class Link 71.4% similar

    A SharePoint Link entity class that represents a directory link object in SharePoint, inheriting from the Entity base class.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/link.py
  • class DirectorySession 70.2% similar

    DirectorySession is a SharePoint directory service class that provides access to user information and graph data within a SharePoint context.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/session.py
  • class Group_v1 68.2% similar

    Represents a SharePoint Directory Group entity that provides methods to retrieve group members, owners, and member information with lazy loading support.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/group.py
  • class User_v2 67.9% similar

    Represents a SharePoint Directory User entity with methods to check group membership and retrieve user's groups.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/directory/user.py
  • class AppPrincipalIdentityProvider 67.8% similar

    A class representing an identity provider for app principals in SharePoint, inheriting from the Entity base class.

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