msgraph-beta-sdk-java icon indicating copy to clipboard operation
msgraph-beta-sdk-java copied to clipboard

Missing Device attributes

Open cnotin opened this issue 1 year ago β€’ 8 comments

Describe the bug

The Device class https://github.com/microsoftgraph/msgraph-beta-sdk-java/blob/main/src/main/java/com/microsoft/graph/beta/generated/models/Device.java has several attributes missing in this SDK (and certainly others) compared to what's returned by the API:

  • createdDateTime
  • ~deletedDateTime~ (available, actually)
  • externalSourceName
  • sourceType

Here's the proof that they are returned by the API:

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#devices",
  "value": [
    {
      "id": "15b8b2c6-5056-412c-ad0f-4f06e0f140c2",
      "deletedDateTime": null,
[...}
      "createdDateTime": "2023-12-12T07:50:41Z",
[...]
      "externalSourceName": null,
[...]
      "sourceType": null,
[...]
    },

When using the PowerShell Graph SDK, they are available via AdditionalProperties These are also not documented.

I suppose this is because the metadata of the Graph API doesn't return those. So the issue is similar to https://github.com/microsoftgraph/msgraph-beta-sdk-java/issues/838 and https://github.com/microsoftgraph/msgraph-beta-sdk-java/issues/499

Device in metadata
<EntityType Name="device" BaseType="graph.directoryObject" OpenType="true">
<Property Name="accountEnabled" Type="Edm.Boolean"/>
<Property Name="alternativeSecurityIds" Type="Collection(graph.alternativeSecurityId)" Nullable="false"/>
<Property Name="approximateLastSignInDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="complianceExpirationDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="deviceCategory" Type="Edm.String"/>
<Property Name="deviceId" Type="Edm.String"/>
<Property Name="deviceMetadata" Type="Edm.String"/>
<Property Name="deviceOwnership" Type="Edm.String"/>
<Property Name="deviceVersion" Type="Edm.Int32"/>
<Property Name="displayName" Type="Edm.String"/>
<Property Name="domainName" Type="Edm.String"/>
<Property Name="enrollmentProfileName" Type="Edm.String"/>
<Property Name="enrollmentType" Type="Edm.String"/>
<Property Name="extensionAttributes" Type="graph.onPremisesExtensionAttributes"/>
<Property Name="hostnames" Type="Collection(Edm.String)"/>
<Property Name="isCompliant" Type="Edm.Boolean"/>
<Property Name="isManaged" Type="Edm.Boolean"/>
<Property Name="isManagementRestricted" Type="Edm.Boolean"/>
<Property Name="isRooted" Type="Edm.Boolean"/>
<Property Name="managementType" Type="Edm.String"/>
<Property Name="manufacturer" Type="Edm.String"/>
<Property Name="mdmAppId" Type="Edm.String"/>
<Property Name="model" Type="Edm.String"/>
<Property Name="onPremisesLastSyncDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="onPremisesSecurityIdentifier" Type="Edm.String"/>
<Property Name="onPremisesSyncEnabled" Type="Edm.Boolean"/>
<Property Name="operatingSystem" Type="Edm.String"/>
<Property Name="operatingSystemVersion" Type="Edm.String"/>
<Property Name="physicalIds" Type="Collection(Edm.String)" Nullable="false"/>
<Property Name="profileType" Type="Edm.String"/>
<Property Name="registrationDateTime" Type="Edm.DateTimeOffset"/>
<Property Name="systemLabels" Type="Collection(Edm.String)" Nullable="false"/>
<Property Name="trustType" Type="Edm.String"/>
<Property Name="kind" Type="Edm.String"/>
<Property Name="name" Type="Edm.String"/>
<Property Name="platform" Type="Edm.String"/>
<Property Name="status" Type="Edm.String"/>
<NavigationProperty Name="usageRights" Type="Collection(graph.usageRight)" ContainsTarget="true"/>
<NavigationProperty Name="memberOf" Type="Collection(graph.directoryObject)"/>
<NavigationProperty Name="registeredOwners" Type="Collection(graph.directoryObject)"/>
<NavigationProperty Name="registeredUsers" Type="Collection(graph.directoryObject)"/>
<NavigationProperty Name="transitiveMemberOf" Type="Collection(graph.directoryObject)"/>
<NavigationProperty Name="extensions" Type="Collection(graph.extension)" ContainsTarget="true"/>
<NavigationProperty Name="commands" Type="Collection(graph.command)" ContainsTarget="true"/>
<Annotation Term="Org.OData.Core.V1.AlternateKeys">
<Collection>
<Record Type="Org.OData.Core.V1.AlternateKey">
<PropertyValue Property="Key">
<Collection>
<Record Type="Org.OData.Core.V1.PropertyRef">
<PropertyValue Property="Alias" String="deviceId"/>
<PropertyValue Property="Name" PropertyPath="deviceId"/>
</Record>
</Collection>
</PropertyValue>
</Record>
</Collection>
</Annotation>
</EntityType>

Expected behavior

Be able to get these Device attributes

How to reproduce

Use the Java (or other) Graph SDK and try accessing these properties of a Device

SDK Version

No response

Latest version known to work for scenario above?

No response

Known Workarounds

Call the API directly

Debug output

Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

cnotin avatar Jun 28 '24 15:06 cnotin

Thanks for raising this issue @cnotin.

While we resolve the issue with the API service team. You can also use getAdditionalData() to get key-value pairs for the missing properties.

Minor sidenote: getDeletedDateTime is available on the Device model via inheritance.

Ndiritu avatar Jul 15 '24 09:07 Ndiritu

Thank you! We'll monitor this then ;) And we noted the workaround.

cnotin avatar Jul 17 '24 14:07 cnotin

I wanted to share that the workaround works πŸ‘Œthx! but of course, we're looking forward to have it as a normal attribute πŸ˜‰ If that helps: in similar cases, @baywet created an ICM for the graph team https://github.com/microsoftgraph/msgraph-beta-sdk-java/issues/499#issuecomment-1934245633

cnotin avatar Oct 25 '24 08:10 cnotin

Thanks for the nudge: deletedDateTime is already available as a property on directoryObject (parent type)

I have created an ICM on the relevant team about this. https://portal.microsofticm.com/imp/v5/incidents/details/558471350/summary

@Ndiritu can you go subscribe to it please as I'll be out of office soon, I'd like you to follow up on it.

baywet avatar Oct 25 '24 11:10 baywet

deletedDateTime is indeed available (updated my original report)

Merci Vincent :)

cnotin avatar Oct 25 '24 12:10 cnotin

Hello, did you get an update on the ICM please?

cnotin avatar Mar 17 '25 10:03 cnotin

No updates from them, can you please open support tickets and mention the ICM id there so the support team chases after them? 558471350

baywet avatar Mar 18 '25 16:03 baywet

Support ticket open: #β€Ž2503181420004022β€Ž with the ICM ID mentionned I'll let you know how it goes ;)

cnotin avatar Mar 18 '25 19:03 cnotin