I am trying to programmatically get list of all SharePoint (Online) site collections that are under Retention or Legal Hold.
I did some research and got to know that Retention can be configured for SharePoint using following options.
- Site Policy > Retention for entire Site
- Information Management Policy under Content Type/Library/List
- O365 Governance: Retention Policy/Label
For Site Policy, below method can be used to know if Site is under Retention
Web.HasSitePolicyApplied()
Do we have any method/API at site level that tells if there is any library/list in the site collection that has Retention set through Information Management Policy?
Also for O365 Retention, i browsed around and found article/tutorials that show how to configure Retention through Security/Compliance link. Can we programaticaly get to Retention Policy/Labels?
Thank you.