问题描述
假设我的Outlook加载项(使用Office.js)中包含在约会的撰写表单上运行的以下代码:
Let's say I have in my Outlook Add-In (using Office.js) following code running on a compose form of an appointment:
const item = Office.context.mailbox.item;
item.loadCustomPropertiesAsync((result) => {
const props = result.value;
const testProp = props.get("my_prop");
console.log("CUSTOM_PROP", testProp);
props.set("my_prop", "test_value");
props.saveAsync((saveResult) =>
console.log("SAVE_CUSTOM_PROP", saveResult));
});
我看到,它实际上已保存在事件中.
I see, that it actually is saved on the event.
现在有关这些自定义属性的一堆问题:
And now a bunch of questions regarding those custom properties:
-
但是那些与扩展属性有关吗?
But are those somehow related to extended properties?
可以通过Outlook REST API或Microsoft Graph以某种方式访问那些属性吗?
Are those properties somehow accessible through Outlook REST API or Microsoft Graph?
是否可以使用Microsoft Graph和基于这些属性的过滤器来创建推送通知订阅? (我知道我可以基于扩展属性)
Can I create a push notifications subscription using Microsoft Graph with a filter based on those properties? (I know I can based on extended properties)
如果以上问题的答案为否",并且只能通过创建自定义属性的加载项来访问自定义属性,则可以通过该加载项为事件创建扩展属性,即使没有保存?
If the answer to above question is "no", and the custom properties are only accessible through the add-in which created them, is there a way to create a extended property to an event from the add-in, even if it's not saved?
要解释为什么要问-我正在创建一个外接程序,该外接程序可将约会与我们的第三方系统连接"起来,并使该约会与我们的对象保持同步.
To explain why I'm asking - I'm creating an add-in, which allows to "connect" an appointment with our 3rd party system, and keep that appointment in sync with our object.
因此,当在撰写表单上单击一个按钮时,我:
So when a button is clicked on the compose form, I:
- 保存约会并获取
event-id
- 将其存储在我们的系统中,以实现从系统到约会的同步.
- 使用Microsoft Graph在我们的系统中为该约会添加扩展属性
在第一次使用外接程序时,用户进行身份验证,然后使用扩展属性为事件创建推送通知订阅,以完成从Outlook到系统的同步.
In the first use of the add-in, the user authenticates, and I create a push notification subscription for events with our extended property, to do the sync from Outlook to our system.
它在OWA上运行良好,但是现在由于我们确实需要支持台式机,因此出现了两个主要问题:
It works great on OWA, but now as we really need to support desktop, two major issues are arising:
- Mac上的
-
Outlook:没有
saveAsync
方法,因此无法获取事件的id
,我正在考虑添加一些自定义属性,然后让推送通知通知我们的系统,该事件是已创建,需要与系统外同步.
Outlook for Mac: no
saveAsync
method, thus no way to get the event'sid
, I was thinking about adding some custom property, and then let the push notification inform our system, that an event was created which needs to be synced with out system.
Outlook:存在saveAsync
方法,但是当约会保存在本地而不是在服务器上时执行回调,因此我不知道何时确切地创建了事件,我可以在该事件上进行一些Microsoft Graph调用.
Outlook for PC: there is the saveAsync
method, but the callback is executed when the appointment is saved locally, not on the server, thus I can't know when exactly the event has been created and I can do some Microsoft Graph calls on that event.
回答我的第一个问题,和/或关于用例的任何提示都将受到欢迎.
Answer to my first question, and/or any tips about my use case would be more than welcome.
推荐答案
TL; DR;是的,可以使用REST API读取Office.js
api loadCustomPropertiesAsync
设置的自定义属性您需要创建一个看起来像
TL;DR;Yes it is possible to read custom properties set by Office.js
api loadCustomPropertiesAsync
using REST APIsYou need to create a REST call query that looks like
string addinManifestId = "<your manifest guid here>";//lower cases
string prop = @"String {00020329-0000-0000-C000-000000000046} Name"+ string.Format(" cecp-{0}", addinManifestId );
var url = $"<apiEndpoint>/messages/<youritemid>?$expand=SingleValueExtendedProperties($filter=PropertyId eq '{propertyname}')";
更多信息
可在此处找到文档 https://msdn.microsoft.com/en-us/library/hh968549(v=exchg.80).aspx
当我需要为加载项 Keluro .我通过REST API上的Web钩子实现了与您的方法非常接近的方法.据我所知,这是处理已发送邮件的唯一方法.考虑对此进行投票 https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/10964871-add-itemsend-event-so-add-in-can-cancel-email
I had a similar problem when I needed to handle "sent mail" for my add-in Keluro.I implemented something really close to your approach with a web hook on REST API. To my knowledge it is the only way to handle sent items.Consider upvoting thishttps://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/suggestions/10964871-add-itemsend-event-so-add-in-can-cancel-email
这篇关于通过Microsoft Graph在Outlook加载项中获取自定义属性集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!