microsoftgraph / microsoftgraph/msgraph-sdk-java

Dangling name error when trying to update extensionAttributes on a device

Aberta
#2,166 1 comentário 0 reações 1 responsável Ver no GitHub

@Ndiritu já está trabalhando nisso.

Desde 24/10/2024.

area:serialization type:bug
Linguagem predominante
Java
Estrelas
444
Forks
154
Merge médio
18h 28min
PRs com merge (30d)
4

Descrição

Describe the bug

I am trying to update one of the extensionAttribute values within the additionalData of a device, but getting the following error:

java.lang.IllegalStateException: Dangling name: extensionAttributes

I'm following the example 2 from here - https://learn.microsoft.com/en-us/graph/api/device-update?view=graph-rest-1.0&tabs=java - although the example isn't fully complete for updating the extensionAttributes. There seems to be a model within the SDK to use for OnPremiseExtensionAttributes but not for extensionAttributes.

If I get additonalData using device.getAdditionalData() it contains the the list of the 15 extensionAttributes that can be used.

Expected behavior

Expect the extensionAttribute to update successfully, which works if updating via HTTP for example.

How to reproduce
Device newDevice = new Device();
		
Map<String,Object> additionalData = new HashMap<>();

Map<String,String> attribute = new HashMap<>();
attribute.put("extensionAttribute1", "123456");

additionalData.put("extensionAttributes", attribute);

newDevice.setAdditionalData(additionalData);

try {
	client.devices().byDeviceId(deviceId).patch(newDevice);
} catch(Exception e) {
	//handle exception
}
SDK Version

6.16.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.