3.2 Example 2: Deleting an SMB Share
This example demonstrates the use cases described in section 18.104.22.168.
The sequence in this example describes how the application deletes an SMB share from a given server.
The admin tool has acquired an RPC calling context.
Initial System State
Final System State
The specified share is removed from the list of shares that are available from that server.
The following sequence diagram shows the steps to delete an SMB share.
Figure 12: Sequence diagram for deleting an SMB share
Sequence of Events
The SMB File Service returns ERROR_SUCCESS to confirm that the share exists.
The admin client calls the NetrConnectionEnum method ([MS-SRVS] section 22.214.171.124) to check if the share is currently accessed.
The SMB File Service returns a success code with TotalEntries as 0 to indicate that the share is not currently accessed.
The admin client calls the NetrShareDel method ([MS-SRVS] section 126.96.36.199) after checking that the share is not in use.
The SMB File Service removes the share name from the share list and returns a success code to the admin client.
In Windows-based implementations, the Shared Folders snap-in is used as the admin tool to centrally manage file shares on a computer. The Shared Folders snap-in calls the NetrShareEnum method ([MS-SRVS] section 188.8.131.52) to enumerate the share entries in the ShareList.