使用 azure .net SDK 或 Fluent API 列出存储帐户中的所有文件共享?
List all file share from storage account using azure .net SDK or Fluent API?
我想显示存储帐户中的所有文件共享。我有存储帐户下拉列表,所以每当用户 select 特定存储帐户名称时,我想获取与 selected 存储帐户关联的所有文件共享名称。我想要任何 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>
我想显示存储帐户中的所有文件共享。我有存储帐户下拉列表,所以每当用户 select 特定存储帐户名称时,我想获取与 selected 存储帐户关联的所有文件共享名称。我想要任何 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>