Skip to content

Commit 044c8f7

Browse files
Edits
1 parent dd43e28 commit 044c8f7

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

articles/storage/files/storage-dotnet-how-to-use-files.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,24 @@ To work with the code examples in this article, assign the Azure RBAC built-in r
319319
320320
An easy and secure way to authorize access and connect to Blob Storage is to obtain an OAuth token by creating a [DefaultAzureCredential](/dotnet/api/azure.identity.defaultazurecredential) instance. You can then use that credential to create a `ShareClient` object.
321321
322-
The following example creates a `ShareClient` object authorized using `DefaultAzureCredential`:
322+
The following example creates a `ShareClient` object authorized using `DefaultAzureCredential`, then creates a `ShareDirectoryClient` object to work with a directory in the share:
323323
324324
```csharp
325325
string accountName = "<account-name>";
326326
string shareName = "<share-name>";
327327
328-
ShareClient client = new(
328+
ShareClientOptions options = new ShareClientOptions()
329+
{
330+
AllowSourceTrailingDot = true,
331+
AllowTrailingDot = true,
332+
ShareTokenIntent = ShareTokenIntent.Backup,
333+
};
334+
ShareClient shareClient = new(
329335
new Uri($"https://{accountName}.file.core.windows.net/{shareName}"),
330-
new DefaultAzureCredential());
336+
new DefaultAzureCredential(),
337+
options);
338+
339+
ShareDirectoryClient directoryClient = shareClient.GetDirectoryClient("sample-directory");
331340
```
332341
333342
If you know exactly which credential type you use to authenticate users, you can obtain an OAuth token by using other classes in the [Azure Identity client library for .NET](/dotnet/api/overview/azure/identity-readme). These classes derive from the [TokenCredential](/dotnet/api/azure.core.tokencredential) class.
@@ -367,7 +376,7 @@ For information about how to obtain account keys and best practice guidelines fo
367376
368377
To learn more about each of these authorization mechanisms, see [Choose how to authorize access to file data](authorize-data-operations-portal.md).
369378
370-
### Example: Add examples here
379+
### Example: TODO:Add examples here
371380
372381
## Related content
373382

0 commit comments

Comments
 (0)