![](/img/trans.png)
[英]How to get Azure Storage Account Key (connectionString) using azure .net sdk or fluent API?
[英]List all file share from storage account using azure .net SDK or Fluent API?
我想显示存储帐户中的所有文件共享。 我有存储帐户下拉列表,因此每当用户将 select 特定存储帐户名称时,我想获取与所选存储帐户关联的所有文件共享名称。 我想要任何 Fluent API 或 REST API。
using System;
using System.Threading.Tasks;
using Azure.Storage.Files.Shares;
using Azure.Storage.Files.Shares.Models;
namespace ConsoleApp5
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("xxxxxxxxxxxxxxxxxxxxx");
string connectionString = "DefaultEndpointsProtocol=https;AccountName=0730bowmanwindow;AccountKey=xxxxxx;EndpointSuffix=core.windows.net";
ShareServiceClient ssc = new ShareServiceClient(connectionString);
foreach (ShareItem item in ssc.GetShares())
{
Console.WriteLine(item.Name);
}
}
}
}
这是 REST API:
https://docs.microsoft.com/en-us/rest/api/storageservices/list-shares
.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.6.2" />
</ItemGroup>
</Project>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.