Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,723 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I am trying to read documents attached to an email and store them in database.
I am able to get the fileAttachment into a FileAttachment variable using the below code.
var attachmentRequest = graphClient.Users[User.ID].Messages[message.Id].Attachments[attachment.Id].Request().GetAsync();
var fileAttachment = attachmentRequest.Result;
I want to retrieve the contents of the attachment and store it, but ContentBytes is not available for use. Only ContentType is available.
thanks in advance.
Use:
var fileAttachment = attachmentRequest.Result as Microsoft.Graph.FileAttachment;