microsoft / azure-devops-extension-sdk

Client SDK for developing Azure DevOps extensions
MIT License
125 stars 39 forks source link

Custom Forms Control is missing the user descriptor on `SDK.getUser()` #43

Open matthid opened 2 years ago

matthid commented 2 years ago

In our custom form controls we noticed that the member IUserContext.descriptor is somehow missing from the SDK.getUser() object. We want to use the descriptor to get membership information from the API of the current user (for a UI-only block).

What we do get is an object similar to this:

{
  displayName: "Full Name",
  id: "0000000-0000-1000-0000-000000000000",
  imageUrl: "https://dev.azure.com/<instance>/_apis/GraphProfile/MemberAvatars/aad.MDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDA=",
  name: "Full.Name@domain.tld"
}

As our extension has different contributions, we can see that on others (for example a project/organization settings page contributions) we get the descriptor:

{
  descriptor: "aad.MDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDA=",
  displayName: "Full Name",
  id: "0000000-0000-1000-0000-000000000000",
  imageUrl: "https://dev.azure.com/<instance>/_apis/GraphProfile/MemberAvatars/aad.MDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDA=",
  name: "Full.Name@domain.tld"
}

However, it seems to be missing on custom form controls...

As this is not documented (the TypeScript type says the field is always there) and I don't see any other good way, I assume this is a Bug. We could:

We would love to hear a workaround or an alternative approach to solve the problem at hand with the SDK or other REST calls.