使用 WebDav 删除 Exchange 2003 电子邮件

发布于 2024-11-17 10:24:01 字数 1844 浏览 5 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

停滞 2024-11-24 10:24:01

在响应中查找 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.

妖妓 2024-11-24 10:24:01

从获取 msg Uri 的查询结果中:

var request = (HttpWebRequest)WebRequest.Create(mail.MailUri);
request.Credentials = _credential;
request.Method = "DELETE";

var response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode != HttpStatusCode.OK)
{
   //something might of broke
}

From the result of a query that gets you the msg Uri then:

var request = (HttpWebRequest)WebRequest.Create(mail.MailUri);
request.Credentials = _credential;
request.Method = "DELETE";

var response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode != HttpStatusCode.OK)
{
   //something might of broke
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文