简体   繁体   中英

Delete an Azure File Share Snapshot with C#

I cannot find an example of deleting an Azure File Shares Snapshot using SDK 12 in C#. There are a ton of examples for SDK 11 but none, that I can find, for SDK 12. If anyone has a good example I would appreciate it very much

Please try this code. Basically you need to make use of ShareClient.WithSnapshot(String) to get access to a Share's snapshot.

var connectionString =
    "DefaultEndpointsProtocol=https;AccountName=account-name;AccountKey=account-key";
var shareName = "test";
var snapshot = "2022-07-26T13:49:01.0000000Z";
ShareServiceClient shareserviceclient = new ShareServiceClient(connectionString);
ShareClient shareClient = shareserviceclient.GetShareClient(shareName).WithSnapshot(snapshot);
shareClient.Delete();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM