🔍 Code Extractor

class DenyAddAndCustomizePagesStatus

Maturity: 43

An enumeration class that defines constants representing the status of the DenyAddAndCustomizePages feature on a SharePoint site collection.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/deny_add_and_customize_pages_status.py
Lines:
1 - 11
Complexity:
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

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class CustomizedPageStatus 75.0% similar

    An enumeration class that defines constants representing the customization (ghost) status of SharePoint files (SPFile).

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/pages/customized_page_status.py
  • class SiteStatus 72.6% similar

    An enumeration-style class that defines status codes for modern SharePoint sites, representing different states during site lifecycle.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/portal/sites/status.py
  • class PageType 63.6% similar

    An enumeration class that defines constants representing different SharePoint page types as specified in the MS-WSSFO3 protocol specification.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/pages/page_type.py
  • class SharingOperationStatusCode 60.0% similar

    An enumeration-style class that defines integer status codes representing various outcomes of SharePoint sharing operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/sharing/operation_status_code.py
  • class RoleType 59.3% similar

    An enumeration class that defines SharePoint role types with integer constants representing different permission levels for users and groups.

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