MCPcopy Index your code
hub / github.com/simstudioai/sim / listFolderItems

Function listFolderItems

apps/sim/connectors/sharepoint/sharepoint.ts:200–226  ·  view source on GitHub ↗

* Lists items in a folder. When folderId is omitted the root of the default * document library is listed.

(
  accessToken: string,
  siteId: string,
  folderId?: string,
  nextLink?: string
)

Source from the content-addressed store, hash-verified

198 * document library is listed.
199 */
200async function listFolderItems(
201 accessToken: string,
202 siteId: string,
203 folderId?: string,
204 nextLink?: string
205): Promise<DriveItemListResponse> {
206 const url =
207 nextLink ??
208 (folderId
209 ? `${GRAPH_BASE}/sites/${siteId}/drive/items/${folderId}/children?$top=200`
210 : `${GRAPH_BASE}/sites/${siteId}/drive/root/children?$top=200`)
211
212 const response = await fetchWithRetry(url, {
213 method: 'GET',
214 headers: {
215 Authorization: `Bearer ${accessToken}`,
216 Accept: 'application/json',
217 },
218 })
219
220 if (!response.ok) {
221 const errorText = await response.text()
222 throw new Error(`Failed to list folder items: ${response.status} – ${errorText}`)
223 }
224
225 return response.json() as Promise<DriveItemListResponse>
226}
227
228/**
229 * Resolves a slash-separated folder path (e.g. "Documents/Reports") to a

Callers 1

sharepoint.tsFile · 0.85

Calls 2

fetchWithRetryFunction · 0.90
textMethod · 0.80

Tested by

no test coverage detected