class SharingOperationStatusCode
An enumeration-style class that defines integer status codes representing various outcomes of SharePoint sharing operations.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/operation_status_code.py
1 - 47
simple
Purpose
This class serves as a constants container (similar to an enum) for SharePoint sharing operation status codes. It provides standardized integer values to represent success, partial success, and various failure conditions when sharing SharePoint resources like documents, lists, or sites. These codes help applications interpret and handle the results of sharing operations programmatically, enabling proper error handling and user feedback.
Source Code
class SharingOperationStatusCode:
"""Contains values representing the overall result of a sharing operation."""
CompletedSuccessfully = 0
"""Indicates the share operation completed without errors."""
AccessRequestsQueued = 1
"""Indicates the share operation completed and generated requests for access."""
NoResolvedUsers = -1
"""Indicates the share operation failed as there were no resolved users."""
AccessDenied = -2
"""Indicates the share operation failed due to insufficient permissions."""
CrossSiteRequestNotSupported = -3
"""Indicates the share operation failed when attempting a cross-site share, which is not supported."""
UnknownError = -4
"""Indicates the sharing operation failed due to an unknown error."""
EmailBodyTooLong = -5
"""The email body text is too long."""
ListUniqueScopesExceeded = -6
"""The maximum number of unique security scopes in the list has been exceeded."""
CapabilityDisabled = -7
"""The share operation failed because a sharing capability is disabled in the site."""
ObjectNotSupported = -8
"""The specified object for the share operation is not supported."""
NestedGroupsNotSupported = -9
"""A SharePoint group cannot contain another SharePoint group."""
QuotaExceeded = -10
"""A SharePoint Quota limit exceeded. (eg. group, site, file storage, etc)."""
InvalidValue = -11
"""A SharePoint invalid value."""
UserDoesNotExist = -12
"""User does not exist."""
TooManyChildItemsWithUniqueScopes = -13
"""The share operation failed because the target object has too many child list items with unique security scopes"""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
- | - |
Parameter Details
bases: This parameter refers to base classes for inheritance. Since this is a simple constants class with no explicit base classes defined beyond the implicit 'object', no special base classes are used.
Return Value
Instantiating this class returns a SharingOperationStatusCode object, though in practice this class is typically used by accessing its class-level integer constants directly (e.g., SharingOperationStatusCode.CompletedSuccessfully) rather than creating instances.
Class Interface
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
CompletedSuccessfully |
int | Status code 0 indicating the share operation completed without errors | class |
AccessRequestsQueued |
int | Status code 1 indicating the share operation completed and generated requests for access | class |
NoResolvedUsers |
int | Status code -1 indicating the share operation failed as there were no resolved users | class |
AccessDenied |
int | Status code -2 indicating the share operation failed due to insufficient permissions | class |
CrossSiteRequestNotSupported |
int | Status code -3 indicating the share operation failed when attempting a cross-site share, which is not supported | class |
UnknownError |
int | Status code -4 indicating the sharing operation failed due to an unknown error | class |
EmailBodyTooLong |
int | Status code -5 indicating the email body text is too long | class |
ListUniqueScopesExceeded |
int | Status code -6 indicating the maximum number of unique security scopes in the list has been exceeded | class |
CapabilityDisabled |
int | Status code -7 indicating the share operation failed because a sharing capability is disabled in the site | class |
ObjectNotSupported |
int | Status code -8 indicating the specified object for the share operation is not supported | class |
NestedGroupsNotSupported |
int | Status code -9 indicating a SharePoint group cannot contain another SharePoint group | class |
QuotaExceeded |
int | Status code -10 indicating a SharePoint Quota limit exceeded (e.g., group, site, file storage, etc) | class |
InvalidValue |
int | Status code -11 indicating a SharePoint invalid value | class |
UserDoesNotExist |
int | Status code -12 indicating user does not exist | class |
TooManyChildItemsWithUniqueScopes |
int | Status code -13 indicating the share operation failed because the target object has too many child list items with unique security scopes | class |
Usage Example
# Access status codes directly from the class (no instantiation needed)
status = SharingOperationStatusCode.CompletedSuccessfully
if status == 0:
print("Sharing completed successfully")
# Check for specific error conditions
def handle_sharing_result(status_code):
if status_code == SharingOperationStatusCode.CompletedSuccessfully:
return "Share operation succeeded"
elif status_code == SharingOperationStatusCode.AccessDenied:
return "Access denied - insufficient permissions"
elif status_code == SharingOperationStatusCode.UserDoesNotExist:
return "User not found"
elif status_code == SharingOperationStatusCode.UnknownError:
return "An unknown error occurred"
else:
return f"Operation failed with code: {status_code}"
# Example usage in a sharing operation
result_code = perform_share_operation() # hypothetical function
message = handle_sharing_result(result_code)
print(message)
Best Practices
- Use the class constants directly without instantiating the class (e.g., SharingOperationStatusCode.CompletedSuccessfully)
- Compare status codes using equality checks (==) rather than identity checks (is)
- Positive values (0, 1) indicate success or partial success, while negative values indicate various failure conditions
- Always handle the UnknownError case as a fallback in error handling logic
- Consider using a dictionary or match/case statement to map status codes to user-friendly messages
- This class follows a constants pattern rather than a true Python Enum; consider using Python's enum.IntEnum for type safety in new code
- Document which status codes your application expects to handle when integrating with SharePoint APIs
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class SiteStatus 71.2% similar
-
class SharingCapabilities 66.9% similar
-
class ExternalSharingSiteOption 65.3% similar
-
class SharingAbilityStatus 61.9% similar
-
class DenyAddAndCustomizePagesStatus 60.0% similar