class PageType
An enumeration class that defines constants representing different SharePoint page types as specified in the MS-WSSFO3 protocol specification.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/pages/page_type.py
1 - 41
simple
Purpose
This class serves as a constant container for SharePoint page type identifiers. It provides named constants for various page types including list views, forms (display, edit, new), and dialog variations. These constants are used to identify and categorize different types of SharePoint pages according to the Microsoft SharePoint protocol specification [MS-WSSFO3] section 2.2.1.2.14. The class is designed to be instantiated but primarily serves as a namespace for accessing these integer constants.
Source Code
class PageType:
def __init__(self):
"""As specified in [MS-WSSFO3] section 2.2.1.2.14."""
pass
Invalid = -1
"""Specifies a page that does not correspond to a list view or a list form."""
DefaultView = 0
"""Specifies a page that is the default view for a list."""
NormalView = 1
"""Specifies a page that is a list view and is not the default view for a list."""
DialogView = 2
"""Specifies a page that can be displayed within a dialog box on a client computer."""
View = 3
"""Specifies a page that is a list view."""
DisplayForm = 4
DisplayFormDialog = 5
EditForm = 6
EditFormDialog = 7
NewForm = 8
"""Specifies a list form for creating a new list item."""
NewFormDialog = 9
"""Specifies a list form for creating a new list item that can be displayed within a dialog box on a client
computer."""
SolutionForm = 10
"""Specifies a list form that is represented by a form template (.xsn) file and is used for displaying or editing
a list item."""
PAGE_MAXITEMS = 11
"""Represents the total number of valid page types."""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
- | - |
Parameter Details
__init__: The constructor takes no parameters and performs no initialization. It exists to allow instantiation of the class, though the class is primarily used for accessing its class-level constants.
Return Value
Instantiation returns a PageType object. The object itself has no instance state, but provides access to class-level integer constants representing different SharePoint page types. Each constant is an integer value ranging from -1 (Invalid) to 11 (PAGE_MAXITEMS).
Class Interface
Methods
__init__(self) -> None
Purpose: Initializes a PageType instance. No initialization logic is performed.
Returns: None. Creates an instance of PageType with no instance attributes.
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Invalid |
int | Specifies a page that does not correspond to a list view or a list form. Value: -1 | class |
DefaultView |
int | Specifies a page that is the default view for a list. Value: 0 | class |
NormalView |
int | Specifies a page that is a list view and is not the default view for a list. Value: 1 | class |
DialogView |
int | Specifies a page that can be displayed within a dialog box on a client computer. Value: 2 | class |
View |
int | Specifies a page that is a list view. Value: 3 | class |
DisplayForm |
int | Specifies a list form for displaying a list item. Value: 4 | class |
DisplayFormDialog |
int | Specifies a list form for displaying a list item within a dialog box. Value: 5 | class |
EditForm |
int | Specifies a list form for editing a list item. Value: 6 | class |
EditFormDialog |
int | Specifies a list form for editing a list item within a dialog box. Value: 7 | class |
NewForm |
int | Specifies a list form for creating a new list item. Value: 8 | class |
NewFormDialog |
int | Specifies a list form for creating a new list item that can be displayed within a dialog box on a client computer. Value: 9 | class |
SolutionForm |
int | Specifies a list form that is represented by a form template (.xsn) file and is used for displaying or editing a list item. Value: 10 | class |
PAGE_MAXITEMS |
int | Represents the total number of valid page types. Value: 11 | class |
Usage Example
# Instantiate the class (optional, can access constants directly)
page_type = PageType()
# Access page type constants
if current_page == PageType.DefaultView:
print("This is the default view")
# Check if page is a form
if current_page in [PageType.DisplayForm, PageType.EditForm, PageType.NewForm]:
print("This is a form page")
# Use dialog view constant
dialog_type = PageType.DialogView
print(f"Dialog view type: {dialog_type}") # Output: 2
# Check for invalid page
if page_id == PageType.Invalid:
print("Invalid page type")
# Get maximum page types count
max_types = PageType.PAGE_MAXITEMS
print(f"Total valid page types: {max_types}") # Output: 11
Best Practices
- This class is designed as a constant container and does not require instantiation to access its values. You can access constants directly via the class name (e.g., PageType.DefaultView).
- The class follows the MS-WSSFO3 protocol specification, so the constant values should not be modified.
- Use these constants instead of hardcoded integers when working with SharePoint page types to improve code readability and maintainability.
- The Invalid constant (-1) should be used to represent pages that don't correspond to list views or forms.
- PAGE_MAXITEMS (11) represents the total count of valid page types and can be used for validation or iteration purposes.
- When checking page types, consider grouping related types (e.g., all dialog types, all form types) for cleaner conditional logic.
- The class has no instance state or methods that modify state, making it thread-safe for concurrent access.
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class CalendarType 75.1% similar
-
class SiteType 73.5% similar
-
class ViewType 72.2% similar
-
class TemplateFileType 71.3% similar
-
class BaseType 70.0% similar