如何使用 WebDav 将 dav:href 与 Outolook Interop href 值匹配 [英] How to use WebDav to match dav:href to Outolook Interop href value

查看:25
本文介绍了如何使用 WebDav 将 dav:href 与 Outolook Interop href 值匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之前曾使用 webdav 根据主题和时间访问 Exchange 2003 服务器上发送的消息,这很有效.

I have previously used webdav to access the sent messages on an exchange 2003 server based on the subject and time and this has worked.

我现在需要实现另一个功能,这意味着将消息从客户端 Outlook(而不是 Web 访问)拖到 Windows 窗体上,然后在交换时查询 webdav 以获取有关此消息的所有信息.

I now need to implement another feature which means dragging a message from client outlook (not web access) on to a windows form then querying webdav on exchange to get all the information about this message.

我可以使用以下代码获取消息 href:

I can get the messages href using the following code:

Dim msg As MAPI.Message = CType(session.GetMessage(mail.EntryID), MAPI.Message)
Dim id as string = CType(CType(msg.Fields(), MAPI.Fields).Item(&H6707001E), MAPI.Field).Value.ToString

但是有两个问题;

1) URL 上的编码在我从拖动的消息中得到的和从 webdav 中得到的不同(如果我要求所有邮件,我可以看到这些).

1) The encoding on the URL is different between what I get from the dragged message and what is brought back from webdav (I can see these if I ask for all mail).

2) 无论我如何格式化查询,即使我在带回所有消息时从列表中复制 href,它也永远不会带回结果.

2) No matter how I format the query it never brings back results even if I copy the href from the list when I bring back all messages.

以下是失败的搜索请求示例(如果删除 where 子句,则有效):

Here is a sample of a search request that fails (works if you remove the where clause):

    <?xml version="1.0" ?>
    <D:searchrequest xmlns:D="DAV:">
        <D:sql>SELECT "DAV:contentclass","DAV:href", "DAV:displayname","urn:schemas:httpmail:datereceived","urn:schemas:httpmail:subject" 
FROM "https://server/exchange/mailbox" WHERE "DAV:href"='/Inbox/email.EML'</D:sql>
    </D:searchrequest>

我一直按照这篇文章使用相对语法,但尝试了很多组合.

I have been using relative syntax as per this article but have tried many combinations.

推荐答案

这很啰嗦,但我还没有找到更好的方法:

This is quite long winded, but I have yet to find a better way of doing this:

Outlook.MailItem.EntryID 包含 4 个 Guid,虽然我不确定它们都映射到什么.最后一个 guid 包含您要查找的信息.

The Outlook.MailItem.EntryID contains 4 Guids, although I am not sure what they all map to. The last guid contains the information you are after.

00000000E6053DD369FAB340B6B8C4D77A0
B37D30700173A23D2AA06A3488E75E759DD
1ACBBB00000A6F78CC00007B9F3D877B316
4499DE695FBB7FCDE5F00000 EBD83B9 0000

00000000E6053DD369FAB340B6B8C4D77A0
B37D30700173A23D2AA06A3488E75E759DD
1ACBBB00000A6F78CC00007B9F3D877B316
4499DE695FBB7FCDE5F00000 EBD83B9 0000

粗体部分是我们可以使用的消息 ID(在我收件箱中的所有消息中,只有这 7 位数字与它们的条目 ID 不同).

The bold part is the Messages ID that we can use (Of all the messages in my inbox, only these 7 digits were different between their entry IDs).

接下来,修改您的 webDAV 查询以恢复 DAV:permanenturl 属性.这将如下所示:

Next, modify your webDAV query to bring back the DAV:permanenturl property. This will look like the following:

https://SERVER_NAME/exchange/MAILBOX@DOMAIN>COM/-FlatUrlSpace-/173a23d2aa06a3488e75e7bb9dd1ac-a6f78cc/7b9f3d877b3164499de695fbb7fcde5f-ebd83b9

https://SERVER_NAME/exchange/MAILBOX@DOMAIN>COM/-FlatUrlSpace-/173a23d2aa06a3488e75e759dd1acbbb-a6f78cc/7b9f3d877b3164499de695fbb7fcde5f-ebd83b9

所以你需要做的就是对指定邮箱中的所有项目进行 webDAV 查询,循环比较 PermanentURLEntryID 的一部分找到您的匹配项.

So all you need to do for matching is to do a webDAV query for all the items in the specified mailbox, loop through comparing the PermanentURL with part of the EntryID to find your match.

如果 webDAV 上有 EntryID,我会更高兴,但似乎没有可直接访问的.

I would be happier if there was an EntryID on the webDAV, but there does not seem to be a directly accessible one.

这篇关于如何使用 WebDav 将 dav:href 与 Outolook Interop href 值匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆