Hi,
I'm a little confused by the set of requirements supported for the 'Mailbox' API, especially for the Outlook 2016 client for Windows. I had the publish of an AddIn denied on the Partner Center marketplace due to an issue with Office 2016.
The page https://docs.microsoft.com/en-us/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets says that the Outlook 2016 for Windows supports the versions 1.1, 1.2, 1.3, 1.4 of the API. However, it seems that this version of Outlook (2016) is "sort of supporting" APIs greater than 1.4.
I inserted the following piece of code in the AddIn to test it, and for my surprise it returned TRUE for all versions, from 1.1 to 1.8.
for (let i = 8; i > 0; i--) {
if (Office.context.requirements.isSetSupported('Mailbox', `1.${i}`)) {
console.info(`Mailbox supported version: 1.${i}`)
// return
}
}
Due to that, the following code does not work correctly on Outlook 2016. Causing my AddIn to fail the Partner Center certification. To be able to resubmit the AddIn for certification, I changed this code to always use the else part.
if (Office.context.requirements.isSetSupported('Mailbox', '1.8')) {
console.debug('Getting classification via Office API')
Office.context.mailbox.item.categories.getAsync(asyncResult => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.error('Action failed with error: %o', asyncResult.error)
} else {
var categories = asyncResult.value
categories.forEach(category => {
// evaluate each category for the opened email
})
}
})
} else {
console.debug('Getting classification via Server')
// send email ID to server to evaluate categories
}
Please, could you clarify in the documentation the correct behaviour of Outlook regarding the Office APIs?
Thanks
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@ElizabethSamuel-MSFT tagging you :)
@oscarcosta Thanks for letting us know about this. Can you respond with your Office version and build number? See About Office: What version of Office am I using? on how to find this information.
Thanks.
Hi @ElizabethSamuel-MSFT, I am using the Microsoft Office Professional Plus 2016, Version 2002 (Build 12527.20880).
The Office.context.mailbox.diagnostics in the AddIn returns hostName = Outlook and hostVersion = 16.0.12527.20880
Thanks
@oscarcosta Thanks for sharing this info. You're actually using a version that supports up to requirement set 1.8 (see the following note on the requirement sets page).
@exextoc Any guidance regarding validation for this scenario?
Thanks.
@ElizabethSamuel-MSFT, thank you so much for your help!
What validation errors do you receive when trying to submit your add-in to the Partner Center? Or do you have a screenshot of why the validation failed?
The reported error is:
_Predictable Behavior
1100.4.4.2 O365 Perpetual
Your offer is not working in Office 2016.
The add-in loads indefinitely after selecting language._
I think this perpetual loading happens because the Office.context.mailbox.item.categories.getAsync(asyncResult => { is never returning a result on Office 2016. It is working fine for all other platforms that suport Mailbox API 1.8. I will try to debug the AddIn in the Office 2016 to confirm this.
Thanks
To clarify there are multiple versions of Outlook 2016. The MSI version only supports up to API Set 1.4. The Subscription Version (which is updated monthly, or semi-annually depending on desires of the customer), supports up to 1.8 (and will support future API sets as they come out). The validation team is most likely stating that the Outlook 2016 MSI version is not working correctly. However, your code about categories looks like it is correct. (though you should run through the debugger to be sure). It is detecting the API set, and not calling the unsupported functions. There is likely something else going on with your add-in in Outlook 2016 MSI that is causing the issue.
You can install Outlook 2016 MSI from here: https://support.microsoft.com/en-us/office/download-and-install-or-reinstall-office-2016-or-office-2013-7c695b06-6d1a-4917-809c-98ce43f86479?ui=en-us&rs=en-us&ad=us
Some common issues that people hit, are that older versions of Windows and Outlook use IE instead of Edge to render add-ins. As a result, some more modern Javascript isn't avaliable. (such as arrow functions). Though this can be true for older versions of C2R as well, for MSI it is 100% IE. (see https://developer.microsoft.com/en-us/office/blogs/microsoft-edge-webview-for-office-add-ins/)
If you don't want to support older versions of Outlook, you can change your minimum API Requirement set to 1.5. Then your add-in will only be allowed to be installed on more recent versions of Outlook. (though you will drop support for older versions)
@exextoc thanks for the clarification. The AddIn is already configured with API Requirement set to 1.5. Therefore, I guess the validation team is not using the Outlook 2016 MSI.
I am afraid I won't be able to download the Outlook 2016 MSI for testing/debugging, because I don't have a valid license available for this version, and it seems it is not possible to download it for a trial period, as stated in this forum . Anyway, I will try to debug the AddIn in the version of the Office 2016 that I have available, and I will let you know my findings.
I think I found the problem. When an email does not have categories, the method Office.context.mailbox.item.categories.getAsync is setting an empty array for the value in most of the cases (I guess) _Object { value: [], status: "succeeded" }_, but for Office 2016 it is setting null _Object { status: "succeeded", value: null }_.
The strange is that it does not show anything in the console and stop the whole program flow.
Oscar, yes it looks like we have a minor inconsistency in categories.getAsync API where OWA returns an empty array and Office 2016 returns null when no categories are set on the item. This can be easily worked around by checking the result both for null and for empty array.
Glad to hear you found the issue. Does it work as expected now if you add the null check?
Yes, it is working as expected now. Thanks.
Oscar Costa
On Thu, Jul 30, 2020 at 8:30 AM Outlook Add-ins Team - MSFT <
[email protected]> wrote:
Oscar, yes it looks like we have a minor inconsistency in
categories.getAsync API where OWA returns an empty array and Office 2016
returns null when no categories are set on the item. This can be easily
worked around by checking the result both for null and for empty array.Glad to hear you found the issue. Does it work as expected now if you add
the null check?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/OfficeDev/office-js-docs-pr/issues/2030#issuecomment-666457041,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABHQNLDDSVGDY5HZKZXHKHTR6GGYLANCNFSM4PAVROWQ
.
@oscarcosta Thanks for letting us know the outcome. We'll update the docs to mention this discrepancy.