I am developing an Outlook Web Add-in and run it in the native Outlook 2019 on Windows. My colleague delegates me his calendar and I have an access to his calendar and can run my web Add-in in shared calendar's Appointment. I'm using F12 Developer Tools to see console logs. So, the main problem for me - to get a shared calendar's user email. I tried to get Office.context.mailbox.item.organizer
but in console of F12 DevTools I see undefined
. When I try to get Office.context.mailbox.item
in console of F12 Devtools I see [object] { }
and I don't know how to see all object properties.
In manifest.xml
of my Add-in I added <SupportsSharedFolders>true</SupportsSharedFolders>
, but it doesn't help me (I think it is only needed when I can't see my Add-in in the ribbon, but I already saw it without this parameter line).
Also I tried to change permissions in manifest.xml
from "ReadWriteItem" to "ReadWriteMailbox
" - no changes.
I looked at the official Microsoft documentation and there I read that I can call Office.context.mailbox.item.saveAsync
and pass as callback function with param asyncResult0
wherein I call Office.context.mailbox.getCallbackTokenAsync
(link to official documentation), and saveAsync
is called without problems (except that I can't access asyncResult0.value
field of asyncResult0
and can't actually see what fields there are in console because of F12 Devtools), but further in console of F12 Devtools I see Object doesn't support property or method 'getCallbackTokenAsync', TypeError: Object doesn't support property or method 'getCallbackTokenAsync'
. If this method were called I would do the following:
Office.context.mailbox.item.saveAsync(function (asyncResult0) {
Office.context.mailbox.getCallbackTokenAsync({
isRest: true
},
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded && asyncResult.value !== "") {
Office.context.mailbox.item.getSharedPropertiesAsync({
// Pass auth token along.
asyncContext: asyncResult.value
},
function (asyncResult1) {
const sharedProperties = asyncResult1.value; // may be it contains shared calendar user email
// some operations...
}
);
}
}
);
});
Important details:
- In
manifest.xml
:
- Requirement set MinVersion 1.1
- Requirement set DefaultMinVersion 1.3
- And also I don't know am I using Microsoft documentation correctly.
I created a draft of Appointment in shared calendar and tried everything described above in this draft.
I don't know how to debug more correctly COM Add-in (Web version based) and now I know only about F12 Devtools.
I don't know is it important, but just in case I write that when I run my Add-in in Office 365 (only in Appointment of my calendar, because Add-in is not installing with
<SupportsSharedFolders>true</SupportsSharedFolders>
in Office 365 and without it I can't see Add-in in shared calendar) I can see all properties ofOffice.context.mailbox.item
object in console.Office.context.mailbox.item.organizer
returns object with methodgetAsync
which if I call (and pass as callback function withresult
param) I get theresult
:{ status: "succeeded", value: { displayName: "...", emailAddress: "..." } }
(in this case with data of my user of course). And also I was able to getasyncResult0
in callback passed tosaveAsync
, and alsoasyncResult
in callback passed togetCallbackTokenAsync
. But when callinggetSharedPropertiesAsync
in console I see "Office.context.mailbox.item.getSharedPropertiesAsync is not a function".In native Outlook Add-in is using
Office = window.external
object as Office JS API point.Office.context.mailbox.diagnostics.hostVersion
in console shows: 16.0.0.10368
Help me please. I have no ideas how to get user email of shared calendar in Appointment with Office.js API. I will be glad to any leads.
Best Regards!