Recently I wanted to query Audit data from the web browser client and learned no native REST api was available. So I created one. Below is a demonstration video and link to the full source code.
This web API enables us to execute the server object model SPAuditQuery() method from HTTP POST and provide optional filter parameters. More filters give a narrow match and faster server response. We want to be specific, even if only a default time range (example – past 30 days) to improve user experience and reduce system load.
I created an online service at https://spjeff.azurewebsites.net/ which generates a MVC WebAPI 2.2 project with the name you enter. A custom ZIP file is generated server side with your custom name for the Project, Namespaces, Assembly, and sent to the browser for download. Best practices are already enabled such as:
Minimal packages and dependency
Zero MVC boilerplate
Lean mean API ready for dev & prod
From there double click SLN and begin coding. Enjoy!
Given a filter value, this PowerShell function will query Active Directory to find a matching user object and store results in a memory cache. By default “samAccountName” is used for filter. Optional field name can be provided to filter by any field such as Manager, Mail, or DN.