class ListItemComplianceInfo
A data class representing compliance information for SharePoint list items, including compliance tags and policy settings.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/listitems/compliance_info.py
4 - 21
simple
Purpose
This class encapsulates compliance-related metadata for SharePoint list items, storing information about compliance tags and various tag policy settings (event-based, hold, and record policies). It inherits from ClientValue, making it suitable for serialization and communication with SharePoint/Office 365 services. The class is used to track and manage compliance requirements and retention policies applied to list items in SharePoint environments.
Source Code
class ListItemComplianceInfo(ClientValue):
def __init__(
self,
compliance_tag=None,
tag_policy_event_based=None,
tag_policy_hold=None,
tag_policy_record=None,
):
"""
:param str compliance_tag:
:param bool tag_policy_event_based:
:param bool tag_policy_hold:
:param bool tag_policy_record:
"""
self.ComplianceTag = compliance_tag
self.TagPolicyEventBased = tag_policy_event_based
self.TagPolicyHold = tag_policy_hold
self.TagPolicyRecord = tag_policy_record
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
compliance_tag: A string identifier representing the compliance tag applied to the list item. This tag typically corresponds to a retention label or compliance policy name configured in SharePoint/Office 365. Can be None if no compliance tag is assigned.
tag_policy_event_based: A boolean flag indicating whether the compliance tag uses event-based retention. When True, the retention period starts based on a specific event (like document creation or modification) rather than a fixed date. Can be None if not applicable.
tag_policy_hold: A boolean flag indicating whether the compliance tag enforces a hold policy. When True, the list item is placed on hold and cannot be deleted or modified until the hold is released. Can be None if no hold policy is applied.
tag_policy_record: A boolean flag indicating whether the compliance tag marks the item as a record. When True, the item is treated as an official record with stricter retention and deletion policies. Can be None if the item is not designated as a record.
Return Value
Instantiation returns a ListItemComplianceInfo object with four instance attributes (ComplianceTag, TagPolicyEventBased, TagPolicyHold, TagPolicyRecord) set to the provided parameter values. The object inherits from ClientValue, which provides serialization capabilities for communication with Office 365 services.
Class Interface
Methods
__init__(self, compliance_tag=None, tag_policy_event_based=None, tag_policy_hold=None, tag_policy_record=None)
Purpose: Initializes a new instance of ListItemComplianceInfo with compliance tag and policy settings
Parameters:
compliance_tag: String identifier for the compliance tag (default: None)tag_policy_event_based: Boolean indicating if event-based retention is enabled (default: None)tag_policy_hold: Boolean indicating if hold policy is active (default: None)tag_policy_record: Boolean indicating if item is marked as a record (default: None)
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
ComplianceTag |
str or None | The compliance tag identifier applied to the list item | instance |
TagPolicyEventBased |
bool or None | Flag indicating whether event-based retention policy is enabled | instance |
TagPolicyHold |
bool or None | Flag indicating whether the item is under a hold policy | instance |
TagPolicyRecord |
bool or None | Flag indicating whether the item is designated as an official record | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
from office365.sharepoint.listitems.compliance_info import ListItemComplianceInfo
# Create compliance info for a list item with a retention label
compliance_info = ListItemComplianceInfo(
compliance_tag="Financial Records - 7 Years",
tag_policy_event_based=True,
tag_policy_hold=False,
tag_policy_record=True
)
# Access the compliance properties
print(f"Compliance Tag: {compliance_info.ComplianceTag}")
print(f"Event-based: {compliance_info.TagPolicyEventBased}")
print(f"On Hold: {compliance_info.TagPolicyHold}")
print(f"Is Record: {compliance_info.TagPolicyRecord}")
# Create compliance info with minimal settings
basic_compliance = ListItemComplianceInfo(compliance_tag="Standard Retention")
# Modify compliance settings after instantiation
compliance_info.TagPolicyHold = True
Best Practices
- Initialize all parameters explicitly when creating instances to ensure clarity about compliance settings
- Use None values for optional parameters rather than False to distinguish between 'not set' and 'explicitly disabled'
- This class is typically used as part of larger SharePoint list item operations and should be populated with data retrieved from or sent to SharePoint services
- The class inherits from ClientValue, which means it's designed for serialization - avoid adding complex objects or methods that can't be serialized
- Attribute names use PascalCase (ComplianceTag) following SharePoint API conventions, even though Python typically uses snake_case
- When integrating with SharePoint, ensure the compliance tags referenced exist in the SharePoint tenant's compliance center
- This is a data transfer object (DTO) - it holds data but doesn't contain business logic or validation
- All attributes are public and can be modified after instantiation, but changes should align with SharePoint compliance policies
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class ComplianceTagInfo 80.5% similar
-
class ComplianceTag 78.7% similar
-
class PendingReviewItemsStatistics 71.0% similar
-
class ListItemCreationInformation 70.8% similar
-
class ListItemCreationInformationUsingPath 67.2% similar