cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trouble with link and setting expiry date

Trouble with link and setting expiry date

Paul M.131
Explorer | Level 4

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 4

Greg-DB
Dropbox Staff

Hi Paul, you can find more information on this error in the documentation here:

https://dropbox.github.io/dropbox-sdk-dotnet/html/T_Dropbox_Api_Sharing_SharedLinkSettingsError_NotA...

In this case, it looks like the issue is that you're trying to set an expiration on a link using an account that doesn't have access to that feature.

Paul M.131
Explorer | Level 4

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
Dropbox Staff

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
Explorer | Level 4

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

Many thanks for your quick response and helpful advice.

Paul

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Paul M.131 Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?