使用 WebDav 删除 Exchange 2003 电子邮件
我正在尝试使用 C# 应用程序中的 webdav 自动管理 Exchange 2003 中的收件箱。查看 msdn 对我没有多大帮助,因为这里描述的方法(http://msdn.microsoft.com/en-us/library/aa142917.aspx)与我发现的示例完全不一致。因此,我试图确定两件事:
在从 webdav 查询返回的所有字段中,
string reqStr =
@"<?xml version=""1.0""?>
<g:searchrequest xmlns:g=""DAV:"">
<g:sql>
SELECT
*
FROM
""http://server/Exchange/[email protected]/Inbox/""
WHERE ""urn:schemas:mailheader:from"" = '[email protected]'
</g:sql>
</g:searchrequest>";
哪一个是唯一标识符?我已经浏览过它(但不确定验证字段的参考),乍一看 DAV:id 就是我想要的 (),但我不想进行假设。
其次,在处理电子邮件后以编程方式删除电子邮件的正确方法是什么?会像下面的工作一样(它会删除条目和所有相关元数据)。我不希望服务器上留下任何孤立的文件...
string reqStr =
@"<?xml version=""1.0""?>
<g:searchrequest xmlns:g=""DAV:"">
<g:sql>
DELETE
FROM
""http://server/Exchange/[email protected]/Inbox/""
WHERE ""DAV:id"" = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
</g:sql>
</g:searchrequest>";
最后,用于调查第一个请求中 XML 返回的所有数据的最佳在线资源是什么,以及用于管理 webdav 接口的所有选项记录在哪里?查阅MSDN并没有什么成果。
I am trying to manage an Inbox in Exchange 2003 automatically using webdav from a C# application. Looking at msdn is not helping me a whole lot as the methods described here (http://msdn.microsoft.com/en-us/library/aa142917.aspx) do not coincide at all with the samples I have found otherwise. So there are two things I am trying to determine:
Of all the fields that return from a webdav query
string reqStr =
@"<?xml version=""1.0""?>
<g:searchrequest xmlns:g=""DAV:"">
<g:sql>
SELECT
*
FROM
""http://server/Exchange/[email protected]/Inbox/""
WHERE ""urn:schemas:mailheader:from"" = '[email protected]'
</g:sql>
</g:searchrequest>";
Which one is the unique identifier? I have browsed it (but not sure of a reference to verify the fields) and it appears at first glance that DAV:id is what I want (), but I am not wanting to work on assumptions.
Secondly, what is the correct way to programmatically delete an email after I have processed it? Would something like the following work (will it remove the entry and all related metadata). I don't want any files left orphaned on the server...
string reqStr =
@"<?xml version=""1.0""?>
<g:searchrequest xmlns:g=""DAV:"">
<g:sql>
DELETE
FROM
""http://server/Exchange/[email protected]/Inbox/""
WHERE ""DAV:id"" = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
</g:sql>
</g:searchrequest>";
And finally, what are the best online sources for investigating all the data returned in the XML from the first request, and where are all the options documented for managing the webdav interface? Looking at MSDN just hasn't been fruitful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在响应中查找 dav:hef Tags 标签。它们包含一个可用于发出删除命令的 URL。
Look for the dav:hef tags tag in the response. They contain an url you can use to issue a delete command.
从获取 msg Uri 的查询结果中:
From the result of a query that gets you the msg Uri then: