class AppIdPath
A specialized ResourcePath subclass for constructing OData-style path segments that address Azure Service Principals or Applications using their appId (Application/client ID).
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/paths/appid.py
4 - 14
simple
Purpose
This class provides a specific path formatting mechanism for Microsoft Graph API or Azure AD operations where resources need to be addressed by their Application ID (appId) rather than by object ID. It generates OData filter-style path segments in the format '(appId='value')' which is commonly used in Microsoft Graph API endpoints to query or access Service Principals and Applications by their client ID.
Source Code
class AppIdPath(ResourcePath):
"""Path for addressing a Service Principal or Application by appId where
appId is referred to as Application (client) ID on the Azure portal"""
@property
def segment(self):
return "(appId='{0}')".format(self._key)
@property
def delimiter(self):
return None
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ResourcePath | - |
Parameter Details
_key: The appId (Application/client ID) value that will be used to construct the path segment. This is inherited from the parent ResourcePath class and is passed during instantiation. It should be a valid GUID string representing an Azure Application or Service Principal's client ID.
Return Value
Instantiation returns an AppIdPath object that can be used to construct resource paths. The segment property returns a formatted string in the format '(appId='<appId_value>')'. The delimiter property returns None, indicating no delimiter should be used when combining path segments.
Class Interface
Methods
@property segment(self) -> str
property
Purpose: Returns the formatted OData-style path segment containing the appId filter expression
Returns: A string in the format '(appId='<appId_value>')' where <appId_value> is the Application ID provided during instantiation
@property delimiter(self) -> None
property
Purpose: Returns the delimiter to be used when combining this path segment with others
Returns: None, indicating no delimiter should be used for this path segment type
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
_key |
str | Stores the appId (Application/client ID) value. Inherited from ResourcePath parent class. Used to construct the path segment. | instance |
Dependencies
office365
Required Imports
from office365.runtime.paths.resource_path import ResourcePath
Usage Example
from office365.runtime.paths.resource_path import ResourcePath
from office365.runtime.paths.app_id_path import AppIdPath
# Create a path for a Service Principal using its appId
app_id = '12345678-1234-1234-1234-123456789abc'
path = AppIdPath(app_id)
# Get the formatted segment
segment = path.segment
print(segment) # Output: (appId='12345678-1234-1234-1234-123456789abc')
# Check the delimiter
delimiter = path.delimiter
print(delimiter) # Output: None
# Typically used in conjunction with Microsoft Graph API client
# Example: client.service_principals.get_by_path(AppIdPath(app_id))
Best Practices
- Always provide a valid GUID string as the appId parameter when instantiating this class
- This class is typically used internally by Microsoft Graph API client libraries rather than directly by end users
- The appId should correspond to an actual Application or Service Principal in Azure AD
- Use this class when you need to query or access resources by Application ID rather than Object ID
- The generated path segment follows OData filter syntax conventions used by Microsoft Graph API
- This class is immutable once created - the appId cannot be changed after instantiation
- The delimiter property returning None indicates this path segment should not have separators when combined with other path components
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ApplicationServicePrincipal 63.1% similar
-
class ServicePrincipal 60.2% similar
-
class Application 59.0% similar
-
class AppIdentity 58.5% similar
-
class EntityPath 57.8% similar