> Source: https://txtfetch.com/sources/sharepoint-onedrive > Plain-text twin — every page on txtfetch.com has one. https://txtfetch.com/text --- # Extract text from SharePoint & OneDrive The download URL that needs no Authorization header at all. Here's how a document actually gets from SharePoint & OneDrive to a txtfetch response. ## The problem SharePoint and OneDrive both sit behind Microsoft Graph. Graph already solved the header problem: its download URL needs no Authorization header of its own. The catch is how briefly that URL stays valid. ?url=, and why | Pre-authenticated URL? | Yes — @microsoft.graph.downloadUrl needs no header | | --- | --- | | txtfetch path | ?url= | | Link lifetime | Minutes — Microsoft warns it can expire fast | | The trap | The URL might expire within minutes. Fetch it right before the txtfetch call, never from a queue or a retry. | Microsoft Graph's @microsoft.graph.downloadUrl is pre-authenticated. It carries its own short-lived access, so ?url= reaches it with no header. ## How it works Request a driveItem with $select=@microsoft.graph.downloadUrl, and Graph returns that URL directly in the JSON body. Pass it straight to txtfetch's ?url= parameter. GET .../content works too — Graph replies with a 302 redirect to the same URL, and txtfetch follows redirects automatically. Use the JSON form for a browser-side call, since a browser blocks that redirect with a CORS preflight. A server-side call can use either form. the script A plain HTTP call against SharePoint & OneDrive's own REST API, then a plain call to txtfetch. No vendor SDK either side. Python ```python import os import requests ITEM_ID = "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD4NX" headers = {"Authorization": f"Bearer {os.environ['GRAPH_ACCESS_TOKEN']}"} item = requests.get( f"https://graph.microsoft.com/v1.0/me/drive/items/{ITEM_ID}", headers=headers, params={"select": "@microsoft.graph.downloadUrl"}, ) item.raise_for_status() download_url = item.json()["@microsoft.graph.downloadUrl"] r = requests.post( "https://api.txtfetch.com/v1/extract", headers={"Authorization": f"Bearer {os.environ['TXTFETCH_KEY']}"}, params={"url": download_url}, ) print(r.json()["extracted_text"]) ``` JavaScript ```javascript const itemId = "01BYE5RZ6QN3ZWBTUFOFD3GSPGOHDJD4NX"; const graphRes = await fetch( `https://graph.microsoft.com/v1.0/me/drive/items/${itemId}?select=@microsoft.graph.downloadUrl`, { headers: { Authorization: `Bearer ${process.env.GRAPH_ACCESS_TOKEN}` } }, ); const { "@microsoft.graph.downloadUrl": downloadUrl } = await graphRes.json(); const endpoint = new URL("https://api.txtfetch.com/v1/extract"); endpoint.searchParams.set("url", downloadUrl); const res = await fetch(endpoint, { method: "POST", headers: { Authorization: `Bearer ${process.env.TXTFETCH_KEY}` }, }); const { extracted_text } = await res.json(); console.log(extracted_text); ``` txtfetch ships no connector, plugin, or client for SharePoint & OneDrive. The script above is the whole integration. Fetch the document with SharePoint & OneDrive's own API, then hand it to txtfetch, the same as any other source of text. frequently asked questions **Does txtfetch have a SharePoint or OneDrive connector?**: No. txtfetch ships no connector for either. The Graph download URL already needs no header, so ?url= reaches it directly with no extra plumbing. **Why does the download URL expire so fast?**: Microsoft designs it that way on purpose. It's meant for an immediate download, not for storing and reusing later, so fetch it right before you call txtfetch. **Can I call the download URL from a browser instead of a server?**: Not through GET .../content — a browser blocks its 302 redirect with a CORS preflight. Request @microsoft.graph.downloadUrl directly and fetch that URL instead. sources - [Microsoft Graph: Download driveItem content](https://learn.microsoft.com/en-us/graph/api/driveitem-get-content) Accessed 2026-09 ## Related - [Integrations](https://txtfetch.com/integrations), for wiring this into a no-code automation platform instead of a script. - [Ingest into a vector store](https://txtfetch.com/ingest), for where the extracted text goes next. - [Async jobs & webhooks](https://txtfetch.com/docs/async), for a source that's large or slow to fetch. - [Error reference](https://txtfetch.com/docs/errors), for what a failed `?url=` fetch returns. other sources - [Extract text from Google Drive →](https://txtfetch.com/sources/google-drive) - [Extract text from Amazon S3 →](https://txtfetch.com/sources/amazon-s3) - [Extract text from Dropbox →](https://txtfetch.com/sources/dropbox) - [Extract text from Confluence →](https://txtfetch.com/sources/confluence) - [Extract text from Email inbox →](https://txtfetch.com/sources/email-inbox) - [All sources →](https://txtfetch.com/sources) ## Point it at your SharePoint & OneDrive files. Pass a signed URL and the text comes back. There is no connector to install. [Get an API key →](https://app.txtfetch.com/signup) [See the URL docs →](https://txtfetch.com/docs)