Appearance
Function: getSharepointHttp()
ts
function getSharepointHttp(ctx: Context, baseUrl: string): Promise<SharepointHttpInterface>;Defined in: src/ms-graph/sharepointHttp.ts:44
Create a SharePoint HTTP client that runs API calls inside the browser context. Return an object with methods for files, folders, and lists.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | The SDK context with an active page. |
baseUrl | string | The SharePoint site base URL (e.g. "https://contoso.sharepoint.com/sites/ProjectAlpha"). |
Returns
Promise<SharepointHttpInterface>
A SharepointHttpInterface with file and folder operations.
Example
ts
const sp = await getSharepointHttp(ctx, 'https://contoso.sharepoint.com/sites/ProjectAlpha');
const files = await sp.listFiles('/sites/ProjectAlpha/Shared Documents');
console.log('Files:', files.map((f) => f.name));