This application uses pre-packaged tools to intelligently connect with Microsoft Sharepoint Online. Based on a simple use case, the application takes a CSV file of contacts and uploads it to Sharepoint Online instance.
This document assumes that you are familiar with Mule and the Anypoint™ Studio interface. To increase your familiarity with Studio, consider completing one or more Anypoint Studio Tutorials. Further, this example assumes that you have a basic understanding of Mule flows, Mule Global Elements, and Studio's File connector and Flow Variable
This document describes the details of the example within the context of Anypoint Studio, Mule ESB’s graphical user interface.
Note: Be sure to have Microsoft SharePoint 2013 connector installed in your Anypoint Studio.
Through a simple example, this application employs complex functionality to demonstrate a basic use case. The application accepts CSV file and uploads it into a MS Sharepoint Online instance under the specified folder. If the folder hasn't existed already, it is created before uploading the CSV file.
Complete the following procedure to create, then run this example in your own instance of Anypoint Studio.
-
Open the Example project in Anypoint Studio from Anypoint Exchange. Do not run the application.
-
In your application in Studio, click the Global Elements tab.
-
Double-click the Microsoft SharePoint 2013: Online Connection global element to open its Global Element Properties panel.
-
Change the contents of the Username, Password and Site Url fields to your account-specific values as follows:
Username <USERNAME>@<COMPANY_NAME>.onmicrosoft.com Password <PASSWORD> Site Url https://<COMPANY_NAME>.sharepoint.com
-
Then click OK to save your changes.
-
In your application in Studio, click the Message Flow tab.
-
Replace the ${csvImportFolder} value in Create folder in Sharepoint and Add file to Sharepoint connectors with valid value (for example: my_folder)
-
In the Package Explorer, right-click the importing-a-csv-file-into-ms-sharepoint project name, then select Run As > Mule Application. Studio runs the application on the embedded server.
-
This project includes a sample CSV file, called contacts.csv, that you can use to witness end-to-end functionality of the application. In the Package Explorer, click the src/main/resources folder to expand it, then find the contacts.csv file inside this folder.
-
Click and drag the contacts.csv file into an input folder in the same directory.
-
The File connector in the application polls the input folder every ten seconds. It picks up the CSV file, processes it, then deposits it into the output folder in the same directory. (Hit F5 to refresh the contents of the input and output folders.)
-
In your browser, access your Sharepoint Online account, then navigate to Documents menu item on the left side.
-
There you can see your newly created folder and inside your folder you can see the uploaded file contacts.csv.
-
Stop the Mule application by clicking the square, red terminate button in the Console.
-
Delete the newly created folder from your Sharepoint Online account.
Using a single flow with five elements, this application accepts CSV file which contain contact information, then uploads the file to MS Sharepoint Online under the specified folder. If the folder hasn't existed already, it is created before uploading the CSV file.
The File connector polls the input folder for new files every ten seconds. When it spots a new file, it reads it and store the content to the Flow Variable for the later usage. Then a new folder in MS Sharepoint Online is created for storing the polled file. When creating the folder the connector's configurations specify the operation – Folder create – and /Shared Documents part of the path specifies that folder will be created under the Documents menu item on the left side. When folder is created, the file is uploaded to the MS Sharepoint Online from the previously stored variable. The connector's configurations for uploading file specify the operation – File add – and file is obtained from stream stored in the variable. For both actions the MS Sharepoint 2013 Connector is used.
Studio includes a feature that enables you to easily export all the documentation you have recorded for your project. Whenever you want to share your project with others outside the Studio environment, you can export the project's documentation to print, email or share online. Studio's auto-generated documentation includes:
- A visual diagram of the flows in your application
- The XML configuration which corresponds to each flow in your application
- The text you entered in the Notes tab of any building block in your flow
Follow the procedure to export auto-generated Studio documentation.
- Learn more about File connector
- Learn more about Flow Variable
- Learn more about MS Sharepoint 2013 Connector.