Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.97 KB

File metadata and controls

51 lines (35 loc) · 1.97 KB
title description ms.date author ms.author ms.reviewer ms.topic search.audienceType contributors
Sample: Audit user access (Microsoft Dataverse) | Microsoft Docs
This sample shows how to audit user access
04/03/2022
paulliew
paulliew
jdaly
sample
developer
JimDaly
phecke

Sample: Audit user access

This sample code shows how to audit user access.

[!div class="nextstepaction"] SDK for .NET: Audit user access sample code

How to run this sample

[!includecc-how-to-run-samples]

What this sample does

This sample first enables user access auditing with the logged on user's organization. Next, it creates and modifies an account table so that audit records are generated.

How this sample works

In order to simulate the scenario described in What this sample does, the sample will do the following:

Setup

  1. Checks for the current version of the org.
  2. Creates a new account table and enables auditing on the new account table.

Demonstrate

  1. Gets the organization's ID from the system user record and retrieves organization record.
  2. Enables auditing on the organization, including auditing for user access.
  3. Makes an update request to the account table to be tracked by auditing.
  4. set the organization and account auditing flags back to old values and retrieve them if they were actually changed.

Clean up

Display an option to delete the records created during Setup. The deletion is optional in case you want to examine the tables and data created by the sample. You can manually delete the records to achieve the same result.

[!INCLUDEfooter-include]