onedrive-upload-dot-net
1.0.0
See the version list below for details.
dotnet add package onedrive-upload-dot-net --version 1.0.0
NuGet\Install-Package onedrive-upload-dot-net -Version 1.0.0
<PackageReference Include="onedrive-upload-dot-net" Version="1.0.0" />
paket add onedrive-upload-dot-net --version 1.0.0
#r "nuget: onedrive-upload-dot-net, 1.0.0"
// Install onedrive-upload-dot-net as a Cake Addin #addin nuget:?package=onedrive-upload-dot-net&version=1.0.0 // Install onedrive-upload-dot-net as a Cake Tool #tool nuget:?package=onedrive-upload-dot-net&version=1.0.0
OneDriveUpload
Onedrive-upload-dot-net helps You To Upload a file to One Drive Using Your Tennant ID , Client Id , ClientSecret , UserName has a clean and structured Api and supports .Net6
Using Microsoft Graph and Azure Identity
It Uses Microsoft Graph and Azure Identity package to Connect to Microsoft One Drive Throuh ClientSecretCredential including all that is mentioned above.
Getting Started
To begin, developers need to set up authentication using the ClientSecretCredential
class. This involves creating an instance of this class with essential parameters such as tennatId
, ClientId
, ClientSecret
, and TokenCredential
. The tennatId
, ClientId
, and ClientSecret
are unique identifiers associated with the Azure AD or Microsoft Entra application
.
var clientCredential = new ClientSecretCredential(
tenantId,
clientId,
clientSecret,
options
);
The TokenCredentialOptions
class is crucial for configuring the token acquisition process. Developers can fine-tune authentication by setting parameters within this class. The whole process is facilitated by the versatile Microsoft.Azure.Identity
namespace.
GraphClient for Microsoft Graph API
The cornerstone of OneDriveUpload
is the GraphClient
class. This class abstracts away the complexities of interacting with Microsoft Graph APIs
, providing a simplified and efficient interface. Developers can use this class to perform various operations such as uploading files to OneDrive
, accessing user information, and much more.
var graphClient = new GraphClient(clientCredential);
Comprehensive Authentication with Azure Identity
OneDriveUpload
relies on the robust authentication capabilities provided by Azure Identity
. The ClientSecretCredential is a part of Azure Identity
and ensures secure and authorized access to Microsoft Graph APIs
.
var options = new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
};
Implementing
Configure and instantiate the GraphClient
with the appropriate ClientSecretCredential
:
var clientCredential = new ClientSecretCredential(
tenantId,
clientId,
clientSecret,
options
);
var graphClient = new GraphClient(clientCredential);
After Graphclient is created using this to upload to one drive using onedrive_upload_dot_net;
namespace into your controller and intializing
OneDriveConnect connect = new OneDriveConnect
(_configuration["GraphSetting:TennantId"],
_configuration["GraphSetting:ClientId"],
_configuration["GraphSetting:ClientSecret"],
_configuration["GraphSetting:UserName"]);
and using OneDriveConnect
class to use methord getUploadFileUrl
to get uploaded file url.To your one drive by specifing filePath
and UplaodFolderName
to getUploadFileUrl
methord.
var url = await connect.getUploadFileUrl(@"E:\\test.txt",_configuration["GraphSetting:folderName"]);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- Azure.Identity (>= 1.10.4)
- Microsoft.Graph (>= 5.38.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.