Skip to content

Getting MIME content is not working in Graph API ( 3.1.0) for Java SDK #722

@sunil-marudappa

Description

@sunil-marudappa

Hi Support team,
I am trying to get the mime-content of the message with attachment,
I am using 3.1.0, which has content method, I am using this method to get the mime-content(uses /$value), below is my request. Below is the reference docuementation we are using.

https://docs.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-1.0&tabs=http#example-3-expand-and-get-the-properties-of-the-item-attached-to-a-message

I am getting the response with code 200 and header as Content-Type: text/plain, body has nothing and body.contentLength() is coming as -1,

Kindly help me if I am missing anything in the request/headers

Code for mime content for message:
Request: https://graph.microsoft.com/v1.0/users/{Email Id}/messages/{message id}/$value
graphClient.users({emailId}).messages(message.id).content()
.buildRequest()
.get();
I tried to fetch the same mime-content for attachment as well, below is the code
final String baseUrl = graphClient.users(userProfile).messages(message.id).attachments(attchId).buildRequest().getRequestUrl().toString();
final CustomRequestBuilder downloadRequestBuilder = new CustomRequestBuilder<>(baseUrl + "/$value", graphClient, new ArrayList(), InputStream.class);
final InputStream stream = downloadRequestBuilder.buildRequest().get();

In either case, I am getting the body as empty and body.contentLenght() is -1.
Kindly help me on this.
AB#8944

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions