Extract files from SCSM WI and upload to SharePoint Online

As part of authorizing access to a system, the initial request document had to be extracted from a SR and uploaded to SharePoint Online.

By uploading to SharePoint, the customer kept track of all changes made to the request document and also had a long term storage of all requests.

I ended up creating a Orchestrator runbook, that was initiated during the execution of the Service Request:

The activities in the runbook are as follows:

1. Load the SR that has started the runbook

2. Extract all attachments to a temporary fileshare, in a folder named as the SR ID.

The script to extract attachments from a WI, is more a less a raw copy of the work Patrick has blogged about: https://blogs.litware.se/?p=1369 

3. Run a powershell script to upload the specific folder and files to a site in SharePoint Online.

4. Update the SR with the URL of where the attachments are stored.

You can download the runbook here.

Extract Attachments.zip