Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在office插件中将ItemId(EwsId)转换为EntryId_Javascript_Api_Exchangewebservices_Office Addins - Fatal编程技术网

Javascript 在office插件中将ItemId(EwsId)转换为EntryId

Javascript 在office插件中将ItemId(EwsId)转换为EntryId,javascript,api,exchangewebservices,office-addins,Javascript,Api,Exchangewebservices,Office Addins,我有一个office插件(js),我需要这个EntryId属性来识别邮件(我在VSTO插件中使用这个EntryId,BC需要它) 搜索后,我尝试过,但总是得到此请求为invaild响应 事实证明,使用时不支持ConvertId 因此,我考虑使用GetItem获取消息头,但没有返回PR\u ENTRYID头: 所有属性 tl;dr:那么在Office Addin中将EwsId转换为EntryId的方法是什么呢?我解决了这个问题,最后使用GetItem操作ExtendedFieldURI: 从“

我有一个office插件(js),我需要这个
EntryId
属性来识别邮件(我在VSTO插件中使用这个
EntryId
,BC需要它)

搜索后,我尝试过,但总是得到
此请求为invaild
响应

事实证明,使用时不支持
ConvertId

因此,我考虑使用
GetItem
获取消息头,但没有返回PR\u ENTRYID头:


所有属性

tl;dr:那么在Office Addin中将
EwsId
转换为
EntryId
的方法是什么呢?

我解决了这个问题,最后使用
GetItem
操作
ExtendedFieldURI

从“xpath”导入xpath;
从“xmldom”导入{DOMParser};
从'Buffer'导入{Buffer};
私有getEntryIdFromItemId(itemId:string):承诺
{
常量请求=`
我只
`;
返回新承诺((解决、拒绝)=>{
Office.context.mailbox.makeEwsRequestAsync(请求,异步(异步结果)=>{
if(asyncResult.status==Office.AsyncResultStatus.Failed)
{
拒绝();
返回;
}
const doc=new DOMParser().parseFromString(asyncResult.value);
const entryId=xpath。选择(“//*[local-name()='Value']”,doc)[0]作为节点;
const entryIdHex=新缓冲区(entryId.textContent!,“base64”).toString(“hex”).toUpperCase();
解析(entryydhex);
});
});
}
还必须将返回的base64值转换为十六进制值,因为Outlook客户端使用十六进制值


如果您想知道我是如何计算0x0FFF值部分的,这里是。

您可以在MFCMAPI()或OutlookSpy()中看到所有MAPI属性。谢谢您的帮助,将来可能会有所帮助!