run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
35.73k stars 5.05k forks source link

[Question]: cannot download sharepoint file #14130

Closed BBjie closed 1 week ago

BBjie commented 3 months ago

Question Validation

Question

I'm using the code below to download files from the SharePoint folder. I confirmed those credentials are correct, but it didn't work as expected and returned None value. Just wondering what causes this

from llama_index.readers.microsoft_sharepoint import SharePointReader

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

documents = loader.load_data(
    sharepoint_site_name="<Sharepoint Site Name>",
    sharepoint_folder_path="<Folder Path>",
    recursive=True,
)
dosubot[bot] commented 3 months ago

The issue might be due to missing or incorrect permissions for the app registered in Microsoft Azure. The SharePointReader class requires the application to have the following Microsoft Graph permissions: "Files.ReadAll", "Sites.ReadAll", and "BrowserSiteLists.Read.All". Ensure that your app has these permissions granted and that admin consent has been provided for them.

Additionally, make sure you have installed the llama-index-readers-microsoft-sharepoint package:

pip install llama-index-readers-microsoft-sharepoint

After updating the permissions and installing the required package, try running your code again [1][2].

To continue talking to Dosu, mention @dosu.

Th0h0 commented 3 months ago

@dosu Your solution seems wrong!