Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This sample shows how to retrieve and detect changes in table definitions using the RetrieveMetadataChanges Action.
You can view the sample at PowerApps-Samples/dataverse/webapi/C#-NETCore/Schema/RetrieveMetadataChanges/
See these articles for explanation of functionality:
This sample uses the common helper code in the WebAPIService class library (C#).
The following prerequisites are required to build and run this sample:
Clone or download the PowerApps-Samples repository.
Locate the /dataverse/webapi/C#-NETx/RetrieveMetadataChanges/ folder.
Open the RetrieveMetadataChanges.sln
file using Visual Studio 2022
Edit the appsettings.json
file to set the following property values:
Property | Instructions |
---|---|
Url |
The Url for your environment. Replace the placeholder https://yourorg.api.crm.dynamics.com value with the value for your environment. See View developer resources to find the Url for your environment. |
UserPrincipalName |
Replace the placeholder you@yourorg.onmicrosoft.com value with the UPN value you use to access the environment. |
Password |
Replace the placeholder yourPassword value with the password you use. |
Save the appsettings.json
file
Press F5 to run the sample.
The code for this sample is here: PowerApps-Samples/dataverse/webapi/C#-NETx/RetrieveMetadataChanges/Program.cs
This sample shows how to retrieve schema definitions for a specific set of column definitions and save them (in memory) to represent a cache.
Then it creates a new column, retrieves the data for only that new column, which it adds to the cache.
Then it deletes the column, retrieves data about deleted items and uses it to remove the deleted column definition from the cache.
This sample has six sections:
Define a query using EntityQueryExpression that returns all the Picklist choice columns from the contact table.
Query
parameter set to the query.RetrieveMetadataChangesResponse.EntityMetadata
value.RetrieveMetadataChangesResponse.ServerVersionStamp
value for use in the next request.Create a new choice column by creating a new PicklistAttributeMetadata instance in the contact table.
Query
parameter set to the original query.RetrieveMetadataChangesRequest.ClientVersionStamp
with the value previously returned from the first request.RetrieveMetadataChangesResponse.ServerVersionStamp
value for use in the next request.Delete the choice column created earlier.
Query
parameter set to the original query.RetrieveMetadataChangesRequest.ClientVersionStamp
with the value previously returned from the second request.RetrieveMetadataChangesRequest.DeletedMetadataFilters
to DeletedMetadataFilters.Attribute
because we're looking for deleted column definitions.RetrieveMetadataChangesResponse.DeletedMetadata
, using DeletedMetadataFilters.Attribute
as an index value for the collection.No clean-up is required because all data created by this sample was deleted.
Query Schema Definitions
Cache Schema data
Use the Dataverse Web API
WebAPIService class library (C#)
Web API table schema operations sample (C#)
Events
Power BI DataViz World Championships
Feb 14, 4 PM - Mar 31, 4 PM
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
Certification
Microsoft Certified: Azure Cosmos DB Developer Specialty - Certifications
Write efficient queries, create indexing policies, manage, and provision resources in the SQL API and SDK with Microsoft Azure Cosmos DB.