public static Parse ( byte rawData ) : |
||
rawData | byte | The raw data which is returned by server. |
Результат |
/// <summary> /// The private method to connect the exchange server through MAPIHTTP transport. /// </summary> /// <param name="mailStoreUrl">The mail store Url.</param> /// <param name="domain">The domain the server is deployed.</param> /// <param name="userName">The domain account name</param> /// <param name="userDN">User's distinguished name (DN).</param> /// <param name="password">user Password.</param> /// <returns>If the method succeeds, the return value is 0. If the method fails, the return value is an implementation-specific error code.</returns> public uint Connect(string mailStoreUrl, string domain, string userName, string userDN, string password) { uint returnValue = 0; this.domain = domain; this.userPassword = password; this.mailStoreUrl = mailStoreUrl; this.userName = userName; ConnectRequestBody connectBody = new ConnectRequestBody(); connectBody.UserDN = userDN; // The server MUST NOT compress ROP response payload (rgbOut) or auxiliary payload (rgbAuxOut). connectBody.Flags = 0x00000001; // The code page in which text data is sent. connectBody.Cpid = 1252; // The local ID for everything other than sorting. connectBody.LcidString = 0x00000409; // The local ID for sorting. connectBody.LcidSort = 0x00000409; connectBody.AuxiliaryBufferSize = 0; connectBody.AuxiliaryBuffer = new byte[] { }; if (this.cookies == null) { this.cookies = new CookieCollection(); } HttpWebResponse response = SendMAPIHttpRequest(this.site, mailStoreUrl, userName, domain, password, connectBody, "Connect", this.cookies); string transferEncoding = response.Headers["Transfer-Encoding"]; string pendingInterval = response.Headers["X-PendingPeriod"]; string responseCode = response.Headers["X-ResponseCode"]; if (transferEncoding != null) { if (string.Compare(transferEncoding, "chunked") == 0) { byte[] rawBuffer = ReadHttpResponse(response); returnValue = uint.Parse(responseCode); if (returnValue == 0) { ChunkedResponse chunkedResponse = ChunkedResponse.ParseChunkedResponse(rawBuffer); ConnectSuccessResponseBody responseSuccess = ConnectSuccessResponseBody.Parse(chunkedResponse.ResponseBodyRawData); } else { this.site.Assert.Fail("Can't connect the server through MAPI over HTTP, the error code is: {0}", responseCode); } } } response.GetResponseStream().Close(); this.cookies = response.Cookies; return(returnValue); }