如果我有 _full_ 绝对 uri,如何获取对 Azure blob/file 的文件引用?

How to GetFileReference to an Azure blob/file if I have the _full_ absolute uri?

在我的数据库中,我拥有我们 azure 文件的完整绝对 Uri

例如

请注意:

我正在尝试查看该文件是否存在,然后对其进行操作(例如下载它,等等)。

我需要先得到一个 File Reference 这个项目。我已经完成了设置 that 的所有仪式(SAS,等等)。

这是我获取文件引用的方式:

var cloudFile = ShareRootDirectory.GetFileReference(fileName);

如果 fileName = "Brand1/Export_2017-05-11-12-54.xml 它会起作用(注意:那里没有 sharehttps://....。)

否则会出错。

有没有什么办法,给定 azure 上文件的完整绝对 uri,我可以将 something 传递给我之前的设置 ShreRootDirectory 到get/check 文件?或者我需要换一种方式吗?

有什么技巧吗?

注意: - 我有一个共享文件夹(用于文件) - 文件名中有 /,这给人一种文件夹的错觉。

这是我执行此操作的屏幕截图:

var tempCloudFile = new CloudFile(new Uri(fileName));

如果您有权访问存储凭据,则可以使用以下对 CloudFile 的覆盖来获取该文件的引用,然后对该文件执行操作。例如,我在下面获得了 CloudFile 的参考并检查它是否存在。

        var cred = new StorageCredentials(accountName, accountKey);
        var file = new CloudFile(new Uri("https://<snip>.file.core.windows.net/share1/Brand1/Export_2017-05-11-12-54.xml"), cred);
        var exists = file.Exists();