class DenyAddAndCustomizePagesStatus
An enumeration class that defines constants representing the status of the DenyAddAndCustomizePages feature on a SharePoint site collection.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/deny_add_and_customize_pages_status.py
1 - 11
simple
Purpose
This class serves as an enumeration to represent three possible states of the DenyAddAndCustomizePages feature in SharePoint: Unknown (0), Disabled (1), and Enabled (2). It provides a type-safe way to work with these status values throughout an application that interacts with SharePoint site collections. The DenyAddAndCustomizePages feature controls whether users can add or customize pages in a SharePoint site.
Source Code
class DenyAddAndCustomizePagesStatus:
"""Represents the status of DenyAddAndCustomizePages on a site collection."""
Unknown = 0
"""The status of a site collectionâs [DenyAddAndCustomizePages] is unknown."""
Disabled = 1
"""The status of a site collection where the [DenyAddAndCustomizePages] feature has been disabled."""
Enabled = 2
"""The status of a site collection where the [DenyAddAndCustomizePages] feature has been enabled."""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
- | - |
Parameter Details
bases: This class does not have an __init__ method and does not accept any initialization parameters. It is designed as a static enumeration class with class-level constants.
Return Value
Instantiating this class returns a DenyAddAndCustomizePagesStatus object, though it is intended to be used by accessing its class-level constants (Unknown, Disabled, Enabled) rather than creating instances. The constants return integer values: 0 for Unknown, 1 for Disabled, and 2 for Enabled.
Class Interface
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Unknown |
int | Represents an unknown status of the DenyAddAndCustomizePages feature. Value is 0. | class |
Disabled |
int | Represents that the DenyAddAndCustomizePages feature is disabled, allowing users to add and customize pages. Value is 1. | class |
Enabled |
int | Represents that the DenyAddAndCustomizePages feature is enabled, preventing users from adding and customizing pages. Value is 2. | class |
Usage Example
# Access the enumeration constants
status = DenyAddAndCustomizePagesStatus.Unknown
print(status) # Output: 0
# Check status value
if status == DenyAddAndCustomizePagesStatus.Disabled:
print("Feature is disabled")
elif status == DenyAddAndCustomizePagesStatus.Enabled:
print("Feature is enabled")
else:
print("Status is unknown")
# Use in a function
def check_site_customization(status_code):
if status_code == DenyAddAndCustomizePagesStatus.Enabled:
return "Customization is blocked"
elif status_code == DenyAddAndCustomizePagesStatus.Disabled:
return "Customization is allowed"
return "Status unknown"
result = check_site_customization(DenyAddAndCustomizePagesStatus.Disabled)
print(result) # Output: Customization is allowed
Best Practices
- Use the class constants directly rather than instantiating the class (e.g., DenyAddAndCustomizePagesStatus.Enabled)
- Compare status values using the class constants for type safety and readability instead of raw integers
- Consider using Python's enum.Enum or enum.IntEnum for more robust enumeration behavior in production code
- Document the meaning of each status value when using them in your code for clarity
- This class is immutable by design - do not attempt to modify the class-level constants
- When storing or transmitting status values, use the integer values (0, 1, 2) and convert back to constants when needed
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class CustomizedPageStatus 75.0% similar
-
class SiteStatus 72.6% similar
-
class PageType 63.6% similar
-
class SharingOperationStatusCode 60.0% similar
-
class RoleType 59.3% similar