class FolderDeleteParameters
A data class that encapsulates parameters for folder deletion operations in SharePoint/Office365, inheriting from ClientValue to enable serialization for API requests.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/folders/delete_parameters.py
4 - 13
simple
Purpose
This class serves as a parameter container for folder deletion operations in the Office365 SDK. It allows clients to specify deletion behavior through three boolean flags: whether to bypass shared locks, whether to delete only if the folder is empty, and whether to match ETags for optimistic concurrency control. The class inherits from ClientValue, which provides serialization capabilities for transmitting these parameters to SharePoint REST APIs.
Source Code
class FolderDeleteParameters(ClientValue):
def __init__(self, bypass_shared_lock=None, delete_if_empty=None, etag_match=None):
"""
:param bool bypass_shared_lock:
:param bool delete_if_empty:
:param bool etag_match:
"""
self.BypassSharedLock = bypass_shared_lock
self.DeleteIfEmpty = delete_if_empty
self.ETagMatch = etag_match
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
bypass_shared_lock: Boolean flag indicating whether to bypass shared locks when deleting the folder. When True, the deletion will proceed even if the folder has shared locks. When False or None, shared locks will prevent deletion. Default is None.
delete_if_empty: Boolean flag indicating whether to delete the folder only if it is empty. When True, deletion will only succeed if the folder contains no items. When False or None, the folder will be deleted regardless of its contents. Default is None.
etag_match: Boolean flag for ETag matching to ensure optimistic concurrency control. When True, the deletion will only proceed if the ETag matches the current state of the folder, preventing conflicts from concurrent modifications. When False or None, ETag matching is not enforced. Default is None.
Return Value
Instantiation returns a FolderDeleteParameters object with three public attributes (BypassSharedLock, DeleteIfEmpty, ETagMatch) set to the provided parameter values. This object can be serialized and passed to folder deletion API methods in the Office365 SDK.
Class Interface
Methods
__init__(bypass_shared_lock=None, delete_if_empty=None, etag_match=None)
Purpose: Initializes a new FolderDeleteParameters instance with optional deletion behavior flags
Parameters:
bypass_shared_lock: Optional boolean to bypass shared locks during deletiondelete_if_empty: Optional boolean to only delete if folder is emptyetag_match: Optional boolean to enforce ETag matching for concurrency control
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
BypassSharedLock |
bool or None | Stores whether to bypass shared locks when deleting the folder | instance |
DeleteIfEmpty |
bool or None | Stores whether to delete the folder only if it is empty | instance |
ETagMatch |
bool or None | Stores whether to enforce ETag matching for optimistic concurrency control | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
from office365.sharepoint.folders.folder_delete_parameters import FolderDeleteParameters
# Create parameters to delete a folder only if empty, bypassing locks
delete_params = FolderDeleteParameters(
bypass_shared_lock=True,
delete_if_empty=True,
etag_match=False
)
# Access the attributes
print(delete_params.BypassSharedLock) # True
print(delete_params.DeleteIfEmpty) # True
print(delete_params.ETagMatch) # False
# Typically used with a folder object's delete method
# folder.delete_object(delete_params).execute_query()
Best Practices
- Always consider the implications of bypass_shared_lock=True as it may override collaborative locking mechanisms
- Use delete_if_empty=True when you want to ensure no data loss from accidental deletion of non-empty folders
- Enable etag_match=True when concurrent modifications are a concern to prevent race conditions
- All parameters are optional and default to None, allowing selective specification of deletion behavior
- This class is immutable after instantiation - create a new instance if different parameters are needed
- The class follows PascalCase naming convention for attributes (BypassSharedLock, DeleteIfEmpty, ETagMatch) to match SharePoint API conventions
- This object is typically passed to folder deletion methods in the Office365 SDK and should not be used standalone
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ListItemDeleteParameters 78.1% similar
-
class GroupCreationParams 64.7% similar
-
class ListItemUpdateParameters 63.2% similar
-
class FolderColoringInformation 62.9% similar
-
class GetListItemVersionsParameters 61.4% similar