Omniscope Custom Blocks › Inputs/Sharepoint-Online

SharePoint Online Downloader

Downloads a file, or every file in a folder, from a SharePoint Online document library to the Omniscope server, ready for an Append files block to load.

Inputs Python

Open the demo in Omniscope Download demo.ioz Sample data: placeholder.csv Source on GitHub

Omniscope custom block · Inputs

The budget lives in a SharePoint folder that people keep updating? Download the latest files on every run, signed in as an app, and load them with Append files.

Python · requests, pandas · requests installed on first run if missing

The problem it solves

Departments keep their working spreadsheets in SharePoint or Teams: the budget, the headcount plan, the supplier list. Reports built on copies of those files go out of date as soon as someone edits the original, and mapping SharePoint as a network drive on the server means a drive per site, signed in as a person.

This block signs in as a registered app, downloads the file or every file in a folder, and lists them for the rest of the workflow to load.

How it works

What goes in

Nothing from the workflow: the block reads from SharePoint Online. The demo uses invented Microsoft Graph responses for a fictional company's Finance site, with three CSV files in Shared Documents/Reports; sample-data/placeholder.csv holds the block's output for them.

The options

Option Demo setting What it does
Tenant ID contoso.onmicrosoft.com Your Microsoft Entra tenant, as an ID or a domain.
Client ID 11111111-2222-3333-4444-555555555555 The registered app's application (client) ID.
Client secret (a secret) A client secret value of the app.
File or folder URL https://contoso.sharepoint.com/sites/Finance/Shared Documents/Reports A file or folder in a document library, as shown in the browser.
Download to folder /data/omniscope/downloads/sharepoint Where the files go on the Omniscope server. Empty: the block's working folder.

What comes out

Files

File path File name Size (bytes) Modified SharePoint URL
/data/omniscope/downloads/sharepoint/budget-2025.csv budget-2025.csv 201 2025-03-10 08:12:45 https://contoso.sharepoint.com/sites/Finance/Shared%20Documents/Reports/budget-2025.csv
/data/omniscope/downloads/sharepoint/headcount.csv headcount.csv 70 2025-03-11 16:40:02 https://contoso.sharepoint.com/sites/Finance/Shared%20Documents/Reports/headcount.csv
/data/omniscope/downloads/sharepoint/suppliers.csv suppliers.csv 138 2025-02-27 11:05:30 https://contoso.sharepoint.com/sites/Finance/Shared%20Documents/Reports/suppliers.csv

3 records, sorted by name; the Archive sub-folder is not entered.

Where it pays off

Finance: Budgets and forecasts kept in SharePoint

Load the latest budget workbook from the finance site on each run, and report actuals against it.

HR: Headcount and vacancy plans

Pick up the headcount sheet a team maintains in Teams, without anyone copying it to the server by hand.

Procurement: Supplier and price lists

Download supplier lists and price files kept in a shared library, and join them to purchase data.

Operations: Files from many contributors

Load every file people drop in a shared folder, such as weekly returns from each site, with Append files.

Use cases describe typical scenarios and are illustrative; the sample data is invented.

Why do this in Omniscope

How it fits into an Omniscope workflow

SharePoint Online Downloader → Append files (file paths from the upstream block: File path) → Field Organiser → Join (actuals) → Report

For one file, a File block reading the path in the File path field works as well as Append files.

Try it

  1. Open the demo project (demo.iox on the demo server, or import demo.ioz from this folder). It holds the SharePoint Online Downloader with example settings (not run) and a File block with placeholder.csv, the list the block gives for the invented Finance folder.
  2. The question: which files are in the Reports folder, and when were they last changed?
  3. Follow the File block into the rest of the workflow: 3 files, the newest changed on 11 March.
  4. To use your own SharePoint: register the app, enter its tenant ID, client ID and secret and the address of your folder, run the block, and connect its output where the File block was, then on to Append files.

Running in Omniscope

Omniscope workflow
Omniscope workflow

The demo project's workflow: the placeholder data, the block, and a Validate data check on the output.

Language and libraries

Python, with requests (Apache License 2.0) and pandas (BSD 3-Clause).

pandas is part of Omniscope's Python environment. requests is listed in the block's dependencies, so Omniscope installs it with pip on first run if it is missing.

Tested

The block is covered by automated tests that run its script against a stand-in for Omniscope's Python API and invented Microsoft Graph responses (no live calls): the sign-in request, a single file, a folder over two pages with a sub-folder skipped, addresses copied from the Office web apps and sharing links, a refused sign-in, a missing permission, an unknown file, an address outside the document libraries, missing options, an empty folder, and 2,000 files.

Reference

Options

NameTypeWhat it does
Tenant IDTextYour Microsoft Entra tenant: its ID (a GUID) or a domain such as contoso.onmicrosoft.com.
Client IDTextThe application (client) ID of the app registered in Microsoft Entra ID.
Client secretPasswordA client secret value of that app (Certificates & secrets). Secrets expire; create a new one when sign-in starts failing.
File or folder URLTextThe address of a file or folder in a document library, as shown in the browser, for example https://contoso.sharepoint.com/sites/Finance/Shared Documents/Reports/budget.xlsx. A folder downloads every file in it (not sub-folders).
Download to folderTextA folder on the Omniscope server to save the files in (created if missing; files of the same name are replaced). Empty: the block's own working folder.

Outputs

OutputWhat it holds
FilesOne record per downloaded file: File path (on the Omniscope server), File name, Size (bytes), Modified (in SharePoint, UTC) and SharePoint URL.