OneDrive file system support for TagBites.IO, built on Microsoft Graph. Browse, read and write a user's OneDrive (or a specific drive by id) through the same FileSystem API used for local disk and other storages.
dotnet add package TagBites.IO.OneDrive
using TagBites.IO.OneDrive;
// Using an already-acquired Microsoft Graph access token (e.g. via MSAL)
var fs = OneDriveFileSystem.Create(accessToken);
var file = fs.GetFile("/reports/summary.txt");
file.WriteAllText("Hello world!");
var content = file.ReadAllText();Or supply an Azure.Identity TokenCredential (e.g. ClientSecretCredential, DeviceCodeCredential) directly:
using Azure.Identity;
using TagBites.IO.OneDrive;
var credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
var fs = OneDriveFileSystem.Create(credential);By default the signed-in user's own drive (/me/drive) is used, which requires delegated authentication. Pass a driveId to target a specific drive instead (works with application-only/client-credentials auth too).
See https://www.tagbites.com/io for licensing terms.