microsoftgraph / microsoftgraph/msgraph-sdk-java

Dangling name error when trying to update extensionAttributes on a device

Open
#2,166 1 comment 0 reactions 1 assignee View on GitHub

@Ndiritu is already working on this.

Since Oct 24, 2024.

area:serialization type:bug
Dominant language
Java
Stars
444
Forks
154
Avg merge
18h 28m
Merged PRs (30d)
4

Description

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_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.