Hi,
We are trying to get emails from office 365 account and download them in .msg format.
when we tried the email/as-file endpoint the resultant .msg file is not valid after passing email body received from microsoft graph API.
we wanted to try with [ClientAccount] (Aspose.Email Cloud - API References) and ClientMessage to login and retrieve the emails.
the login SMTP credentials are not working. we have 2 problems.
- microsoft gives us tennent id and that field is not available in aspose
- microsoft is not giving us refresh token which is required in aspose.
we tried passing tennant id to refresh token and we got the following error:
{
“requestId”: “12b61c8f-4228-4935-afc9-b481d9b75124”,
“error”: {
“code”: “”,
“message”: “Deserialization error”,
“description”: “”,
“dateTime”: “2022-11-14T10:42:41.8155398Z”
}
}
Can you please suggest some resource that enables accessing email account provided by office 365.
Thanks & regards,
Harsha.
@harshaBitcot
Please note that you need to implement OAuth support on your side to get a Client Id and access token.
When you implement OAuth successfully, you will get both an access token and refresh token. A refresh token will be used by our API to obtain new tokens, when they are needed.
For example, when you get the access token, the response from the OAuth server will look like
{
"expires_in":"3599",
"token_type":"Bearer",
"scope":"ActivityFeed.Read ActivityReports.Read ServiceHealth.Read",
"expires_on":"1438290275",
"not_before":"1438286375",
"resource":"https://manage.office.com",
"access_token":"eyJ0eX...",
"refresh_token":"AAABAAA...",
"id_token":"eyJ0eXAi..."
}
As you can see, there is an access_token, that expires in 3599 seconds. But also there is a refresh_token. This refresh token is used to obtain new access tokens, when previous access_tokens are expired.
During the implementation of OAuth on your side, you will find out, how to use other authentication fields (such as client_id). Hopefully, it will help you accomplish the task.
thankyou @tilal.ahmad. will try using the refresh token token we receive with the barer token along with application ID and client secret
1 Like