0
  1. 質問のタイトルを変更するには、この分野に詳しい人が必要です

  2. webDAV と .NET についてもっと学ぼうとしています。サーバー上の受信トレイからすべての電子メールを取得する必要があるアプリを作成しました。これらの電子メールを、次のプロパティを持つオブジェクトにロードする必要があります。

- から
 - に
 - 主題
 - 体

ここで非常に役立つ投稿を見つけました。しかし、必要なものに合わせてxmlファイルを操作する方法がよくわかりません。具体的には、次のコード:

            XmlDocument document = new XmlDocument();
            document.Load(responseStream);

            // set up namespaces
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable);
            nsmgr.AddNamespace("a", "DAV:");
            nsmgr.AddNamespace("b", "urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/");
            nsmgr.AddNamespace("c", "xml:");
            nsmgr.AddNamespace("d", "urn:schemas:mailheader:");
            nsmgr.AddNamespace("e", "urn:schemas:httpmail:");

            // Load each response (each mail item) into an object
            XmlNodeList responseNodes = document.GetElementsByTagName("a:response");
            foreach (XmlNode responseNode in responseNodes)
            {
                // get the <propstat> node that contains valid HTTP responses
                XmlNode uriNode = responseNode.SelectSingleNode("child::a:href", nsmgr);
                XmlNode propstatNode = responseNode.SelectSingleNode("descendant::a:propstat[a:status='HTTP/1.1 200 OK']", nsmgr);
                if (propstatNode != null)
                {
                    // read properties of this response, and load into a data object
                    XmlNode fromNode = propstatNode.SelectSingleNode("descendant::d:from", nsmgr);
                    XmlNode descNode = propstatNode.SelectSingleNode("descendant::e:textdescription", nsmgr);

                    // make new data object
                    model.Mail mail = new model.Mail();
                    if (uriNode != null)
                        mail.Uri = uriNode.InnerText;
                    if (fromNode != null)
                        mail.From = fromNode.InnerText;
                    if (descNode != null)
                        mail.Body = descNode.InnerText;
                    unreadMail.Add(mail);
                }
            }

urn:schemas:httpmail:subject など、件名を引き出すことができるようなものはありますか? 私はwebDAVに非常に慣れていません-そして、これはExchangeサーバーと対話するように言われた方法なので、誰かが上記のコードを変更してサブジェクトノードを追加する方法とその理由を明らかにすることができれば-私は確信しています私のニーズを満たすためにそれをさらに変更する方法を理解することができます。

明確にするために、私の質問は次のとおりです。

上記のコード スニペットを変更して、Exchange サーバーから取得した電子メールの件名も含めるにはどうすればよいですか?

4

1 に答える 1

0

こちらをご覧ください。urn:schemas:httpmail:subjectを試してみてください。

于 2009-07-26T19:03:43.907 に答える