User Review( votes)
Let us see a simple example to upload the file to Azure Blob Storage through a desktop application (C#).
Below is our Storage account and the container to which we will upload the files from the local drive.
Get the Connection String for the storage account from the Access Key area
Next – Create a console application or windows form application project and add the following NuGet Package
Sample code –
The uploaded file –
Hope it helps..
var filePath = @"D:\Sample.xlsx"; var connectionString = "DefaultEndpointsProtocol=https;" + "AccountName=samplestorageaccountcrm;" + "AccountKey=aXX+FXLGqkT9yGOFQEfqPEKoW8oJZEX+kQQTW+kwU2AAcLNhVzpElaKqkzF18OLNd1pCy2NEniTMLTwwDoiv4Q==;" + "EndpointSuffix=core.windows.net"; // intialize BobClient Azure.Storage.Blobs.BlobClient blobClient = new Azure.Storage.Blobs.BlobClient( connectionString: connectionString, blobContainerName: "mycrmfilescontainer", blobName: "sampleBlobFileTest"); // upload the file blobClient.Upload(filePath);