Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Microsoft SharePoint Data Loader #745

Merged
merged 6 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions llama_hub/library.json
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,15 @@
"id": "opensearch",
"author": "chnsagitchen"
},
"SharePointReader":{
"id": "microsoft_sharepoint",
"author": "arun-soliton",
"keywords":[
"sharepoint",
"microsoft 365",
"microsoft365"
]
},
"DocstringWalker": {
"id": "docstring_walker",
"author": "Filip Wojcik",
Expand Down
47 changes: 47 additions & 0 deletions llama_hub/microsoft_sharepoint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Microsoft SharePoint Reader

The loader loads the files from a folder in sharepoint site.

It also supports traversing recursively through the sub-folders.

## Prequsites

### App Authentication using Microsoft Entra ID(formerly Azure AD)

1. You need to create an App Registeration in Microsoft Entra ID. Refer [here](https://learn.microsoft.com/en-us/azure/healthcare-apis/register-application)
2. API Permissions for the created app.
1. Micorsoft Graph --> Application Permissions --> Sites.ReadAll (**Grant Admin Consent**)
2. Microsoft Graph --> Application Permissions --> Files.ReadAll (**Grant Admin Consent**)
3. Microsoft Graph --> Application Permissions --> BrowserSiteLists.Read.All (**Grant Admin Consent**)

More info on Microsoft Graph APIs - [Refer here](https://learn.microsoft.com/en-us/graph/permissions-reference)

## Usage

To use this loader `client_id`, `client_secret` and `tenant_id` of the registered app in Microsoft Azure Portal is required.

This loader loads the files present in a specific folder in sharepoint.

If the files are present in the `Test` folder in SharePoint Site under `root` directory, then the input for the loader for `file_path` is `Test`

![FilePath](file_path_info.png)

```python
from llama_index import download_loader
SharePointLoader = download_loader("SharePointReader")

loader = SharePointLoader(
client_id = "<Client ID of the app>",
client_secret = "<Client Secret of the app>",
tenant_id = "<Tenant ID of the Micorsoft Azure Directory>"
)

documents = loader.load_data(
sharepoint_site_name: "<Sharepoint Site Name>",
sharepoint_folder_path: "<Folder Path>",
recursive = True,
)
```

The loader doesn't access other components of the `SharePoint Site`.

6 changes: 6 additions & 0 deletions llama_hub/microsoft_sharepoint/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Init file."""
from llama_hub.microsoft_sharepoint.base import (
SharePointReader,
)

__all__ = ["SharePointReader"]
Loading