4.1 Establish a New Session Context

In this scenario the client establishes a new Session Context with the server before sending or receiving emails. The client sends a request (section 2.2.2.1) using an X-RequestType header field value of Connect, as described in section 2.2.3.3.1, and includes the Connect request type request body as described in section 2.2.4.1.1.

Client request

 POST <Autodiscover-provided endpoint> HTTP/1.1
 Host: <URL of the host server>
 Content-Length: <length of REQUEST BODY>
 Content-Type: application/mapi-http
 X-RequestType: Connect
 X-ClientInfo: <opaque string>
 X-RequestId: <unique identifier>
 X-ClientApplication: <client version>
  
 <REQUEST BODY>

The server processes the request and returns a response, as described in section 2.2.2.2, that includes the session context cookie that identifies the new Session Context, and the Connect request type success response body, as described in section 2.2.4.1.2.

Server response

 HTTP/1.1 200 OK
 Content-Length: <length of META-TAGS, ADDITIONAL HEADERS and RESPONSE BODY>
 Content-Type: application/mapi-http
 Set-Cookie: <session context cookie>=<opaque string>
 Set-Cookie: <request sequence cookie>=<opaque string>
 X-PendingPeriod: 15000
 X-RequestType: Connect
 X-RequestId: <unique identifier>
 X-ResponseCode: 0
 X-ClientInfo: <opaque string>
 X-ServerApplication: <server version>
 X-ExpirationInfo: <milliseconds>
  
 PROCESSING<CLRF>
 DONE<CRLF>
 X-ResponseCode: 0
 X-ElapsedTime: <milliseconds>
 X-StartTime: <date/time>
 <CRLF>
 <RESPONSE BODY>