Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Serialize FileAttachement of content Type message/rfc822 #2180

Closed
raghucha opened this issue Oct 1, 2024 · 2 comments
Closed

How to Serialize FileAttachement of content Type message/rfc822 #2180

raghucha opened this issue Oct 1, 2024 · 2 comments
Assignees
Labels
Needs: Attention 👋 type:question An issue that's a question

Comments

@raghucha
Copy link

raghucha commented Oct 1, 2024

I would like to understand how do we deserialize this to an outlook message , we can do it with ItemAttachment with attachment.getItem()
below is a sample response

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('foo%40bar.com')/messages('AAMkAGI4NjFmZjQwLTMyOWEtNDI5MS05M2JmLTZhZGY0YzM5MmM5NQBGAAAAAAAxxAUGikUbRotDsfglXTlaBwCZx2ecKdkYRqinPi0NZhdPAAAAAAEMAACZx2ecKdkYRqinPi0NZhdPAAE5suHaAAA%3D')/attachments",
    "value": [
        {
            "@odata.type": "#microsoft.graph.fileAttachment",
            "@odata.mediaContentType": "message/rfc822",
            "id": "AAMkAGI4NjFmZjQwLTMyOWEtNDI5MS05M2JmLTZhZGY0YzM5MmM5NQBGAAAAAAAxxAUGikUbRotDsfglXTlaBwCZx2ecKdkYRqinPi0NZhdPAAAAAAEMAACZx2ecKdkYRqinPi0NZhdPAAE5suHaAAABEgAQAO1R5rkS-AJDnpgFzy8Z_XI=",
            "lastModifiedDateTime": "2024-10-01T20:53:49Z",
            "name": "message.eml",
            "contentType": "message/rfc822",
            "size": 3684,
            "isInline": false,
            "contentId": null,
            "contentLocation": null,
            "contentBytes": "someByte"
        }
    ]
}
@raghucha raghucha added the status:waiting-for-triage An issue that is yet to be reviewed or assigned label Oct 1, 2024
@Ndiritu
Copy link
Contributor

Ndiritu commented Oct 3, 2024

Hi @raghucha, based on the "@odata.type": "#microsoft.graph.fileAttachment", this value is a FileAttachment which does not provide an OutlookItem or Message as a property.

You'd probably have to get this by getting the message object by id e.g.

graphClient.users().byUserId('user-Id').messages().byMessageId("{message-id}")

Does this help?

@Ndiritu Ndiritu added type:question An issue that's a question status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Oct 3, 2024
@raghucha
Copy link
Author

raghucha commented Oct 3, 2024

thanks sounds good

@raghucha raghucha closed this as completed Oct 3, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Oct 3, 2024
@Ndiritu Ndiritu self-assigned this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Attention 👋 type:question An issue that's a question
Projects
None yet
Development

No branches or pull requests

2 participants