msgraph-typescript-typings
msgraph-typescript-typings copied to clipboard
'@odata.type' property missing but required in FileAttachment and ItemAttachment
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
@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
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.