Query Details
// X-2 - Purview DLP match ⨯ OfficeActivity SharePoint download by same user (±30 min)
// Run in: security.microsoft.com -> Hunting -> Advanced hunting (UNIFIED PORTAL)
let dlpMatches =
MicrosoftPurviewInformationProtection
| where TimeGenerated > ago(1d)
| where isnotempty(ExecutionRuleName)
| project DlpTime=TimeGenerated, UserId, ItemName, PolicyName, ExecutionRuleName;
let spDownloads =
OfficeActivity
| where TimeGenerated > ago(1d)
| where Operation in ("FileDownloaded","FileSyncDownloadedFull","FileAccessed")
| project SpTime=TimeGenerated, UserId, OfficeObjectId, ClientIP, UserAgent;
dlpMatches
| join kind=inner spDownloads on UserId
| where SpTime between (DlpTime - 30m .. DlpTime + 30m)
| summarize Hits=count(),
DlpRules=make_set(ExecutionRuleName, 10),
Files=make_set(ItemName, 20),
SpObjects=make_set(OfficeObjectId, 20),
FirstSeen=min(DlpTime), LastSeen=max(DlpTime)
by UserId, ClientIP
| where Hits >= 5
| order by Hits desc
This query is designed to identify users who have both triggered a Data Loss Prevention (DLP) rule and downloaded files from SharePoint within a 30-minute window. Here's a simplified breakdown:
Data Collection:
MicrosoftPurviewInformationProtection table, focusing on events from the last day where a DLP rule was executed.OfficeActivity table, again from the last day, specifically looking for file download or access operations.Data Matching:
UserId, meaning it looks for instances where the same user appears in both datasets.Time Correlation:
Summarization:
Hits).Filtering and Ordering:
In essence, this query helps identify users who might be involved in suspicious activities by correlating DLP rule triggers with SharePoint downloads in a short time frame.

David Alonso
Released: May 25, 2026
Tables
Keywords
Operators