Skip to content

Repository files navigation

TagBites.IO.OneDrive

Nuget .NET Standard 2.1 License

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.

Install

dotnet add package TagBites.IO.OneDrive

Targets netstandard2.1. Depends on Microsoft.Graph and Azure.Core.

Usage

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).

Capabilities

  • Asynchronous operations. Synchronous calls run on top of them.
  • Metadata: none.
  • Prefer the TokenCredential overload; a raw access token is not refreshed.

Links

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages