How to append properties to User.AppMetadata?

Please include the following information in your post:

  • Which SDK this is regarding: e.g. Auth0.ManagementApi .Net SDK
  • SDK Version: 7.8.0
  • Platform Version: .Net Core 3.x

I’m using the .Net Management API and I need to update a user’s AppMetadata dynamic object. Is there a code sample of how I would append/replace/remove values? It’s pretty straightforward to set an initial value, but I want to retain the properties that are already there. Thank you!

Hey there!

Unfortunately I’m not a .Net expert but I did some research here:

https://auth0.github.io/auth0.net/

and also our Management API Explorer here: Auth0 Management API v2

you should be able to have a specific function for that when you type in your IDE something like:

var apiClient = new ManagementApiClient("YOUR_MANAGEMENT_TOKEN", "YOUR_AUTH0_DOMAIN");
var allClients = await apiClient.Users.PatchUsersById();

and I guess once you start typing patch your IDE should suggest you method you’re looking for.

Hi thank you but this doesn’t answer my question. When I create a user, I add appMetadata.

new {
     App1  = new {
          Setting1 = "Foo",
          Setting2 = "Bar"
     }
}

At a later point, I would like to update the AddMetadata property with an additional property (while preserving the existing value) so my end result would be:

{
     App1  =  {
          Setting1 = "Foo",
          Setting2 = "Bar"
     }, 
     App2  =  {
          Setting1 = "Foo",
          Setting2 = "Bar"
     }
}