# Microsoft Graph — Files & SharePoint  · replaces agent365 `onedrive` / `sharepoint`

Paging: add `max_items=N` to any GET (≤ 1000). Coverage + limits: see the SKILL.md guide.

## Files / OneDrive

| Task | Call |
|------|------|
| My drive | `GET /me/drive` |
| Root items | `GET /me/drive/root/children` |
| Folder by path | `GET /me/drive/root:/Documents/Reports:/children` |
| Item metadata | `GET /me/drive/items/{item-id}` |
| Download URL (then fetch separately) | `GET /me/drive/items/{item-id}?$select=name,@microsoft.graph.downloadUrl` |
| Search | `GET /me/drive/root/search(q='budget')` |
| Recent | `GET /me/drive/recent` |
| Shared with me | `GET /me/drive/sharedWithMe` |
| Create a folder | `POST /me/drive/root/children` → `{"name":"Reports","folder":{},"@microsoft.graph.conflictBehavior":"rename"}` |
| Sharing link | `POST /me/drive/items/{item-id}/createLink` → `{"type":"view","scope":"organization"}` → `link.webUrl` |

For file **content**, read `@microsoft.graph.downloadUrl` and fetch that URL with
the web tool — `…/content` returns a redirect the graph tool surfaces (it doesn't
return the bytes). Incremental sync (changes only): `GET /me/drive/root/delta` →
save the `@odata.deltaLink`, pass it back next run (delta pattern: SKILL.md).

## SharePoint

| Task | Call |
|------|------|
| Root site | `GET /sites/root` |
| Site by path | `GET /sites/{hostname}:/sites/{site-name}` (e.g. `/sites/contoso.sharepoint.com:/sites/Marketing`) |
| Find sites | `GET /sites?search=marketing` |
| Document libraries | `GET /sites/{site-id}/drives` |
| Default library items | `GET /sites/{site-id}/drive/root/children` |
| Lists | `GET /sites/{site-id}/lists` |
| List items + fields | `GET /sites/{site-id}/lists/{list-id}/items?$expand=fields` |

## Insights — recent & relevant documents

Document discovery (needs `Sites.Read.All`, routed to the OfficeHome app).

| Task | Call |
|------|------|
| Recently used by me | `GET /me/insights/used?$top=20` |
| Trending around me | `GET /me/insights/trending?$top=20` |
| Shared with me | `GET /me/insights/shared?$top=20` |

Each item's `resourceReference.webUrl` opens the doc and `resourceVisualization.title`
/`type` describe it — good for "what was I working on?" / "recent documents".
