![](/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.