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

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

问题描述

我以前已经使用webdav根据主题和时间在Exchange 2003服务器上访问发送的消息,这已经有效了。



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



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

  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返回的内容之间是不同的(我可以看到这些,如果我要求所有的邮件)。



2)无论我如何格式化查询,它都不会带来结果,即使我从列表中复制href,当我带回所有邮件。



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

 <?xml version =1.0?> 
< D:searchrequest xmlns:D =DAV:>
< D:sql> SELECTDAV:contentclass,DAV:href,DAV:displayname,urn:schemas:httpmail:datereceived,urn:schemas:httpmail:subject
FROMhttps:// server / exchange / mailboxWHEREDAV:href='/ Inbox / email.EML'< / D:sql>
< / D:searchrequest>

我一直按照这篇文章,但尝试了很多组合。

解决方案

这是相当长的时间,但我还没有找到一个更好的方法来做到这一点:



Outlook.MailItem.EntryID包含4个Guid,虽然我不知道什么他们都映射到。最后一个指引包含您以后的信息。



00000000E6053DD369FAB340B6B8C4D77A0

B37D30700173A23D2AA06A3488E75E759DD

1ACBBB00000A6F78CC00007B9F3D877B316

4499DE695FBB7FCDE5F00000 EBD83B9 0000



粗体部分是我们可以使用的消息ID(在收件箱中的所有消息中,只有这7个数字不同在$条目ID之间)。



接下来,修改您的webDAV查询以返回 DAV:permanenturl 属性。这将如下所示:



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



所以所有你需要做的匹配是为指定邮箱中的所有项目做一个webDAV查询,循环通过将 PermanentURL EntryID 的一部分进行比较来查找您的匹配。 / p>

如果webDAV上有一个EntryID,那么我会更快乐,但似乎没有可以直接访问的。


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.

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.

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

However there are two issues;

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) 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.

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:

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

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).

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-/173a23d2aa06a3488e75e759dd1acbbb-a6f78cc/7b9f3d877b3164499de695fbb7fcde5f-ebd83b9

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.

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天全站免登陆