question

SinghalAbhinav-2830 avatar image
0 Votes"
SinghalAbhinav-2830 asked saldana-msft edited

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

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.

microsoft-graph-sdkmicrosoft-graph-mail
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

  • Make sure you use the latest Graph SDK

  • To isolate the issue try to repro the issue using Microsoft Graph explorer for the same user with the Graph API call and see if you can repro the issue

0 Votes 0 ·

Thanks for the information.
Is it possible to use the same account id for Graph Explorer?

0 Votes 0 ·
Deva-MSFT avatar image Deva-MSFT SinghalAbhinav-2830 ·

Yes you can test that..

0 Votes 0 ·

0 Answers