/// <summary> /// Manage share metadata /// </summary> /// <param name="shareServiceClient"></param> /// <returns></returns> private static async Task ShareMetadataSample(ShareServiceClient shareServiceClient) { Console.WriteLine(); // Create the share name -- use a guid in the name so it's unique. string shareName = "demotest-" + Guid.NewGuid(); // Create Share Console.WriteLine("Create Share"); ShareClient shareClient = shareServiceClient.GetShareClient(shareName); await shareClient.CreateIfNotExistsAsync(); // Set share metadata Console.WriteLine("Set share metadata"); var metadata = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } }; await shareClient.SetMetadataAsync(metadata); try { // Create Share Console.WriteLine("Create Share"); await shareClient.CreateIfNotExistsAsync(); // Fetch share attributes ShareProperties shareProperties = await shareClient.GetPropertiesAsync(); Console.WriteLine("Get share metadata:"); foreach (var keyValue in shareProperties.Metadata) { Console.WriteLine(" {0}: {1}", keyValue.Key, keyValue.Value); } Console.WriteLine(); } catch (RequestFailedException exRequest) { Common.WriteException(exRequest); Console.WriteLine( "Please make sure your storage account is specified correctly in the app.config - then restart the sample."); Console.WriteLine("Press any key to exit"); Console.ReadLine(); throw; } catch (Exception ex) { Console.WriteLine(" Exception thrown creating share."); Common.WriteException(ex); throw; } finally { // Delete share Console.WriteLine("Delete share"); await shareClient.DeleteIfExistsAsync(); } }