> For the complete documentation index, see [llms.txt](https://docs.graphlit.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.graphlit.dev/api-guides/use-cases/feeds/cloud-storage/feed-create-sharepoint.md).

# Create SharePoint Feed

## User Intent

"How do I sync files from Microsoft SharePoint? Show me SharePoint feed configuration."

## Operation

**SDK Method**: `createFeed()` with FeedTypes.Site\
**Feed Service**: Microsoft SharePoint\
**OAuth**: Required via Developer Portal

***

## Code Example (TypeScript)

```typescript
import { Graphlit } from 'graphlit-client';
import {
  FeedTypes,
  FeedServiceTypes,
  SharePointLibrariesInput,
  SharePointFoldersInput,
} from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

const authorizationId = process.env.GRAPHLIT_SHAREPOINT_AUTH_ID!;

const sharePointAuth: SharePointLibrariesInput = {
  authorizationId,
};

// Enumerate SharePoint document libraries first
const librariesResponse = await graphlit.querySharePointLibraries(sharePointAuth);
const libraries = librariesResponse.sharePointLibraries?.results ?? [];

if (libraries.length === 0) {
  throw new Error('No SharePoint libraries available for the authorized account');
}

const { libraryId, libraryName } = libraries[0]!;
console.log(`Using SharePoint library: ${libraryName} (${libraryId})`);

// Optionally enumerate folders inside the library
const foldersResponse = await graphlit.querySharePointFolders(
  { authorizationId },
  libraryId!,
);

const folders = foldersResponse.sharePointFolders?.results ?? [];
const targetFolderId = folders[0]?.folderId ?? undefined;
console.log(`Using SharePoint folder: ${folders[0]?.folderName ?? 'Root'} (${targetFolderId ?? 'root'})`);

const feed = await graphlit.createFeed({
  name: 'Engineering SharePoint',
  type: FeedTypes.Site,
  site: {
    type: FeedServiceTypes.SharePoint,
    authorizationId,
    libraryId: libraryId!,
    folderId: targetFolderId,
    includeSubfolders: true,
    fileTypes: ['pdf', 'docx', 'xlsx'],
    readLimit: 500,
  },
  // Optional: add workflow for content processing
  // workflow: { id: workflow.createWorkflow.id }
});

console.log(`Created SharePoint feed: ${feed.createFeed.id}`);
```

***

## Configuration

**authorizationId**: Stored credential identifier from Developer Portal OAuth flow\
**libraryId**: Document library to sync (use `querySharePointLibraries`)\
**folderId**: Optional folder within the library (use `querySharePointFolders`)\
**fileTypes**: File extensions to sync\
**includeSubfolders**: Recursive sync\
**readLimit**: Max items per sync poll

***

## OAuth Setup

1. Developer Portal → Connectors → SharePoint
2. Complete Microsoft OAuth flow and store resulting credential (`authorizationId`)
3. Grant access to the target SharePoint sites and libraries
4. Use helper queries to discover `libraryId` and `folderId`

***

## What Gets Synced

* Documents from libraries
* Office files
* PDFs and images
* File metadata and versions
* Shared files

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.graphlit.dev/api-guides/use-cases/feeds/cloud-storage/feed-create-sharepoint.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
