Forum Discussion
Monitor the documents that got deleted or are near deletion as part of a site retention policy?
1. Enable audit logging:
Log in to the SharePoint Administrator Center and navigate to Advanced > Audit Log Settings to enable auditing of document deletions and modifications.
Configure the audit log retention policy to ensure that the logs are kept for a long enough period of time.
2. Use retention policies:
Create a retention policy in the Microsoft 365 Compliance Center, selecting the SharePoint site as the target.
Set the retention period and deletion action, and enable the Notify Before Deletion feature.
3. View audit logs:
In the SharePoint Administrator Center, navigate to Audit Log Search.
Select the time range, user, and activity type (File Deletion) to view the relevant logs.
Use a PowerShell script:
Use SharePoint Online Management Shell to query for deleted documents:
powershell
Connect-SPOService -Url https://<yourdomain>-admin.sharepoint.com
Get-SPODeletedSite | Select-Object Title, DeletedBy, DeletedDate
Queries the documents to be deleted (based on retention policy):
powershell
Get-SPOSite -Identity https://<yourdomain>.sharepoint.com/sites/<yoursite> | Get-SPOListItem -List “Documents” | Where-Object { $_. RetentionLabel -eq “Near Deletion” }
4. Configure the alert:
In the SharePoint site, navigate to Document Library > Settings > Alerts.
Create a new alert, select the Delete action, and set the notification method (email).
5. Contact Microsoft Support:
If the issue remains unresolved, submit a support request through the Microsoft 365 Administrator Center with detailed error messages and screenshots.