Azure File Storage - Creating a directory at the root level using REST

I have a Xamarin / iOS project, and looking to use Azure File Share as a back-end.
With that in mind, I'm playing around with the REST API and have generally got things working with (a) Blobs and (b) Account-level access to Files.
Specifically, I can successfully request a list of File Shares, so I have the general call structure worked out.
However, I'm stumped about the exact incantation necessary to create a new directory at the root level of a share.
I've tried the following three variants, but all result in Forbidden - Server failed to authenticate the request
request.Host: myaccount.file.core.windows.net
request.AbsolutePath: /myshare/subdirname1
request.Query: ?restype=directory
string to sign: PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 16:07:25 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare/subdirname1\nrestype:directory
request.Host: myaccount.file.core.windows.net
request.AbsolutePath: /myshare/subdirname1/
request.Query: ?restype=directory
string to sign: PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 16:07:58 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare/subdirname1/\nrestype:directory
request.Host: myaccount.file.core.windows.net
request.AbsolutePath: /myshare//subdirname1
request.Query: ?restype=directory
string to sign: PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 16:06:16 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare//subdirname1\nrestype:directory
I did note that trying to get the contents of an (empty) root directory doesn't behave quite the way I'd expect
request.Host: myaccount.file.core.windows.net
request.AbsolutePath: /myshare/
request.Query: ?resttype=directory&comp=list
string to sign: GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 16:23:17 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare/\ncomp:list\nrestype:directory
Authenticates OK, but generates FAILURE BadRequest - The requested URI does not represent any resource on the server.
Which is different behaviour from pulling the list of blobs from an empty container (returns 200 with an empty xml list of blobs.
I've been through the File Service REST API document (dn167006) and found the azurestoragesamples on codeplex, but the former is unclear on working with the root level and the latter is from 2011 and predates File Storage.
Any insights?

First, thank you for the quick response and the suggestion about looking at the response content for the string to sign being used. I wasn't aware of that and obviously it's a fantastic resource for figuring this kind of stuff out.
And what it immediately revealed is it wasn't some subtle oddity in my construction of the STS, it was that I was doing a client.GetAsync(...) and not a client.PutAsync(...). DOH!
With that sorted, it was trivial to fix.
In terms of the List Directories and Files, though, there's still a problem.
FAILURE BadRequest - The requested URI does not represent any resource on the server.
   request.Host: myaccount.file.core.windows.net
   request.AbsolutePath: /myshare
   request.Query: ?resttype=directory&comp=list
   urlQuery: myshare?resttype=directory&comp=list
   string to sign: GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-date:Sun, 30 Nov 2014 18:40:04 GMT\nx-ms-version:2014-02-14\n/myaccount/myshare\ncomp:list\nresttype:directory
The response XML is
<?xml version="1.0" encoding="utf-8"?>
<Error>
    <Code>InvalidUri</Code>
    <Message>The requested URI does not represent any resource on the server.\nRequestId:33d61aed-001a-0020-0cbd-51aea8000000\nTime:2014-11-30T18:40:04.9712797Z</Message>
    <UriPath>/myshare</UriPath>
</Error>
I originally thought it might be because the share was empty. However, I'm targeting the same share in which I created (apparently successfully) the subdirectory.
So I'm still confuzzled on that.

Similar Messages

  • Bad idea to create new folders at the root level?

    I have several clients who have been Mac user's since OS 8 and even earlier. When they transitioned to OS X they did not learn to use their local home folder properly and they continue to maintain a very cluttered folder structure at the root level of their hard drive. I believe one advantage they probably find is when sharing files the files are easy for other network users to find when they log on to each other's computers. But, I thought I read somewhere at one time that this was bad practice. Can anyone point me to a good article which explains the OS X file system that I can give these people to read? Or, am I worrying about nothing? I'm setting up an OS X Server for them so they can use Time Machine to backup - will the time machine backups contain all of these files and folders stored outside each user's folder?

    Larry Jorgenson wrote:
    I have several clients who have been Mac user's since OS 8 and even earlier. When they transitioned to OS X they did not learn to use their local home folder properly and they continue to maintain a very cluttered folder structure at the root level of their hard drive. I believe one advantage they probably find is when sharing files the files are easy for other network users to find when they log on to each other's computers. But, I thought I read somewhere at one time that this was bad practice. Can anyone point me to a good article which explains the OS X file system that I can give these people to read? Or, am I worrying about nothing? I'm setting up an OS X Server for them so they can use Time Machine to backup - will the time machine backups contain all of these files and folders stored outside each user's folder?
    I can't answer the first part, but yes, Time Machine will back-up the entire system (other than some specific system files, caches, logs, trash, etc.), unless they're specifically excluded via TM > Options (I suspect you wanted a different answer -- sorry).

  • Unable to properly create new folder at the root level of exchange account

    Using the latest version of Mail in OS 10.6 with an exchange server. Creating a subfolder within existing folders works perfectly. However, if I try to create a new folder at the very first level of hierarchy (directly under the inbox, not within an existing folder) it will not be created in the same location as my other folders. What will happen is, the folder will be created at the very bottom of all of my mail folders in an area that is labeled with the name of my exchange mailbox. This will be an area that only has folders that I created from within Mail on the Exchange server. All other exchange folder will be seen in the "Mailboxes" area directly underneath the exchange inbox.
    FYI if I go into my exchange mailbox in a web browser and create a new folder directly underneath the inbox and then sync Mail for OS X, the folder will appear in the appropriate area. The issue only occurs when creating a new folder under the Inbox from within Mail.
    Any solution here? My office is thinking of switching more computers from windows to mac, but we all run on Exchange and a glaring bug like this would make me think twice about rolling over to Mac for our office.

    Start at http://www.microsoft.com/mac/search.mspx?qu=exchange+server

  • A way to qeury Azure File Storage direct from Automation?

    Hello.
    I am trying to create a runbook that will query a list of files in Azure File Storage. This works fine from a powershell prompt on an Azure VM, but it appears the same methods in Azure Automation return different objects:
    Sample code to just list the files in a given folder:
    workflow Get-AzureFileStorageInfo
    # Get Azure File Storage Name and Key
    $storageName = Get-AutomationVariable -Name 'File Storage Name'
    $storageKey = Get-AutomationVariable -Name 'File Storage Key'
    # Get subscription and certificate information
    $subscriptionName = Get-AutomationVariable -Name "Subscription Name"
    $connection = Get-AutomationConnection -Name "Azure Connection"
    $certificate = Get-AutomationCertificate -Name $connection.AutomationCertificateName
    # Set the current subscription
    Set-AzureSubscription -SubscriptionName $subscriptionName -SubscriptionId $connection.SubscriptionID -Certificate $certificate
    Select-AzureSubscription -Current $subscriptionName
    # get azure file storage context and share object
    #$ctx = New-AzureStorageContext $StorageName $StorageKey
    $s = Get-AzureStorageShare -Name $StorageName
    # get list of files from Azure File Storage
    Write-Output "Files in the DEMO folder..."
    $DemoFiles = Get-AzureStorageFile -Share $s -Path "DEMO"
    Write-Output $DemoFiles
    I get this error when I run it:
    6/02/2015 4:54:34 PM, Error: Get-AzureStorageShare : Cannot bind parameter 'Context'. Cannot convert the 
    "Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext" value of type 
    "Deserialized.Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext" to type 
    "Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext".
    At Get-AzureFileStorageInfo:25 char:25

        + CategoryInfo          : InvalidArgument: (:) [Get-AzureStorageShare], ParameterBindingException
        + FullyQualifiedErrorId : 
    CannotConvertArgumentNoMessage,Microsoft.WindowsAzure.Commands.Storage.File.Cmdlet.GetAzureStorageShare
    I am obviously calling it wrong from Azure Automation. Is there sample code online somewhere that can demo the right way to call it? Thanks!
    Matt

    Perfect. That worked! Thanks!
    For others who might be following this I made the change as shown below:
    workflow Get-AzureFileStorageInfo
    # Get Azure File Storage Name and Key
    $storageName = Get-AutomationVariable -Name 'File Storage Name'
    $storageKey = Get-AutomationVariable -Name 'File Storage Key'
    # Get subscription and certificate information
    $subscriptionName = Get-AutomationVariable -Name "Subscription Name"
    $connection = Get-AutomationConnection -Name "Azure Connection"
    $certificate = Get-AutomationCertificate -Name $connection.AutomationCertificateName
    # Set the current subscription
    Set-AzureSubscription -SubscriptionName $subscriptionName -SubscriptionId $connection.SubscriptionID -Certificate $certificate
    Select-AzureSubscription -Current $subscriptionName
    InlineScript {
    # get azure file storage context and share object
    $ctx = New-AzureStorageContext $Using:StorageName $Using:StorageKey
    $s = Get-AzureStorageShare -Context $ctx
    # get list of files from Azure
    Write-Output "Files in the DEMO folder..."
    $DemoFiles = Get-AzureStorageFile -Share $s -Path "DEMO"
    Write-Output $DemoFiles

  • Can not get exclusive lock on the shared drive of Azure file storage

    One of my application need exclusive access on the data folder where it writes the data.
    I have setup data folder in Z drive which is shared drive of Azure File system.
    The application is not able to get the exclusive access on the data folder and throws IO exception.
    Is that not possible with shared drive of azure file system

    Hi Subodh,
    You could refer the following link for details on how pessimistic concurrency (Exclusive lock) managed in Azure Storage:
    http://azure.microsoft.com/blog/2014/09/08/managing-concurrency-in-microsoft-azure-storage-2/
    Please be advised that an Exclusive lock on an Azure File Share is not possible using REST Protocol and need to be done using the SMB Protocol.
    You could refer the following link for details on how to manage SMB File locking:
    https://msdn.microsoft.com/en-us/library/azure/dn194265.aspx?f=255&MSPPError=-2147217396
    Hope this helps.
    Regards,
    Malar.

  • How do I create a folder in the root directory

    Hi
    How do I create a folder in the root directory?
    Once I do that I need to create a note book file in that folder
    Any help would be much appreciated
    Thanks
    Brian

    Hi Brian,
    Open Macintosh HD in the Finder, then SHIFT+CMD+n
    Root Directory is the top level of the drive.

  • Create a directory on the server based on the username logged in the client

    hello everybody,
    All my files which are transferred from client to server are stored in a directory called "workspace".Before the user sends the files, he is authenticated.How can I create a directory on the user name who is logged in on the server???
    Say, user1 has logged in and tries to send files to server.Now, I'd like to create a sub-directory user1 under work space so that all the files which he uploads will be stored under his name.When the user1 is logged in the first time, a directory will be created on his name else all files will be stored under his directory.
    I'm using JDBC with my-sql.
    ANy ideas??
    Thanks for your time.

    Well, it wouldn't matter what DB you are using....
    You have the user name, correct?
    You have the File object refering to the main directory, correct?
    File userDir = new File(mainDir, username);
    if(!userDir.exists()) {
       if(!userDir.mkdirs()) {
           throw new IOException("Can't make directory " + userDir.getAbsolutePath());
    // use userDir to write any files...

  • Azure Files Storage not accessible.

    Hi,
    As primary storage mean we are using Azure File storage (smb shares) for our application.
    In the logs we find out that sometimes the shares aren't accessible. Over the last month it happened 9-10 times. In some cases it lasted up to 30 seconds. What can be reason for this? Is it because of preview state?  
    Thanks,
    Kamil

    Hi Kamil,
    It might be due to the Preview Status or due to throttling as well.
    To determine the exact cause, we would require more details which cannot be shared on a public forum.
    Please raise a Technical Case for us to be able to assist you further.
    You could use the following link to raise a technical case:
    http://azure.microsoft.com/en-in/support/options/
    Regards,
    Malar.

  • API for creating a directory in the application server

    Hello,
    Does anyone knows a way to create a directory in the application server? Something similar to
    CL_GUI_FRONTEND_SERVICES but for managing files in the application server?
    Thanks in advance
    Diz IsMi

    Actually, CL_GUI_FRONTEND_SERVICES=>Directory_Create works really good for me. 
    REPORT ZRICH_0001 .
    data: path type string.
    data: rc type sy-subrc.
    path = '\172.52.72.651qfilesvr400S109XXXXusrsapTSTSYStest'.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_CREATE
      EXPORTING
        DIRECTORY                = path
      CHANGING
        RC                       = rc
      EXCEPTIONS
        DIRECTORY_CREATE_FAILED  = 1
        CNTL_ERROR               = 2
        ERROR_NO_GUI             = 3
        PATH_NOT_FOUND           = 4
        DIRECTORY_ACCESS_DENIED  = 5
        DIRECTORY_ALREADY_EXISTS = 6
        UNKNOWN_ERROR            = 7
        others                   = 8
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Rich Heilman

  • Set Adobe Acrobat XI Pro. When I want to save the file in WORD, EXCEL or esporta file into ... immediately throws an error "save as failed to process this document no file was created". What's the problem?

    Set Adobe Acrobat XI Pro. When I want to save the file in WORD, EXCEL or esporta file into ... immediately throws an error "save as failed to process this document no file was created".
    What's the problem?
    Any help in finding a solution is greatly appreciated.
    Thank you,

    Installed AcrobatXI PRO 11.0.09  on seven computers and laptops. Two of them gives an error when you try to save a document in WORD, EXCEL, Power Point, or when exporting to... error: Save failed to process this document. No File was created.
    But all good saves in the format of TXT and jpg.
    I have uninstalled and restored and re-installed and updated and registry cleaned and removed using the special utility Cleaner Tool for Acrobat, but nothing helps.
    On one notebook with Windows 8.1 and Microsoft office 2013, on another laptop with Windows 7 and Microsoft office 2010, the same problem, although there are computers with Windows 7 and Microsoft office 2010 and everything works.
    Tell me where to find the problem and how to solve it.
    Thank you.

  • How will i create physical directory in oracle pl/sql using java

    how will i create physical directory in oracle pl/sql using java

    This is, I suspect, related to Re: how will i overcome from this error java.io.IOException. Quite why you felt the need to have two partial threads instead of one thread with a complete set of information is beyond me. Perhaps this muddled thinking is indicative....
    Anyway, if I was looking to do this particular task in Java I would look to using the specific command File.mkdir() rather than trying to use a generic exec approach.
    Cheers, APC

  • Creating a directory on a remote machine using a UNC path

    Hi all,
    Is it possible to create a directory on a remote machine using a UNC path such as \\Server\Share\Directory?
    If so, how would i go about this? (Sorry for the newbie question, that's exactly what I am!)
    Thanks,
    Rob

    The tables on your pages are images. Not very convenient if the visitor wants to copy the information and use it.
    Read this how to use tables :
    http://www.wyodor.net/blog/archives/2010/01/entry_297.html
    http://www.wyodor.net/blog/archives/2010/01/entry_298.html
    Samples :
    http://www.wyodor.net/mfi/Maaskant/Seabreeze.html
    http://www.wyodor.net/mfi/Maaskant/Experiment.html
    http://www.wyodor.net/mfi/roodhout/Prices.html
    And here's a non-iWeb page with a sortable table :
    http://www.wyodor.net/htmlegg/TallCard/TallAjax.html?pg=tablesorter
    Or use a database on the server with MySQL and make tables with PHP :
    http://www.google.com/search?q=create+html+table+with+data+from+mysql+database
    Here's a very simple way to do it :
    http://home.wyodor.net/w3school

  • Include or create a view in the database and use this view?

    Well, I need to get related data of the main table from another related tables, so one way to do that is to use the Include method in Entity Framework to get this related data.
    However, I am thinking in another option, create a view in the database and use this view in entity framework. In this way, I avoid the needed of the include, because I think that is expensive in resources. But I am no very sure about that.
    I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
    For example, if I use the include I have the advantage that I get only one the main record and all the related data I have in the navigation properties, so the info is more shorted.
    Which is the advanteges and disadvantages of both methods to get related data in entity framework?
    Thank so much.

    Hello ComptonAlvaro,
    >>I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
    If your view would use a Join syntax to query master-child relationship tables, it actually is similar with the Include() method which actually results a duplicate records from master table, you could check this
    link for detail description.
    >>Which is the advanteges and disadvantages of both methods to get related data in entity framework?
    One visible difference is that records from Views are not editable by default(if you want edit them, you could refer to this
    blog).
    In your case, my suggestion that you could use the lazying load which will load the matter table once and disable the trace if you only need to display data.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I am using a macbook pro with system 10.6.8. I just discovered that no recent files have been backed up to the external disk using Time Capsule.  There is a long list of backups including most recent but no recent files, for some weeks, have been backed u

    I am using a macbook pro with system 10.6.8. I just discovered that no recent files have been backed up to the external disk using Time Capsule.  There is a long list of backups including most recent but no recent files, for some weeks, have been backed up.  I did a full reset of Time Machine.  I disconnected the external drive and reconnected it. It is not a matter of file types, no files and no folders have gotten backed up.  Everything looks normal though unless one goes hunting for recent files on the back up.

    Many thanks.
    With those symptoms, I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • BAPI or Function Module to create Handling Unit at the delivery level

    Please send me the BAPI / FM details to create Handling Unit at the delivery level.
    Thanks

    Hi
    you can try below BAPI's.
    BAPI_HU_CREATE 
    BAPI_HU_PACK
    Hope this helps you.
    Rgds,
    Kris.

Maybe you are looking for

  • Unable to create JAXBContext

    I'm using Oracle Enterprise Pack for Eclipse and WLS 10.3.3. I'm trying to write a web service to do a simple Oracle database query using JDBC and then return the results. I'm attempting to return the result in an array. Each element of the array con

  • "relink" problem in InDesign CS4: links are updated automatically

    Hi folks, we use a script to relink our InDesign documents when the links have been moved on the file system. Inside the script we just call link.relink(...) but not link.update(). We experience a different behavior between CS3 and CS4 after the scri

  • Error "-222"

    Here we go again. 7 songs pending download, and iTunes is "Unable to check for purchases. Unknown error ocurred [-222]" Sound familiar?

  • How to configure the Java Web Services Environment

    My computer is not connected to a network or to internet. I want to perform below mentioned tasks locally(in my own computer). [1] Assume that I am the service provider and I want to publish the service in a Service Registry.      [2] Now assume that

  • Mac mini locks up after yosemite update

    After the screensaver activates the computer locks up and I have to hold the power button in till it reboots Any ideas, this computer was bulletproof until the upgrade