Author: Saddam Shaikh
In this article, we will check how to read files from a network drive and write a file to a network drive.
What is SMB?
The Server Message Block Protocol (SMB protocol) is a network file sharing protocol to access remote files. It is used for sharing files, printers, serial ports, and other resources on share/network drive. Using this protocol, we can communicate with any server that is configured to receive an SMB client request.
By default, SMB protocol is disabled on Windows. Check the article to enable SMB protocol on Windows.
Prerequisite:
- Anypoint Platform Account.
- Anypoint Studio 7.6 or later.
- SMB share and its authentication credentials. I have created SMB as a shared drive for this integration.

Let’s start with Integration
Follow the below steps to read & write files from/to SMB share:
1. Download SMB Connector from Exchange. (Version = 3.0.1)
2. Add SMB Connector Config in Global Elements. Configure below parameters.
Domain: Enter the Windows domain for the user to log in with
Host: Hostname of server hosting a shared drive
Share: The named path of shared drive
Username: Enter the username to login
Password: Enter the corresponding password
File age: Minimum age of file to perform the operation

3. Perform a Test Connection to make sure connection details are correct.

4. Read a file from a shared drive using SMB File Read operation. Refer to the below File Read configuration.

Test SMB file read flow using Postman. Output MIME Type is “application/octet-stream”.

5. Write a file to the network drive using SMB File Write operation. Refer below File Write configuration.
Test SMB file write flow using Postman.


Hope, this article helps you. Thanks for reading.
References:
https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-smb-connector/