Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Paul M.131's avatar
Paul M.131
Explorer | Level 4
9 years ago

Trouble with link and setting expiry date

I am creating a .NET app and all is working well so far with v2.1.  I can share a link, but if try to add an expiry date for the link it fails at the "CreateSharedLinkWithSettingsAsync" method, with a "settings_error/not_authorized/.." error!

 

I have read the .NET documentation, and searched the forums, but cannot get this working.

This is my code:

Dropbox.Api.Sharing.CreateSharedLinkWithSettingsArg shArgs = null;

 

//set the expiry date

Dropbox.Api.Sharing.SharedLinkSettings shSett = new Dropbox.Api.Sharing.SharedLinkSettings(null, null, DateTime.Today.AddDays(1));

var file = (FileMetadata)listView1.SelectedItems[0].Tag;

 

//The code work if I replace the 'shSett' variable with 'null' in this line of code

shArgs = new Dropbox.Api.Sharing.CreateSharedLinkWithSettingsArg(file.PathDisplay, shSett);

 

//this is the line where the error occurs

var result = await client.Sharing.CreateSharedLinkWithSettingsAsync(shArgs);

 

Any help appreciated.  Hopefully I have provided enough information.

 

Paul

 

 

4 Replies

Replies have been turned off for this discussion
  • Paul M.131's avatar
    Paul M.131
    Explorer | Level 4
    9 years ago

    Hi Gregory,

    Many thanks for your response and advice, and you were indeed correct, so I have now upgraded from the free account to Pro.

    However, I now have a new problem, which is "Error in call to API function \"sharing/create_shared_link_with_settings\": request body: settings.expires: time data '2016-04-24T00:00:00' does not match format '%Y-%m-%dT%H:%M:%SZ'"}.

    As far as I can see, the problem is arising in the Dropbox.Api.SharedLinkSettingsEncoder class, which has a DateTime value passed in, and where the "expires" value is:

    {{"path":"/Chrysanthemum.jpg","settings":{"expires":"2016-04-24T00:00:00"}

    Using the API Explorer and reading the error message, it appears that there should be a "Z" appended to the time in the settings, but I'm not sure how to achieve this.

    Not sure if it has anything to do with being a UK time format.

    Paul

     

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    I believe that should be fixed in version 3.0.6. Please update to that and let me know if it doesn't help.

  • Paul M.131's avatar
    Paul M.131
    Explorer | Level 4
    9 years ago

    Fantastic Gregory.  I have updated the Dropbox.Api and it now works perfectly.

    Many thanks for your quick response and helpful advice.

    Paul

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!