class SPWOPIFrameAction
An enumeration class that defines distinct WOPI (Web Application Open Platform Interface Protocol) frame action types for SharePoint list items.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/utilities/wopi_frame_action.py
1 - 10
simple
Purpose
This class serves as a constant enumeration to specify the type of operation to be performed on a SharePoint list item through the WOPI protocol. It provides two distinct action types: View (for read-only browser-based viewing) and Edit (for browser-based editing). This is typically used when integrating with SharePoint's WOPI framework to determine how documents or list items should be opened in a browser.
Source Code
class SPWOPIFrameAction:
"""
Specifies distinct operations that are available for the list item.
"""
View = 0
"""Requests a browser-based viewing experience."""
Edit = 1
"""Requests a browser-based editing experience."""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
- | - |
Parameter Details
bases: This class does not have explicit __init__ parameters. It inherits from the default object base class and serves as a container for class-level constants.
Return Value
Instantiating this class returns an SPWOPIFrameAction object, though it is designed to be used as a static enumeration rather than being instantiated. The class attributes (View and Edit) return integer values (0 and 1 respectively) that represent different WOPI frame actions.
Class Interface
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
View |
int | Constant value (0) that requests a browser-based viewing experience for read-only access to the list item | class |
Edit |
int | Constant value (1) that requests a browser-based editing experience for modifying the list item | class |
Usage Example
# Using SPWOPIFrameAction as an enumeration
# Typically used without instantiation
# Check which action to perform
action_type = SPWOPIFrameAction.View
if action_type == SPWOPIFrameAction.View:
print("Opening in view mode")
# Open document in read-only mode
elif action_type == SPWOPIFrameAction.Edit:
print("Opening in edit mode")
# Open document in edit mode
# Using in a function parameter
def open_sharepoint_document(document_id, action):
if action == SPWOPIFrameAction.View:
return f"Viewing document {document_id}"
elif action == SPWOPIFrameAction.Edit:
return f"Editing document {document_id}"
result = open_sharepoint_document("doc123", SPWOPIFrameAction.Edit)
print(result) # Output: Editing document doc123
Best Practices
- Use this class as a static enumeration; do not instantiate it with SPWOPIFrameAction()
- Access the action types directly via class attributes: SPWOPIFrameAction.View or SPWOPIFrameAction.Edit
- Use these constants when working with SharePoint WOPI protocol implementations to ensure consistent action type values
- Consider using Python's enum.Enum for more robust enumeration if extending this functionality
- These integer values (0 and 1) are likely part of a protocol specification and should not be modified
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class SPWOPIAction 87.1% similar
-
class WopiWebAppProperties 61.5% similar
-
class WopiProperties 59.8% similar
-
class PageType 57.3% similar
-
class SpoOperation 52.1% similar