Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Promptfoo Promptfoo SharePoint Integration

From Leeroopedia
Knowledge Sources
Domains Integration, Data_Source
Last Updated 2026-02-14 07:45 GMT

Overview

Concrete tool for fetching CSV data from Microsoft SharePoint Online using certificate-based Azure AD authentication.

Description

The SharePoint_Integration module (microsoftSharepoint.ts) provides the fetchCsvFromSharepoint() function that retrieves CSV files from SharePoint Online. Authentication uses MSAL (Microsoft Authentication Library) with certificate-based client credentials, requiring SHAREPOINT_CLIENT_ID, SHAREPOINT_TENANT_ID, SHAREPOINT_CERT_PATH, and SHAREPOINT_BASE_URL environment variables. The module calculates SHA-256 certificate thumbprints, acquires access tokens, and calls the SharePoint REST API to download file contents.

Usage

Import this function when test cases reference SharePoint URLs for CSV data. It is called by the test case reader when detecting SharePoint URLs.

Code Reference

Source Location

Signature

export async function fetchCsvFromSharepoint(url: string): Promise<CsvRow[]>
export async function getSharePointAccessToken(): Promise<string>

Import

import { fetchCsvFromSharepoint } from './microsoftSharepoint';

I/O Contract

Inputs

Name Type Required Description
url string Yes Full SharePoint URL to the CSV file

Outputs

Name Type Description
CsvRow[] CsvRow[] Array of parsed CSV rows as key-value objects

Usage Examples

import { fetchCsvFromSharepoint } from './microsoftSharepoint';

// Fetch test cases from SharePoint
// Requires env vars: SHAREPOINT_CLIENT_ID, SHAREPOINT_TENANT_ID,
// SHAREPOINT_CERT_PATH, SHAREPOINT_BASE_URL
const rows = await fetchCsvFromSharepoint(
  'https://company.sharepoint.com/sites/team/Shared Documents/test-cases.csv'
);

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment