0
votes

So in my Outlook Add-In (Office.js) I'm setting some custom properties to an calendar event, using following code:

        const item = Office.context.mailbox.item;
        item.loadCustomPropertiesAsync((result) => {
            const props = result.value;
            props.set("my_prop", "some value");
            props.saveAsync((saveResult) => {
                console.log("SAVE_CUSTOM_PROP", saveResult);
            });
        });

And it works fine, on a newly created event, after I save it and open it again, I can access the custom property value using following code:

        const item = Office.context.mailbox.item;
        item.loadCustomPropertiesAsync((result) => {
            const props = result.value;
            const my_data = props.get("my_prop");
            console.log(my_data);
        });

However when I open an existing event, with or without custom properties being set, the custom properties I'm setting doesn't get saved after the user saves the event.

If I open the event again it doesn't have the new custom properties, it has either none (if none wasn't set), or the old values which were set when the event was newly created (not yet saved).

It works as expected in Outlook for PC and OWA.

Outlook for Mac Add-in support bug? I'm doing something wrong?

3
What do you see in the console log when saveAsync() on existing event? Do you have OutlookSpy for Outlook on Windows? If so, can you check the calendar event has your custom property changed? - Slava Ivanov
It's Outlook for Mac so saveAsync is not supported on an event and no OutlookSpy. On Windows it works as expected. When I get the custom property after I set it - it's there. But when I save the event, and open it again, my change is gone. - alek kowalczyk
CustomProperties.SaveAsync() available for 1.0 level API and you are saying it is not supported on event type of messages? You said you are able to set/save them for new event, are you? When I said use OutlookSpy, I mention for Windows Desktop Outlook, indeed. Use it for the same event and look if your property has been changed when you save the event on Mac. - Slava Ivanov
You wrote >>saveAsync() on existing event<< saveAsync on event is not available on Mac, it's available on the CustomProperties object indeed, but that's saving the custom properties only on the offline opened object, not on the server. If I call saveAsync on the CustomProperties, the property is on the event, but when I save it and reopen, they are not there, and not on the server (not visible from OWA or Outlook on PC) - alek kowalczyk
This sounds like a bug. What is the Outlook build number you're testing against? - Marc LaFleur

3 Answers

1
votes

Actually I believe I have a solution for you: When You set your CustomProperties and save them, in same time, get some visible message field, for example "subject"; modify it with API, for example set it to the same subject + white-space. After save the event itself as user would do. At this time message will have status "dirty" and will be actually saved, along with your custom properties, I hope. Let me know if this work around works.

0
votes

I used Mac Outlook latest build and able to save Custom Property for an appointment that you do not own (sent by someone else) but unable to set the custom property if you edit the appointment that you own (i.e you are the owner of the meeting) - Do you see the same behaviour ?

0
votes

Finally issue resolved, today Outlook for Mac 15.34 is out, and it fixes that issue.

So it was a bug on Outlook for Mac office.js support.