3.5.1 Common Task 1: Open a File in an SMB File Share
The sequence described in this example details how an application opens a file on an SMB file share.

Figure 19: Sequence diagram for Open a file in an SMB file share
The file client sends an SMB2 Negotiate request to the SMB file services (as described in [MS-SMB2] section 2.2.3) in order to notify the server about the dialects of the SMB2 protocol that the client understands.
The SMB file service responds to the file client with an SMB2 Negotiate response (see [MS-SMB2] section 2.2.4), in order to notify the client of the preferred common dialect.
The file client attempts to establish a session with SMB file service using the SMB2 SESSION_SETUP request, described in [MS-SMB2] section 2.2.5.
The SMB file service responds with an SMB2 SESSION_SETUP response, as described in [MS-SMB2] section 2.2.6.
The file client attempts to establish a tree connection between the file client and the SMB file service using an SMB2 TREE_CONNECT request (see [MS-SMB2] section 2.2.9) using the session identifier session_id previously obtained in step 4 and the UNC path to the selected SMB file share provided by the application.
The SMB file service sends an SMB2 TREE_CONNECT response (see [MS-SMB2] section 2.2.10) with details of the tree connection, including an identifier tree_id that the SMB file client can use to identify subsequent requests that use the tree connection.
Once the file client has identified a suitable tree connection for the SMB file share specified in step 5, it sends an SMB2 CREATE Request to the SMB file service to request that a file specified by the application be opened.
Once the SMB file service has processed the SMB2 CREATE Request, it sends an SMB2 CREATE response (see [MS-SMB2] section 2.2.14) that contains the result of the SMB2 CREATE request. (This process is described further in [MS-SMB2] section 3.2.4.3.) If the operation was successful, the SMB File service generates a handle that is returned to the File client for use when performing subsequent operations against the file.