[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fW2tOmTdBgU6NObft1ed8KJPZ1jjFpc6-wBu4sm6PR10":3},{"id":4,"question":5,"answer":6,"answerHtml":7,"slug":8,"keywords":9,"article":10,"status":34,"aiModel":39,"aiConfidence":39,"updatedAt":52,"createdAt":52,"_status":51},583,"How do you handle untrusted SSL certificates when using the EWS Managed API in C#?","To bypass certificate validation errors, you can add a certificate trust policy using `ServicePointManager.ServerCertificateValidationCallback` that returns `true` for all certificates. This is necessary because Exchange Server self-signed certificates often cause an untrusted error, leading to a closed SSL connection. The C# code snippet in the guide shows: `ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => { return true; };`.","\u003Cp>To bypass certificate validation errors, you can add a certificate trust policy using `ServicePointManager.ServerCertificateValidationCallback` that returns `true` for all certificates. This is necessary because Exchange Server self-signed certificates often cause an untrusted error, leading to a closed SSL connection. The C# code snippet in the guide shows: `ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =&gt; { return true; };`.\u003C\u002Fp>\u003Cp>\u003Ca href=\"\u002Fnews\u002Fexchange-web-service-ews-development-guide\">Read the related One Day Sec article\u003C\u002Fa>\u003C\u002Fp>","how-do-you-handle-untrusted-ssl-certificates-when-using-the-ews-managed-api-in-c-1777482905814","SSL\u002FTLS, certificate trust, ServicePointManager, EWS Managed API, untrusted certificate",{"id":11,"title":12,"slug":13,"description":14,"content":15,"contentHtml":30,"cover":31,"author":32,"views":19,"readingTime":33,"status":34,"publishedAt":35,"seo":36,"tags":41,"qaPairs":42,"meta":48,"updatedAt":49,"createdAt":50,"_status":51},144,"Exchange Web Service (EWS) Development Guide","exchange-web-service-ews-development-guide","Learn to access Exchange resources using EWS Managed API and SOAP XML. Includes open-source ewsManage code, C# and PowerShell examples for email management.",{"root":16},{"type":17,"format":18,"indent":19,"version":20,"children":21,"direction":29},"root","",0,1,[22],{"type":23,"format":18,"indent":19,"version":20,"children":24,"direction":29},"paragraph",[25],{"mode":26,"text":27,"type":28,"style":18,"detail":19,"format":19,"version":20},"normal","\u003Chtml>\u003Chead>\u003C\u002Fhead>\u003Cbody>\u003Ch2>0x00 Preface\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Exchange Web Service (EWS) provides an interface for accessing Exchange resources. Since I couldn't find suitable reference projects on GitHub, I systematically organized this topic and open-sourced an EWS implementation code named ewsManage to facilitate subsequent secondary development.\u003C\u002Fp>\u003Ch2>0x01 Introduction\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>This article will cover the following:\u003C\u002Fp>\u003Cul>\u003Cli>Using EWS Managed API to access Exchange resources\u003C\u002Fli>\u003Cli>Using EWS SOAP XML messages to access Exchange resources\u003C\u002Fli>\u003Cli>Open-source code ewsManage\u003C\u002Fli>\u003Cli>Features of ewsManage\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>0x02 Introduction\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Official documentation:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fexchange\u002Fclient-developer\u002Fexchange-server-development\u003C\u002Fp>\u003Cp>Two methods to access Exchange resources:\u003C\u002Fp>\u003Cul>\u003Cli>Using EWS Managed API\u003C\u002Fli>\u003Cli>Using EWS SOAP XML messages\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Test environment:\u003C\u002Fp>\u003Cul>\u003Cli>Exchange Server 2013 SP1\u003C\u002Fli>\u003Cli>user: test1@test.com\u003C\u002Fli>\u003Cli>pwd: test123!\u003C\u002Fli>\u003Cli>url: https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx\u003C\u002Fli>\u003Cli>AutodiscoverUrl: test1@test.com\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>0x03 Using EWS Managed API\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Official documentation:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fexchange\u002Fclient-developer\u002Fexchange-web-services\u002Fget-started-with-ews-managed-api-client-applications\u003C\u002Fp>\u003Cp>Here using EWS Managed API 2.0\u003C\u002Fp>\u003Cp>Download link:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fdownload\u002Fdetails.aspx?id=35371\u003C\u002Fp>\u003Cp>After installation, locate the files Microsoft.Exchange.WebServices.dll and Microsoft.Exchange.WebServices.xml in the folder\u003C\u002Fp>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>If you already have these two files, you do not need to install EwsManagedApi.msi. These files can be found in the later open-source project ewsManage\u003C\u002Fp>\u003Ch3>(1) C Sharp Implementation\u003C\u002Fh3>\u003Cp>Development environment: VS2015\u003C\u002Fp>\u003Cp>Create a new project and reference the files:\u003C\u002Fp>\u003Cp>Microsoft.Exchange.WebServices.dll and Microsoft.Exchange.WebServices.xml\u003C\u002Fp>\u003Cp>C Sharp code example (list all email subjects in the inbox):\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>using System;\u003Cbr>using Microsoft.Exchange.WebServices.Data;\u003Cbr>using System.Net;\u003Cbr>namespace EMAIL_EWS\u003Cbr>{\u003Cbr>    class Program\u003Cbr>    {\u003Cbr>        static void Main(string[] args)\u003Cbr>        {\u003Cbr>            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =&gt; { return true; };\u003Cbr>            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);\u003Cbr>            service.Credentials = new WebCredentials(\"test1\", \"test123!\");\u003Cbr>            service.AutodiscoverUrl(\"test1@test.com\");\u003Cbr>            ItemView view = new ItemView(int.MaxValue);\u003Cbr>            FindItemsResults\u003Citem> findResults = service.FindItems(WellKnownFolderName.Inbox, view);\u003Cbr>            foreach (Item item in findResults.Items)\u003Cbr>            {\u003Cbr>                if (item.Subject != null)\u003Cbr>                {\u003Cbr>                    Console.WriteLine(item.Subject);\u003Cbr>                }\u003Cbr>                else\u003Cbr>                {\u003Cbr>                    Console.WriteLine(\"no Title\\r\\n\");\u003Cbr>                }\u003Cbr>            }\u003Cbr>        }\u003Cbr>    }\u003Cbr>}\u003C\u002Fitem>\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>(2)Powershell Implementation\u003C\u002Fh3>\u003Cp>Powershell code example (list titles of all emails in the inbox):\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>add-type @\"\u003Cbr>    using System.Net;\u003Cbr>    using System.Security.Cryptography.X509Certificates;\u003Cbr>    public class TrustAllCertsPolicy : ICertificatePolicy {\u003Cbr>        public bool CheckValidationResult(\u003Cbr>            ServicePoint srvPoint, X509Certificate certificate,\u003Cbr>            WebRequest request, int certificateProblem) {\u003Cbr>            return true;\u003Cbr>        }\u003Cbr>    }\u003Cbr>\"@\u003Cbr>[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy\u003Cbr>Import-Module -Name \"C:\\test\\Microsoft.Exchange.WebServices.dll\"\u003Cbr>$Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials(\"test1\",\"test123!\")\u003Cbr>$exchService = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService\u003Cbr>$exchService.Credentials = $Credentials\u003Cbr>$exchService.AutodiscoverUrl(\"test1@test.com\")\u003Cbr>$exchService\u003Cbr>$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($exchService,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)\u003Cbr>$inbox|gm\u003Cbr>$ms = $inbox.FindItems(10) \u003Cbr>foreach ($m in $ms)\u003Cbr>{\u003Cbr>$m.Load()\u003Cbr>$m.subject\u003Cbr>}\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>Powershell also requires Microsoft.Exchange.WebServices.dll\u003C\u002Fp>\u003Cp>Details to note in program development are as follows:\u003C\u002Fp>\u003Ch4>1. The Exchange Server certificate is untrusted\u003C\u002Fh4>\u003Cp>This causes the certificate to appear untrusted when accessing via IE, requiring a click on Continue to access normally, as shown in the figure below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fuploads\u002Fdocx_image_1770017956173_0_7622e0379d.jpeg\">\u003C\u002Fp>\u003Cp>During program implementation, an error will occur with the following prompt:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>The underlying connection was closed. Could not establish a secure SSL\u002FTLS connection\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>This issue can be avoided by adding a certificate trust policy:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>using System.Net;\u003Cbr>ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =&gt; { return true; };\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch4>2. Autodiscover Service\u003C\u002Fh4>\u003Cp>Used to simplify user configuration process. In terms of program implementation, it corresponds to ExchangeService.AutodiscoverUrl\u003C\u002Fp>\u003Cp>Reference:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fmsdn.microsoft.com\u002Fen-us\u002Flibrary\u002Foffice\u002Fdd634273(v=exchg.80).aspx\u003C\u002Fp>\u003Cp>Input email address to automatically resolve the Exchange Server Url\u003C\u002Fp>\u003Cp>Usage example:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);\u003Cbr>service.AutodiscoverUrl(\"test1@test.com\", RedirectionUrlValidationCallback);\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Equivalent to\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);\u003Cbr>service.Url = new Uri(\"https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx\");\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>In actual use, if the Exchange Server disables the Autodiscover service, you can choose to specify the Url directly\u003C\u002Fp>\u003Ch4>3..NET Framework 4 and .NET Framework 3.5\u003C\u002Fh4>\u003Cp>.NET Framework 4 is the recommended development environment\u003C\u002Fp>\u003Cp>Win7 system defaults to .NET Framework 3.5 and does not support .NET Framework 4\u003C\u002Fp>\u003Cp>To support Win7, specify the project as .NET Framework 3.5, which does not affect the use of EWS Managed API\u003C\u002Fp>\u003Ch4>4. Reading the body property of emails in plain text\u003C\u002Fh4>\u003Cp>When reading the body property of emails (i.e., obtaining the email content), the default output format is HTML\u003C\u002Fp>\u003Cp>To obtain the email content, change the output format to Text\u003C\u002Fp>\u003Cp>Solution:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F11243911\u002Fews-body-plain-text\u003C\u002Fp>\u003Ch4>5. Specifying deep search when searching custom folders (traversing all folders, including deeper directories)\u003C\u002Fh4>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>FindFoldersResults findResults = null;\u003Cbr>FolderView view = new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep };\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch4>6. Dependency files are still required after compilation\u003C\u002Fh4>\u003Cp>The compiled program still requires the dependency file Microsoft.Exchange.WebServices.dll (in the same directory) during execution\u003C\u002Fp>\u003Ch2>0x04 Using EWS SOAP XML message\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Official Documentation:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fexchange\u002Fclient-developer\u002Fexchange-web-services\u002Fget-started-with-ews-client-applications\u003C\u002Fp>\u003Cp>EWS requests and responses use the SOAP (Simple Object Access Protocol) protocol\u003C\u002Fp>\u003Cp>SOAP message format:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>\u003Csoap-env:envelope various=\"\" attributes=\"\">\u003Cbr>  \u003Csoap:header>\u003Cbr>  \u003C\u002Fsoap:header>\u003Cbr>  \u003Csoap:body>\u003Cbr>  \u003C\u002Fsoap:body>\u003Cbr>\u003C\u002Fsoap-env:envelope>\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Corresponding EWS structure:\u003C\u002Fp>\u003Cul>\u003Cli>Envelope element (required), serves as the identifier for SOAP messages\u003C\u002Fli>\u003Cli>Header element (optional), can be used to specify the Exchange Server version\u003C\u002Fli>\u003Cli>Body element (required), contains all call and response information\u003C\u002Fli>\u003Cli>Fault element (optional), containing error messages\u003C\u002Fli>\u003C\u002Ful>\u003Cp>C Sharp code example (sending email):\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>using System;\u003Cbr>using System.Net;\u003Cbr>using System.IO;\u003Cbr>using System.Text;\u003Cbr>namespace EMAIL_EWS\u003Cbr>{\u003Cbr>    class Program\u003Cbr>    {\u003Cbr>        static void Main(string[] args)\u003Cbr>        {\u003Cbr>            String user = \"test1\";\u003Cbr>            String password = \"test123!\";\u003Cbr>            String readPath = \"\"\u003Cbr>            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =&gt; { return true; };          \u003Cbr>            StreamReader sendData = new StreamReader(\"ews.xml\", Encoding.Default);\u003Cbr>            byte[] sendDataByte = Encoding.UTF8.GetBytes(sendData.ReadToEnd());\u003Cbr>            sendData.Close();\u003Cbr>            try\u003Cbr>            {\u003Cbr>                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(\"https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx\");\u003Cbr>                request.Method = \"POST\";\u003Cbr>                request.ContentType = \"text\u002Fxml\";\u003Cbr>                request.ContentLength = sendDataByte.Length;\u003Cbr>                request.AllowAutoRedirect = false;\u003Cbr>                request.Credentials = new NetworkCredential(user, password);\u003Cbr>                Stream requestStream = request.GetRequestStream();\u003Cbr>                requestStream.Write(sendDataByte, 0, sendDataByte.Length);\u003Cbr>                requestStream.Close();\u003Cbr>\u003Cbr>                HttpWebResponse response = (HttpWebResponse)request.GetResponse();\u003Cbr>                if (response.StatusCode != HttpStatusCode.OK)\u003Cbr>                {\u003Cbr>                    throw new WebException(response.StatusDescription);\u003Cbr>                }\u003Cbr>                Stream receiveStream = response.GetResponseStream();\u003Cbr>                \u003Cbr>                StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);\u003Cbr>\u003Cbr>                String receiveString = readStream.ReadToEnd();\u003Cbr>                response.Close();\u003Cbr>                readStream.Close();\u003Cbr>\u003Cbr>                StreamWriter receiveData = new StreamWriter(\"out.xml\");\u003Cbr>                receiveData.Write(receiveString);                         \u003Cbr>                receiveData.Close();                                        \u003Cbr>            }\u003Cbr>            catch (WebException e)\u003Cbr>            {\u003Cbr>                Console.WriteLine(\"[!]{0}\", e.Message);\u003Cbr>                Environment.Exit(0);\u003Cbr>            }\u003Cbr>            Console.WriteLine(\"[+]Done\");\u003Cbr>        }\u003Cbr>    }\u003Cbr>}\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>The code reads the content of the file ems.xml and sends it, saving the result as out.xml\u003C\u002Fp>\u003Cp>The content of ems.xml is for sending an email:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>\u003C!--?xml version=\"1.0\" encoding=\"utf-8\"?-->\u003Cbr>\u003Csoap:envelope xmlns:xsi=\"http:\u002F\u002Fwww.w3.org\u002F2001\u002FXMLSchema-instance\" \u003Cbr=\"\">               xmlns:m=\"http:\u002F\u002Fschemas.microsoft.com\u002Fexchange\u002Fservices\u002F2006\u002Fmessages\" \u003Cbr>               xmlns:t=\"http:\u002F\u002Fschemas.microsoft.com\u002Fexchange\u002Fservices\u002F2006\u002Ftypes\" \u003Cbr>               xmlns:soap=\"http:\u002F\u002Fschemas.xmlsoap.org\u002Fsoap\u002Fenvelope\u002F\"&gt;\u003Cbr>\u003Csoap:header>\u003Cbr>    \u003Ct:requestserverversion version=\"Exchange2013_SP1\">\u003Cbr>  \u003C\u002Ft:requestserverversion>\u003C\u002Fsoap:header>\u003Cbr>  \u003Csoap:body>\u003Cbr>    \u003Cm:createitem messagedisposition=\"SendAndSaveCopy\">\u003Cbr>      \u003Cm:saveditemfolderid>\u003Cbr>        \u003Ct:distinguishedfolderid id=\"sentitems\">\u003Cbr>      \u003C\u002Ft:distinguishedfolderid>\u003C\u002Fm:saveditemfolderid>\u003Cbr>      \u003Cm:items>\u003Cbr>        \u003Ct:message>\u003Cbr>          \u003Ct:subject>This is Subject\u003C\u002Ft:subject>\u003Cbr>          \u003Ct:body bodytype=\"HTML\">This is Body\u003C\u002Ft:body>\u003Cbr>          \u003Ct:torecipients>\u003Cbr>            \u003Ct:mailbox>\u003Cbr>              \u003Ct:emailaddress>test1@test.com\u003C\u002Ft:emailaddress>\u003Cbr>              \u003C\u002Ft:mailbox>\u003Cbr>          \u003C\u002Ft:torecipients>\u003Cbr>        \u003C\u002Ft:message>\u003Cbr>      \u003C\u002Fm:items>\u003Cbr>    \u003C\u002Fm:createitem>\u003Cbr>  \u003C\u002Fsoap:body>\u003Cbr>\u003C\u002Fsoap:envelope>\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>The returned content (out.xml) is shown in the figure below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fuploads\u002Fdocx_image_1770017966602_1_a83c00a981.jpeg\">\u003C\u002Fp>\u003Cp>ResponseCode is NoError, indicating the operation was successful\u003C\u002Fp>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>The above code does not require dependency on the file Microsoft.Exchange.WebServices.dll\u003C\u002Fp>\u003Cp>However, if you need to use the Autodiscover service, dependency on the file Microsoft.Exchange.WebServices.dll is still required\u003C\u002Fp>\u003Ch2>0x05 Open-source implementation code ewsManage\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>I have integrated the above two methods into a single project and added more practical features. Code download address:\u003C\u002Fp>\u003Cp>An open-source project\u003C\u002Fp>\u003Cp>Currently supports the following features:\u003C\u002Fp>\u003Cul>\u003Cli>Supports EWS Managed API and EWS SOAP\u003C\u002Fli>\u003Cli>Supports logging into the mailbox using username\u002Fpassword or current credentials\u003C\u002Fli>\u003Cli>Supports ignoring untrusted certificates\u003C\u002Fli>\u003Cli>Lists emails in a specified location, including file names in attachments and email content\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(Judges the length of email content; if it exceeds 100 characters, only the first 100 characters are displayed)\u003C\u002Fp>\u003Cul>\u003Cli>Lists unread emails in a specified location, including file names in attachments and email content\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(Judges the length of email content; if it exceeds 100 characters, only the first 100 characters are displayed)\u003C\u002Fp>\u003Cul>\u003Cli>Lists custom folders in a specified location (traverses all subfolders)\u003C\u002Fli>\u003Cli>Views all emails under a custom folder\u003C\u002Fli>\u003Cli>Views unread emails under a custom folder\u003C\u002Fli>\u003Cli>Saves all emails in a specified location (in EML format)\u003C\u002Fli>\u003Cli>Saves attachments from a specified email (by ID)\u003C\u002Fli>\u003Cli>Add attachment to specified email (by ID)\u003C\u002Fli>\u003Cli>Delete attachment from specified email (by ID)\u003C\u002Fli>\u003Cli>Delete all attachments from specified email\u003C\u002Fli>\u003Cli>Search emails with specified keywords (common locations, search subject, attachment names, and email body)\u003C\u002Fli>\u003Cli>Delete specified email (by ID)\u003C\u002Fli>\u003Cli>View specific content of an email (by ID)\u003C\u002Fli>\u003Cli>Send email (using EWS SOAP)\u003C\u002Fli>\u003Cli>Read XML file and send commands via EWS SOAP\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Supported locations for query and operation:\u003C\u002Fp>\u003Cul>\u003Cli>Inbox\u003C\u002Fli>\u003Cli>Drafts\u003C\u002Fli>\u003Cli>Sent Items\u003C\u002Fli>\u003Cli>Deleted Items\u003C\u002Fli>\u003Cli>Outbox\u003C\u002Fli>\u003Cli>Junk Email\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Usage example:\u003C\u002Fp>\u003Cp>(1)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation Yes -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ListUnreadMail -Folder Inbox\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Using certificate validation, logging in via URL, viewing all unread emails in the inbox, outputting the following email information:\u003C\u002Fp>\u003Cul>\u003Cli>Subject\u003C\u002Fli>\u003Cli>HasAttachments\u003C\u002Fli>\u003Cli>ItemId\u003C\u002Fli>\u003Cli>DateTimeCreated\u003C\u002Fli>\u003Cli>DateTimeReceived\u003C\u002Fli>\u003Cli>DateTimeSent\u003C\u002Fli>\u003Cli>DisplayCc:\u003C\u002Fli>\u003Cli>DisplayTo\u003C\u002Fli>\u003Cli>InReplyTo:\u003C\u002Fli>\u003Cli>Size\u003C\u002Fli>\u003Cli>MessageBody (if longer than 100 characters, only display the first 100 characters)\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(2)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -use the default credentials -AutodiscoverUrl test1@test.com -Mode ListMail -Folder SentItems\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Ignore certificate validation, use current credentials for automatic login, invoke Autodiscover service, view information of all sent emails, output information categories same as (1)\u003C\u002Fp>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>Can be combined with mimikatz's Overpass-the-hash to achieve Exchange login via hash\u003C\u002Fp>\u003Cp>(3)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ListFolder -Folder Inbox\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Ignore certificate validation, use URL login, view information of all custom folders in the inbox, output the following information:\u003C\u002Fp>\u003Cul>\u003Cli>DisplayName\u003C\u002Fli>\u003Cli>Id\u003C\u002Fli>\u003Cli>TotalCount (number of emails in this custom folder)\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(4)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ListMailofFolder -Id AAMaADFlMjRjMdM2LTgxZTUtNGRmZC05ZDQyLTMzNDFlMzBmZWY1NwAzAAAAAAAR9UOK286vT6HjUgukBQGmAQBHzR2O8KNmTcffGwlY0A76AAAAADfqAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>View all emails in the specified custom folder (filtered by Id), output information categories same as (1)\u003C\u002Fp>\u003Cp>(5)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ExportMail -Folder Inbox\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Save all emails in the Inbox as eml files\u003C\u002Fp>\u003Cp>(6)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode SaveAttachment -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Save attachments from the specified email (filtered by Id), output path is the current directory\u003C\u002Fp>\u003Cp>(7)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode AddAttachment -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA= -AttachmentFile 1.txt\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Add an attachment to the specified email (filtered by Id), attachment name is 1.txt\u003C\u002Fp>\u003Cp>(8)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode DeleteAttachment -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA= -AttachmentFile 1.txt\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Delete a specific attachment from the specified email (filtered by Id), attachment name is 1.txt\u003C\u002Fp>\u003Cp>(9)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ClearAllAttachment -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Delete all attachments from the specified email (filtered by Id)\u003C\u002Fp>\u003Cp>(10)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode SearchMail -String vpn\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Search for emails with the specified keyword 'vpn'\u003C\u002Fp>\u003Cp>Folder location:\u003C\u002Fp>\u003Cul>\u003Cli>Inbox\u003C\u002Fli>\u003Cli>Drafts\u003C\u002Fli>\u003Cli>Sent Items\u003C\u002Fli>\u003Cli>Deleted Items\u003C\u002Fli>\u003Cli>Outbox\u003C\u002Fli>\u003Cli>Junk Email\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Email location:\u003C\u002Fp>\u003Cul>\u003Cli>Subject\u003C\u002Fli>\u003Cli>Attachment Name\u003C\u002Fli>\u003Cli>Email Body\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(11)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode DeleteMail -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Completely delete specified email (filtered by Id)\u003C\u002Fp>\u003Cp>(12)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ViewMail -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>View specific content of an email (specified ID), including complete body content\u003C\u002Fp>\u003Cp>(13)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ReadXML -Path ews.xml\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Read commands from ews.xml file and send via EWS SOAP\u003C\u002Fp>\u003Ch2>0x06 Summary\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>This article introduces two methods for accessing Exchange resources, and the open-source project ewsManage, facilitating subsequent secondary development.\u003C\u002Fp>\u003C\u002Fbody>\u003C\u002Fhtml>","text","ltr","\u003Chtml>\u003Chead>\u003C\u002Fhead>\u003Cbody>\u003Ch2>0x00 Preface\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Exchange Web Service (EWS) provides an interface for accessing Exchange resources. Since I couldn't find suitable reference projects on GitHub, I systematically organized this topic and open-sourced an EWS implementation code named ewsManage to facilitate subsequent secondary development.\u003C\u002Fp>\u003Ch2>0x01 Introduction\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>This article will cover the following:\u003C\u002Fp>\u003Cul>\u003Cli>Using EWS Managed API to access Exchange resources\u003C\u002Fli>\u003Cli>Using EWS SOAP XML messages to access Exchange resources\u003C\u002Fli>\u003Cli>Open-source code ewsManage\u003C\u002Fli>\u003Cli>Features of ewsManage\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>0x02 Introduction\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Official documentation:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fexchange\u002Fclient-developer\u002Fexchange-server-development\u003C\u002Fp>\u003Cp>Two methods to access Exchange resources:\u003C\u002Fp>\u003Cul>\u003Cli>Using EWS Managed API\u003C\u002Fli>\u003Cli>Using EWS SOAP XML messages\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Test environment:\u003C\u002Fp>\u003Cul>\u003Cli>Exchange Server 2013 SP1\u003C\u002Fli>\u003Cli>user: test1@test.com\u003C\u002Fli>\u003Cli>pwd: test123!\u003C\u002Fli>\u003Cli>url: https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx\u003C\u002Fli>\u003Cli>AutodiscoverUrl: test1@test.com\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>0x03 Using EWS Managed API\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Official documentation:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fexchange\u002Fclient-developer\u002Fexchange-web-services\u002Fget-started-with-ews-managed-api-client-applications\u003C\u002Fp>\u003Cp>Here using EWS Managed API 2.0\u003C\u002Fp>\u003Cp>Download link:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fdownload\u002Fdetails.aspx?id=35371\u003C\u002Fp>\u003Cp>After installation, locate the files Microsoft.Exchange.WebServices.dll and Microsoft.Exchange.WebServices.xml in the folder\u003C\u002Fp>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>If you already have these two files, you do not need to install EwsManagedApi.msi. These files can be found in the later open-source project ewsManage\u003C\u002Fp>\u003Ch3>(1) C Sharp Implementation\u003C\u002Fh3>\u003Cp>Development environment: VS2015\u003C\u002Fp>\u003Cp>Create a new project and reference the files:\u003C\u002Fp>\u003Cp>Microsoft.Exchange.WebServices.dll and Microsoft.Exchange.WebServices.xml\u003C\u002Fp>\u003Cp>C Sharp code example (list all email subjects in the inbox):\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>using System;\u003Cbr>using Microsoft.Exchange.WebServices.Data;\u003Cbr>using System.Net;\u003Cbr>namespace EMAIL_EWS\u003Cbr>{\u003Cbr>    class Program\u003Cbr>    {\u003Cbr>        static void Main(string[] args)\u003Cbr>        {\u003Cbr>            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =&gt; { return true; };\u003Cbr>            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);\u003Cbr>            service.Credentials = new WebCredentials(\"test1\", \"test123!\");\u003Cbr>            service.AutodiscoverUrl(\"test1@test.com\");\u003Cbr>            ItemView view = new ItemView(int.MaxValue);\u003Cbr>            FindItemsResults\u003Citem> findResults = service.FindItems(WellKnownFolderName.Inbox, view);\u003Cbr>            foreach (Item item in findResults.Items)\u003Cbr>            {\u003Cbr>                if (item.Subject != null)\u003Cbr>                {\u003Cbr>                    Console.WriteLine(item.Subject);\u003Cbr>                }\u003Cbr>                else\u003Cbr>                {\u003Cbr>                    Console.WriteLine(\"no Title\\r\\n\");\u003Cbr>                }\u003Cbr>            }\u003Cbr>        }\u003Cbr>    }\u003Cbr>}\u003C\u002Fitem>\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>(2)Powershell Implementation\u003C\u002Fh3>\u003Cp>Powershell code example (list titles of all emails in the inbox):\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>add-type @\"\u003Cbr>    using System.Net;\u003Cbr>    using System.Security.Cryptography.X509Certificates;\u003Cbr>    public class TrustAllCertsPolicy : ICertificatePolicy {\u003Cbr>        public bool CheckValidationResult(\u003Cbr>            ServicePoint srvPoint, X509Certificate certificate,\u003Cbr>            WebRequest request, int certificateProblem) {\u003Cbr>            return true;\u003Cbr>        }\u003Cbr>    }\u003Cbr>\"@\u003Cbr>[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy\u003Cbr>Import-Module -Name \"C:\\test\\Microsoft.Exchange.WebServices.dll\"\u003Cbr>$Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials(\"test1\",\"test123!\")\u003Cbr>$exchService = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService\u003Cbr>$exchService.Credentials = $Credentials\u003Cbr>$exchService.AutodiscoverUrl(\"test1@test.com\")\u003Cbr>$exchService\u003Cbr>$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($exchService,[Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)\u003Cbr>$inbox|gm\u003Cbr>$ms = $inbox.FindItems(10) \u003Cbr>foreach ($m in $ms)\u003Cbr>{\u003Cbr>$m.Load()\u003Cbr>$m.subject\u003Cbr>}\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>Powershell also requires Microsoft.Exchange.WebServices.dll\u003C\u002Fp>\u003Cp>Details to note in program development are as follows:\u003C\u002Fp>\u003Ch4>1. The Exchange Server certificate is untrusted\u003C\u002Fh4>\u003Cp>This causes the certificate to appear untrusted when accessing via IE, requiring a click on Continue to access normally, as shown in the figure below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fapi\u002Fmedia\u002Ffile\u002Fdocx_image_1770017956173_0_7622e0379d-1.jpeg\">\u003C\u002Fp>\u003Cp>During program implementation, an error will occur with the following prompt:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>The underlying connection was closed. Could not establish a secure SSL\u002FTLS connection\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>This issue can be avoided by adding a certificate trust policy:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>using System.Net;\u003Cbr>ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =&gt; { return true; };\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch4>2. Autodiscover Service\u003C\u002Fh4>\u003Cp>Used to simplify user configuration process. In terms of program implementation, it corresponds to ExchangeService.AutodiscoverUrl\u003C\u002Fp>\u003Cp>Reference:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fmsdn.microsoft.com\u002Fen-us\u002Flibrary\u002Foffice\u002Fdd634273(v=exchg.80).aspx\u003C\u002Fp>\u003Cp>Input email address to automatically resolve the Exchange Server Url\u003C\u002Fp>\u003Cp>Usage example:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);\u003Cbr>service.AutodiscoverUrl(\"test1@test.com\", RedirectionUrlValidationCallback);\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Equivalent to\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);\u003Cbr>service.Url = new Uri(\"https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx\");\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>In actual use, if the Exchange Server disables the Autodiscover service, you can choose to specify the Url directly\u003C\u002Fp>\u003Ch4>3..NET Framework 4 and .NET Framework 3.5\u003C\u002Fh4>\u003Cp>.NET Framework 4 is the recommended development environment\u003C\u002Fp>\u003Cp>Win7 system defaults to .NET Framework 3.5 and does not support .NET Framework 4\u003C\u002Fp>\u003Cp>To support Win7, specify the project as .NET Framework 3.5, which does not affect the use of EWS Managed API\u003C\u002Fp>\u003Ch4>4. Reading the body property of emails in plain text\u003C\u002Fh4>\u003Cp>When reading the body property of emails (i.e., obtaining the email content), the default output format is HTML\u003C\u002Fp>\u003Cp>To obtain the email content, change the output format to Text\u003C\u002Fp>\u003Cp>Solution:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F11243911\u002Fews-body-plain-text\u003C\u002Fp>\u003Ch4>5. Specifying deep search when searching custom folders (traversing all folders, including deeper directories)\u003C\u002Fh4>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>FindFoldersResults findResults = null;\u003Cbr>FolderView view = new FolderView(int.MaxValue) { Traversal = FolderTraversal.Deep };\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch4>6. Dependency files are still required after compilation\u003C\u002Fh4>\u003Cp>The compiled program still requires the dependency file Microsoft.Exchange.WebServices.dll (in the same directory) during execution\u003C\u002Fp>\u003Ch2>0x04 Using EWS SOAP XML message\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Official Documentation:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fdocs.microsoft.com\u002Fen-us\u002Fexchange\u002Fclient-developer\u002Fexchange-web-services\u002Fget-started-with-ews-client-applications\u003C\u002Fp>\u003Cp>EWS requests and responses use the SOAP (Simple Object Access Protocol) protocol\u003C\u002Fp>\u003Cp>SOAP message format:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>\u003Csoap-env:envelope various=\"\" attributes=\"\">\u003Cbr>  \u003Csoap:header>\u003Cbr>  \u003C\u002Fsoap:header>\u003Cbr>  \u003Csoap:body>\u003Cbr>  \u003C\u002Fsoap:body>\u003Cbr>\u003C\u002Fsoap-env:envelope>\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Corresponding EWS structure:\u003C\u002Fp>\u003Cul>\u003Cli>Envelope element (required), serves as the identifier for SOAP messages\u003C\u002Fli>\u003Cli>Header element (optional), can be used to specify the Exchange Server version\u003C\u002Fli>\u003Cli>Body element (required), contains all call and response information\u003C\u002Fli>\u003Cli>Fault element (optional), containing error messages\u003C\u002Fli>\u003C\u002Ful>\u003Cp>C Sharp code example (sending email):\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>using System;\u003Cbr>using System.Net;\u003Cbr>using System.IO;\u003Cbr>using System.Text;\u003Cbr>namespace EMAIL_EWS\u003Cbr>{\u003Cbr>    class Program\u003Cbr>    {\u003Cbr>        static void Main(string[] args)\u003Cbr>        {\u003Cbr>            String user = \"test1\";\u003Cbr>            String password = \"test123!\";\u003Cbr>            String readPath = \"\"\u003Cbr>            ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) =&gt; { return true; };          \u003Cbr>            StreamReader sendData = new StreamReader(\"ews.xml\", Encoding.Default);\u003Cbr>            byte[] sendDataByte = Encoding.UTF8.GetBytes(sendData.ReadToEnd());\u003Cbr>            sendData.Close();\u003Cbr>            try\u003Cbr>            {\u003Cbr>                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(\"https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx\");\u003Cbr>                request.Method = \"POST\";\u003Cbr>                request.ContentType = \"text\u002Fxml\";\u003Cbr>                request.ContentLength = sendDataByte.Length;\u003Cbr>                request.AllowAutoRedirect = false;\u003Cbr>                request.Credentials = new NetworkCredential(user, password);\u003Cbr>                Stream requestStream = request.GetRequestStream();\u003Cbr>                requestStream.Write(sendDataByte, 0, sendDataByte.Length);\u003Cbr>                requestStream.Close();\u003Cbr>\u003Cbr>                HttpWebResponse response = (HttpWebResponse)request.GetResponse();\u003Cbr>                if (response.StatusCode != HttpStatusCode.OK)\u003Cbr>                {\u003Cbr>                    throw new WebException(response.StatusDescription);\u003Cbr>                }\u003Cbr>                Stream receiveStream = response.GetResponseStream();\u003Cbr>                \u003Cbr>                StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);\u003Cbr>\u003Cbr>                String receiveString = readStream.ReadToEnd();\u003Cbr>                response.Close();\u003Cbr>                readStream.Close();\u003Cbr>\u003Cbr>                StreamWriter receiveData = new StreamWriter(\"out.xml\");\u003Cbr>                receiveData.Write(receiveString);                         \u003Cbr>                receiveData.Close();                                        \u003Cbr>            }\u003Cbr>            catch (WebException e)\u003Cbr>            {\u003Cbr>                Console.WriteLine(\"[!]{0}\", e.Message);\u003Cbr>                Environment.Exit(0);\u003Cbr>            }\u003Cbr>            Console.WriteLine(\"[+]Done\");\u003Cbr>        }\u003Cbr>    }\u003Cbr>}\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>The code reads the content of the file ems.xml and sends it, saving the result as out.xml\u003C\u002Fp>\u003Cp>The content of ems.xml is for sending an email:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>\u003C!--?xml version=\"1.0\" encoding=\"utf-8\"?-->\u003Cbr>\u003Csoap:envelope xmlns:xsi=\"http:\u002F\u002Fwww.w3.org\u002F2001\u002FXMLSchema-instance\" \u003Cbr=\"\">               xmlns:m=\"http:\u002F\u002Fschemas.microsoft.com\u002Fexchange\u002Fservices\u002F2006\u002Fmessages\" \u003Cbr>               xmlns:t=\"http:\u002F\u002Fschemas.microsoft.com\u002Fexchange\u002Fservices\u002F2006\u002Ftypes\" \u003Cbr>               xmlns:soap=\"http:\u002F\u002Fschemas.xmlsoap.org\u002Fsoap\u002Fenvelope\u002F\"&gt;\u003Cbr>\u003Csoap:header>\u003Cbr>    \u003Ct:requestserverversion version=\"Exchange2013_SP1\">\u003Cbr>  \u003C\u002Ft:requestserverversion>\u003C\u002Fsoap:header>\u003Cbr>  \u003Csoap:body>\u003Cbr>    \u003Cm:createitem messagedisposition=\"SendAndSaveCopy\">\u003Cbr>      \u003Cm:saveditemfolderid>\u003Cbr>        \u003Ct:distinguishedfolderid id=\"sentitems\">\u003Cbr>      \u003C\u002Ft:distinguishedfolderid>\u003C\u002Fm:saveditemfolderid>\u003Cbr>      \u003Cm:items>\u003Cbr>        \u003Ct:message>\u003Cbr>          \u003Ct:subject>This is Subject\u003C\u002Ft:subject>\u003Cbr>          \u003Ct:body bodytype=\"HTML\">This is Body\u003C\u002Ft:body>\u003Cbr>          \u003Ct:torecipients>\u003Cbr>            \u003Ct:mailbox>\u003Cbr>              \u003Ct:emailaddress>test1@test.com\u003C\u002Ft:emailaddress>\u003Cbr>              \u003C\u002Ft:mailbox>\u003Cbr>          \u003C\u002Ft:torecipients>\u003Cbr>        \u003C\u002Ft:message>\u003Cbr>      \u003C\u002Fm:items>\u003Cbr>    \u003C\u002Fm:createitem>\u003Cbr>  \u003C\u002Fsoap:body>\u003Cbr>\u003C\u002Fsoap:envelope>\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>The returned content (out.xml) is shown in the figure below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fapi\u002Fmedia\u002Ffile\u002Fdocx_image_1770017966602_1_a83c00a981-1.jpeg\">\u003C\u002Fp>\u003Cp>ResponseCode is NoError, indicating the operation was successful\u003C\u002Fp>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>The above code does not require dependency on the file Microsoft.Exchange.WebServices.dll\u003C\u002Fp>\u003Cp>However, if you need to use the Autodiscover service, dependency on the file Microsoft.Exchange.WebServices.dll is still required\u003C\u002Fp>\u003Ch2>0x05 Open-source implementation code ewsManage\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>I have integrated the above two methods into a single project and added more practical features. Code download address:\u003C\u002Fp>\u003Cp>An open-source project\u003C\u002Fp>\u003Cp>Currently supports the following features:\u003C\u002Fp>\u003Cul>\u003Cli>Supports EWS Managed API and EWS SOAP\u003C\u002Fli>\u003Cli>Supports logging into the mailbox using username\u002Fpassword or current credentials\u003C\u002Fli>\u003Cli>Supports ignoring untrusted certificates\u003C\u002Fli>\u003Cli>Lists emails in a specified location, including file names in attachments and email content\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(Judges the length of email content; if it exceeds 100 characters, only the first 100 characters are displayed)\u003C\u002Fp>\u003Cul>\u003Cli>Lists unread emails in a specified location, including file names in attachments and email content\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(Judges the length of email content; if it exceeds 100 characters, only the first 100 characters are displayed)\u003C\u002Fp>\u003Cul>\u003Cli>Lists custom folders in a specified location (traverses all subfolders)\u003C\u002Fli>\u003Cli>Views all emails under a custom folder\u003C\u002Fli>\u003Cli>Views unread emails under a custom folder\u003C\u002Fli>\u003Cli>Saves all emails in a specified location (in EML format)\u003C\u002Fli>\u003Cli>Saves attachments from a specified email (by ID)\u003C\u002Fli>\u003Cli>Add attachment to specified email (by ID)\u003C\u002Fli>\u003Cli>Delete attachment from specified email (by ID)\u003C\u002Fli>\u003Cli>Delete all attachments from specified email\u003C\u002Fli>\u003Cli>Search emails with specified keywords (common locations, search subject, attachment names, and email body)\u003C\u002Fli>\u003Cli>Delete specified email (by ID)\u003C\u002Fli>\u003Cli>View specific content of an email (by ID)\u003C\u002Fli>\u003Cli>Send email (using EWS SOAP)\u003C\u002Fli>\u003Cli>Read XML file and send commands via EWS SOAP\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Supported locations for query and operation:\u003C\u002Fp>\u003Cul>\u003Cli>Inbox\u003C\u002Fli>\u003Cli>Drafts\u003C\u002Fli>\u003Cli>Sent Items\u003C\u002Fli>\u003Cli>Deleted Items\u003C\u002Fli>\u003Cli>Outbox\u003C\u002Fli>\u003Cli>Junk Email\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Usage example:\u003C\u002Fp>\u003Cp>(1)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation Yes -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ListUnreadMail -Folder Inbox\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Using certificate validation, logging in via URL, viewing all unread emails in the inbox, outputting the following email information:\u003C\u002Fp>\u003Cul>\u003Cli>Subject\u003C\u002Fli>\u003Cli>HasAttachments\u003C\u002Fli>\u003Cli>ItemId\u003C\u002Fli>\u003Cli>DateTimeCreated\u003C\u002Fli>\u003Cli>DateTimeReceived\u003C\u002Fli>\u003Cli>DateTimeSent\u003C\u002Fli>\u003Cli>DisplayCc:\u003C\u002Fli>\u003Cli>DisplayTo\u003C\u002Fli>\u003Cli>InReplyTo:\u003C\u002Fli>\u003Cli>Size\u003C\u002Fli>\u003Cli>MessageBody (if longer than 100 characters, only display the first 100 characters)\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(2)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -use the default credentials -AutodiscoverUrl test1@test.com -Mode ListMail -Folder SentItems\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Ignore certificate validation, use current credentials for automatic login, invoke Autodiscover service, view information of all sent emails, output information categories same as (1)\u003C\u002Fp>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>Can be combined with mimikatz's Overpass-the-hash to achieve Exchange login via hash\u003C\u002Fp>\u003Cp>(3)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ListFolder -Folder Inbox\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Ignore certificate validation, use URL login, view information of all custom folders in the inbox, output the following information:\u003C\u002Fp>\u003Cul>\u003Cli>DisplayName\u003C\u002Fli>\u003Cli>Id\u003C\u002Fli>\u003Cli>TotalCount (number of emails in this custom folder)\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(4)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ListMailofFolder -Id AAMaADFlMjRjMdM2LTgxZTUtNGRmZC05ZDQyLTMzNDFlMzBmZWY1NwAzAAAAAAAR9UOK286vT6HjUgukBQGmAQBHzR2O8KNmTcffGwlY0A76AAAAADfqAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>View all emails in the specified custom folder (filtered by Id), output information categories same as (1)\u003C\u002Fp>\u003Cp>(5)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ExportMail -Folder Inbox\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Save all emails in the Inbox as eml files\u003C\u002Fp>\u003Cp>(6)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode SaveAttachment -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Save attachments from the specified email (filtered by Id), output path is the current directory\u003C\u002Fp>\u003Cp>(7)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode AddAttachment -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA= -AttachmentFile 1.txt\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Add an attachment to the specified email (filtered by Id), attachment name is 1.txt\u003C\u002Fp>\u003Cp>(8)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode DeleteAttachment -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA= -AttachmentFile 1.txt\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Delete a specific attachment from the specified email (filtered by Id), attachment name is 1.txt\u003C\u002Fp>\u003Cp>(9)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ClearAllAttachment -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Delete all attachments from the specified email (filtered by Id)\u003C\u002Fp>\u003Cp>(10)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode SearchMail -String vpn\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Search for emails with the specified keyword 'vpn'\u003C\u002Fp>\u003Cp>Folder location:\u003C\u002Fp>\u003Cul>\u003Cli>Inbox\u003C\u002Fli>\u003Cli>Drafts\u003C\u002Fli>\u003Cli>Sent Items\u003C\u002Fli>\u003Cli>Deleted Items\u003C\u002Fli>\u003Cli>Outbox\u003C\u002Fli>\u003Cli>Junk Email\u003C\u002Fli>\u003C\u002Ful>\u003Cp>Email location:\u003C\u002Fp>\u003Cul>\u003Cli>Subject\u003C\u002Fli>\u003Cli>Attachment Name\u003C\u002Fli>\u003Cli>Email Body\u003C\u002Fli>\u003C\u002Ful>\u003Cp>(11)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode DeleteMail -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Completely delete specified email (filtered by Id)\u003C\u002Fp>\u003Cp>(12)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ViewMail -Id AAMzADFlMjRjMzM3LTgxZTUzNGRmZC25ZDQyLTMaNDFlMzBwZWY1NwBGAAAAAAAR8UOK236vT6HjUnujBQGmBwBHzR1O8KNmTrjfGwlY0A56AAAAAAEKAABHzR1O8KNmTrjfGzlY2A75AAAAABxFAAA=\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>View specific content of an email (specified ID), including complete body content\u003C\u002Fp>\u003Cp>(13)\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>ewsManage.exe -CerValidation No -ExchangeVersion Exchange2013_SP1 -u test1 -p test123! -ewsPath https:\u002F\u002Ftest.com\u002Fews\u002FExchange.asmx -Mode ReadXML -Path ews.xml\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Cp>Read commands from ews.xml file and send via EWS SOAP\u003C\u002Fp>\u003Ch2>0x06 Summary\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>This article introduces two methods for accessing Exchange resources, and the open-source project ewsManage, facilitating subsequent secondary development.\u003C\u002Fp>\u003C\u002Fbody>\u003C\u002Fhtml>",953,"Onedaysec",8,"published","2026-02-02T07:51:00.058Z",{"title":37,"description":14,"keywords":38,"ogImage":39,"canonicalUrl":39,"noIndex":40},"EWS Development Guide: Access Exchange with Managed API & SOAP","Exchange Web Services, EWS development, EWS Managed API, SOAP XML, Exchange Server, ewsManage, C#, PowerShell",null,false,[],{"docs":43,"hasNextPage":40},[44,45,46,4,47],586,585,584,582,{"title":39,"description":39,"image":39},"2026-07-24T15:37:12.556Z","2026-07-23T16:01:48.014Z","draft","2026-07-23T16:13:32.759Z"]