Office-js: [Outlook Mobile] Office.context.mailbox.item.body.getAsync is not working on Xiaomi Mi8

Created on 11 Dec 2018  路  13Comments  路  Source: OfficeDev/office-js


I need to use Office.context.mailbox.item.body.getAsync in order to get the content of an email, but the callback is never called. I've tried with several emails, just to ensure the problem is not related to the content. I've never noticed this problem on desktop, iPhone/iPad or different Android devices.

Expected Behavior

The callback method I pass as an argument should be executed, as described here

Current Behavior

The callback is never called.

Steps to Reproduce, or Live Example

It's easy to reproduce. When Office.js is initialized, call the function. As mentioned above, it's working fine on other devices but this one.

Your Environment

  • Host: Outlook Mobile
  • Office version number: 1.1

Device Info:

  • Xiaomi Mi 8
  • MIUI version: MIUI Global 10.0.3.0
  • Android version: 8.1.0

Useful logs

It's quite difficult to debug, since I cannot easily attach a debugger.

Outlook fixed product bug

Most helpful comment

What does that mean? Get Async doesn't work in windows and mac client? How to get email body in this case?

My Code Like:
Office.context.mailbox.item.body.getAsync("html", {coercionType: Office.CoercionType.Html}, function (result) {
//bla bla bla
console.log("test test test");
});
But I can't get "test test test" shown in console.
This problem happened in both windows (outlook 2019 preview version) and mac outlook 2016.
Only in excuteFunction it happened . Code above works well on both browser and outlook sidebar.

It is working fine for us. I think that you should rewrite the call to that function, check getAsync to verify the arguments that you use.

Try with:

Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html, function (result) {
    //bla bla bla  
    console.log("test test test");  
});

The 1st parameter must be the CoercionType enum.

All 13 comments

I'm facing the same issue with one of my android devices.
Device Info:
Lenovo K5 Note
Android Version:6.0

I need to use Office.context.mailbox.item.body.getAsync in order to get the content of an email, but the callback is never called. Is this the bug from Office Js?

This was an issue from Android client side. We have fixed it and will be in production by second week of January.

This was an issue from Android client side. We have fixed it and will be in production by second week of January.

Cool. Thanks.

Office.context.mailbox.item.body.getAsync not work in windows and mac outlook client. it will be blocked so that never run the then part.

What does that mean? Get Async doesn't work in windows and mac client? How to get email body in this case?

What does that mean? Get Async doesn't work in windows and mac client? How to get email body in this case?

My Code Like:
Office.context.mailbox.item.body.getAsync("html", {coercionType: Office.CoercionType.Html}, function (result) {
//bla bla bla
console.log("test test test");
});
But I can't get "test test test" shown in console.
This problem happened in both windows (outlook 2019 preview version) and mac outlook 2016.
Only in excuteFunction it happened . Code above works well on both browser and outlook sidebar.

What does that mean? Get Async doesn't work in windows and mac client? How to get email body in this case?

My Code Like:
Office.context.mailbox.item.body.getAsync("html", {coercionType: Office.CoercionType.Html}, function (result) {
//bla bla bla
console.log("test test test");
});
But I can't get "test test test" shown in console.
This problem happened in both windows (outlook 2019 preview version) and mac outlook 2016.
Only in excuteFunction it happened . Code above works well on both browser and outlook sidebar.

It is working fine for us. I think that you should rewrite the call to that function, check getAsync to verify the arguments that you use.

Try with:

Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html, function (result) {
    //bla bla bla  
    console.log("test test test");  
});

The 1st parameter must be the CoercionType enum.

What does that mean? Get Async doesn't work in windows and mac client? How to get email body in this case?

My Code Like:
Office.context.mailbox.item.body.getAsync("html", {coercionType: Office.CoercionType.Html}, function (result) {
//bla bla bla
console.log("test test test");
});
But I can't get "test test test" shown in console.
This problem happened in both windows (outlook 2019 preview version) and mac outlook 2016.
Only in excuteFunction it happened . Code above works well on both browser and outlook sidebar.

It is working fine for us. I think that you should rewrite the call to that function, check getAsync to verify the arguments that you use.

Try with:

Office.context.mailbox.item.body.getAsync(Office.CoercionType.Html, function (result) {
    //bla bla bla  
    console.log("test test test");  
});

The 1st parameter must be the CoercionType enum.

really appreciate your reply. But it still doesn't work....

Closing since the fix for the body.getAsync in Android issue was deployed in January per the comment above.

@SWei1234 if you still need help with the API on other platforms, please open a new issue. Thanks!

var body;
Office.context.mailbox.item.body.getAsync(Office.CoercionType.Text, function (result) {
if (result.status !== Office.AsyncResultStatus.Succeeded) {
body= result.error;
} else {
body= result.value;
}
});

document.getElementById("item-body").innerHTML = "Body:
" + body;

Why body empty at the first call, and have the result only in the second call?

Ali, there is a bug in this code - on line 3, "asyncResult" is undefined, I believe you want to say "result" instead. Also, for any new inquiry it would be best to open a new issue on GitHub and include all the standard information about product platform and version, etc.

Ah, this error has been created when I copied the code and changed it, it's not the problem I am facing.
I have added the code here just because it's a related thing hoping to get a fast solution.

ok if you are still having issues with body.getAsync API, please create a new GitHub issue and provide system, client version information and detailed repro steps and correct code, as usual. Thanks!

Was this page helpful?
0 / 5 - 0 ratings