msgraph-typescript-typings icon indicating copy to clipboard operation
msgraph-typescript-typings copied to clipboard

'@odata.type' property missing but required in FileAttachment and ItemAttachment

Open bamncan opened this issue 5 years ago • 2 comments

Both FileAttachment and ItemAttachment require the @odata.type property in order to be accepted by the API when using such commands as Add Attachment. However, this isn't in the typings for either type.

A 422: Unprocessable Entity error with message Cannot process input of abstract type 'Microsoft.OutlookServices.Attachment' occurs when the attachment does not have this property.

For FileAttachment it should use: '@odata.type': '#microsoft.graph.fileAttachment' For ItemAttachment it should use: '@odata.type': '#microsoft.graph.itemAttachment'

AB#7044

bamncan avatar Oct 31 '19 15:10 bamncan

@krototype We'll need to update the generator to insert the odata.type and a comment to hint what the value should be.

https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/blob/dev/Templates/TypeScript/src/entity_types.ts.tt#L71

MIchaelMainer avatar Oct 31 '19 21:10 MIchaelMainer

Until this is address in the generator, you'll need to set this property on the FileAttachment object.

We will need to address this for all types that descend from abstract base classes. Hopefully this information is captured in ODCM model for Typescript.

MIchaelMainer avatar Jan 16 '20 21:01 MIchaelMainer