class CalendarRoleType
An enumeration-style class that defines calendar role types and permission levels for calendar sharing in a calendar management system.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/outlook/calendar/role_type.py
1 - 29
simple
Purpose
CalendarRoleType serves as a constants container that defines different permission levels for calendar access and sharing. It provides integer constants representing various roles from no access to full delegate access with private event visibility. This class is typically used to check or set user permissions when sharing calendars, determining what level of access a user has to another user's calendar events.
Source Code
class CalendarRoleType:
def __init__(self):
pass
none = 0
"""Calendar is not shared with the user."""
freeBusyRead = 1
"""User is a sharee who can view free/busy status of the owner on the calendar."""
limitedRead = 2
"""User is a sharee who can view free/busy status, and titles and locations of the events on the calendar."""
read = 3
"""User is a sharee who can view all the details of the events on the calendar, except for the owner's private
events."""
write = 4
"""User is a sharee who can view all the details (except for private events) and edit events on the calendar."""
delegateWithoutPrivateEventAccess = 5
"""User is a delegate who has write access but cannot view information of the owner's private events on the
calendar."""
delegateWithPrivateEventAccess = 6
"""User is a delegate who has write access and can view information of the owner's private events on the calendar"""
custom = 7
"""User has custom permissions to the calendar."""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
- | - |
Parameter Details
__init__: The constructor takes no parameters and performs no initialization. It exists only to allow instantiation of the class, though the class is primarily used for its class-level constants rather than instances.
Return Value
Instantiation returns a CalendarRoleType object with no instance-specific state. The class is designed to be used primarily through its class-level integer constants (none, freeBusyRead, limitedRead, read, write, delegateWithoutPrivateEventAccess, delegateWithPrivateEventAccess, custom) which represent different permission levels.
Class Interface
Methods
__init__(self)
Purpose: Initializes a CalendarRoleType instance with no state
Returns: None - constructor returns a CalendarRoleType instance
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
none |
int | Value 0 - Calendar is not shared with the user, no access permissions | class |
freeBusyRead |
int | Value 1 - User can view only free/busy status of the owner on the calendar | class |
limitedRead |
int | Value 2 - User can view free/busy status, titles, and locations of events on the calendar | class |
read |
int | Value 3 - User can view all event details except the owner's private events | class |
write |
int | Value 4 - User can view all details (except private events) and edit events on the calendar | class |
delegateWithoutPrivateEventAccess |
int | Value 5 - User is a delegate with write access but cannot view the owner's private events | class |
delegateWithPrivateEventAccess |
int | Value 6 - User is a delegate with write access and can view the owner's private events | class |
custom |
int | Value 7 - User has custom permissions to the calendar | class |
Usage Example
# Access class constants directly without instantiation
if user_role == CalendarRoleType.read:
print("User can view all event details except private events")
# Set calendar permission level
calendar_permission = CalendarRoleType.write
# Check permission level
if calendar_permission >= CalendarRoleType.write:
allow_event_editing()
# Compare permission levels
if user_permission > CalendarRoleType.freeBusyRead:
show_event_details()
# Use in permission checking function
def can_view_private_events(role_type):
return role_type == CalendarRoleType.delegateWithPrivateEventAccess
# Instantiation (though not typically necessary)
role_type_instance = CalendarRoleType()
print(role_type_instance.read) # Outputs: 3
Best Practices
- Use the class constants directly without instantiating the class (e.g., CalendarRoleType.read instead of creating an instance)
- The integer values are ordered by permission level, allowing for comparison operations (e.g., role >= CalendarRoleType.write)
- Consider using Python's enum.IntEnum instead for better type safety and IDE support in modern implementations
- The constants are immutable and should never be modified at runtime
- Use these constants consistently throughout your codebase for calendar permission checks to maintain clarity
- Document which permission level is required for each calendar operation in your application
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class RoleType 70.9% similar
-
class CalendarType 63.4% similar
-
class CalendarPermission 63.3% similar
-
class Role 62.5% similar
-
class CalendarPermissionCollection 61.0% similar