class DlpPolicyTip
A class representing Data Loss Protection (DLP) policy information for SharePoint items, providing details about policy restrictions, compliance, and matched conditions.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/policy/dlp_policy_tip.py
5 - 41
simple
Purpose
DlpPolicyTip is a data entity class that encapsulates information about Data Loss Protection policies applied to SharePoint items. It provides read-only access to policy tip details including applied actions, compliance URLs, matched policy conditions, override options, and language settings. This class is used to display DLP policy information to users in SharePoint interfaces, helping them understand what restrictions have been applied and why.
Source Code
class DlpPolicyTip(Entity):
"""Provides information about the Data Loss Protection policy on an item so it can be shown to the user."""
@property
def applied_actions_text(self):
"""Specifies the text which states what restrictive actions have been applied to this item."""
return self.properties.get("AppliedActionsText", None)
@property
def compliance_url(self):
"""Specifies the URL that provides additional help on the policy tip dialog."""
return self.properties.get("ComplianceUrl", None)
@property
def general_text(self):
"""General text that appears on the top of the policy tip dialog."""
return self.properties.get("GeneralText", None)
@property
def last_processed_time(self):
"""The last time this item was processed for policy matches."""
return self.properties.get("LastProcessedTime", None)
@property
def matched_condition_descriptions(self):
"""An array that contains a description of each policy condition that has been matched."""
return self.properties.get("MatchedConditionDescriptions", StringCollection())
@property
def override_options(self):
"""The allowable options that someone can take to override policy matches."""
return self.properties.get("OverrideOptions", None)
@property
def two_letter_iso_language_name(self):
"""The two-letter language code of the generated policy tip detail."""
return self.properties.get("TwoLetterISOLanguageName", None)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
bases: Inherits from Entity class, which provides the underlying properties dictionary and base entity functionality for SharePoint objects
Return Value
Instantiation returns a DlpPolicyTip object that provides property-based access to DLP policy information. All properties return values from the internal properties dictionary, with specific types: strings for text fields, StringCollection for matched conditions, and None as default when properties are not set.
Class Interface
Methods
@property applied_actions_text(self) -> str | None
property
Purpose: Returns the text describing what restrictive actions have been applied to the item due to DLP policies
Returns: String containing the applied actions text, or None if not set
@property compliance_url(self) -> str | None
property
Purpose: Returns the URL that provides additional help and information about the DLP policy
Returns: String containing the compliance URL, or None if not set
@property general_text(self) -> str | None
property
Purpose: Returns the general informational text that appears at the top of the policy tip dialog
Returns: String containing the general policy tip text, or None if not set
@property last_processed_time(self) -> str | None
property
Purpose: Returns the timestamp when the item was last processed for DLP policy matches
Returns: String or datetime representing the last processing time, or None if not set
@property matched_condition_descriptions(self) -> StringCollection
property
Purpose: Returns an array containing descriptions of each DLP policy condition that has been matched
Returns: StringCollection containing descriptions of matched conditions, or empty StringCollection if none matched
@property override_options(self) -> str | None
property
Purpose: Returns the allowable options that a user can take to override the DLP policy matches
Returns: String or object describing override options, or None if not set
@property two_letter_iso_language_name(self) -> str | None
property
Purpose: Returns the two-letter ISO language code indicating the language of the generated policy tip details
Returns: Two-letter ISO language code string (e.g., 'en', 'fr'), or None if not set
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
properties |
dict | Inherited from Entity base class, stores the underlying property values retrieved from SharePoint | instance |
Dependencies
office365.runtime.types.collectionsoffice365.sharepoint.entity
Required Imports
from office365.runtime.types.collections import StringCollection
from office365.sharepoint.entity import Entity
Usage Example
from office365.sharepoint.entity import Entity
from office365.runtime.types.collections import StringCollection
from office365.sharepoint.dlp_policy_tip import DlpPolicyTip
# Typically retrieved from SharePoint context, not instantiated directly
# Example: Getting DLP policy tip from a list item
ctx = ClientContext(site_url).with_credentials(credentials)
list_item = ctx.web.lists.get_by_title('Documents').items.get_by_id(1)
list_item.expand(['DlpPolicyTip']).get().execute_query()
dlp_tip = list_item.properties.get('DlpPolicyTip')
if dlp_tip:
# Access policy information
general_text = dlp_tip.general_text
applied_actions = dlp_tip.applied_actions_text
compliance_url = dlp_tip.compliance_url
matched_conditions = dlp_tip.matched_condition_descriptions
override_opts = dlp_tip.override_options
language = dlp_tip.two_letter_iso_language_name
last_processed = dlp_tip.last_processed_time
print(f'Policy: {general_text}')
print(f'Actions: {applied_actions}')
print(f'Matched conditions: {len(matched_conditions)}')
Best Practices
- This class is typically not instantiated directly but retrieved from SharePoint items through the Office365 REST API
- All properties are read-only and return None if the corresponding data is not available
- The matched_condition_descriptions property returns an empty StringCollection if no conditions are matched
- Always check if properties return None before using them to avoid AttributeError
- This class is part of the Office365-REST-Python-Client library and requires proper SharePoint authentication
- DLP policy tips are only available on items that have been processed by SharePoint's DLP engine
- The last_processed_time property indicates when the item was last evaluated against DLP policies
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class DlpClassificationResult 64.0% similar
-
class ListItemComplianceInfo 60.8% similar
-
class PolicyEvaluationInfo 59.8% similar
-
class PendingReviewItemsStatistics 56.0% similar
-
class DataPolicyOperation 55.8% similar