//native
const graph = "https://graph.microsoft.com/v1.0"
/**
* List Drives
* List the drives available to the connected account: its OneDrive and, on work or school accounts, the document libraries it can reach. Use a drive's `id` as `drive_id` in the other scripts. Requires Files.Read (covered by the default Files.ReadWrite).
*/
export async function main(auth: RT.MsOnedrive) {
const response = await fetch(`${graph}/me/drives`, {
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago