dhanu shree

dhanu shree

  • NA
  • 72
  • 7k

How can I Fetch the data from Azure blob?

Mar 15 2018 12:42 PM
How i can fetch xml file from azure blob and upload back to blob container using c#? Anyone please help me
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using System.Xml;
using System.Xml.Linq;
using System.Reflection;
using System.IO;
using System.Configuration;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.Azure;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
string connString = ConfigurationManager.ConnectionStrings["AzureStorageAccount"].ConnectionString;
string source = ConfigurationManager.AppSettings["example"];
//get reference to storage account
Console.WriteLine(@"Connecting to storage account");
CloudStorageAccount sa = CloudStorageAccount.Parse(connString);
CloudBlobClient bc = sa.CreateCloudBlobClient();
//get reference to container
Console.WriteLine(@"Getting reference to container");
CloudBlobContainer container = bc.GetContainerReference(source);
//create this container if it doesn't exist
container.CreateIfNotExists();

Answers (5)