Accessing SharePoint Audit Logs Programmatically (via PnP?)

Brass Contributor



Is there a way to access the SharePoint (Online) Site Collection Audit Logs programmatically?  Seems like it's available in CSOM using SPAuditQuery(?), but I'm hoping there is a way using PnP maybe?


Many thanks for any assistance anyone can provide.

Kind regards,


2 Replies

Hi  Thanks for the reply.  I've used that for setting the auditing settings, but I mean I'd like to access the actual logs.  Ideally, there would be a Power BI content pack for it.  Having to look across 200 site collections for the logs manually isn't feasible, so I wondered if I could access the content of the logs programmatically to upload to a database for analysis/reporting etc.  Thanks again.