Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a shared link #35

Closed
everettevola opened this issue Mar 8, 2013 · 5 comments
Closed

Creating a shared link #35

everettevola opened this issue Mar 8, 2013 · 5 comments
Labels

Comments

@everettevola
Copy link

I am having trouble creating a shared link on a file. From what I can tell on the box developer documentation, only the "Access" property must be set on the SharedLink object prior applying it to a file. The following code is failing with a BoxException.

SharedLink sharedLink = new SharedLink()
{
Access = BoxApi.V2.Model.Enum.Access.Collaborators
};
file = _manager.ShareFileLink(file, sharedLink);

Can you point me in the right direction?

@everettevola
Copy link
Author

I have been looking through your source code and something struck me as odd. In Permissions.cs, BoxApi.V2.Model, the CanDownload property has JsonProperty attribution for "item_collection". Shouldn't this attribution point to "can_download"?

I am not sure if this is related to the issue I am having in my initial comment above, but it does look suspicious.

@jhoerr
Copy link
Owner

jhoerr commented Mar 8, 2013

Both things are bugs. I've added tests and fixed the issues. Will commit them shortly!

@jhoerr
Copy link
Owner

jhoerr commented Mar 8, 2013

Fixed in 35d85fe. Let me know if you still have any problems.

@jhoerr jhoerr closed this as completed Mar 8, 2013
@ibelong2sathish
Copy link

There is an issue with shareLink, it is throwing the error as "Bad Request".

The code that I had used to generate the shared link as follows:

Dim expectedLink As SharedLink = New SharedLink(BoxApi.V2.Model.Enum.Access.Open, Permissions:=New Permissions() With {.CanDownload = True, .CanPreview = True})
Dim linkedFile As File = objBox.ShareLink(objFile, expectedLink)

Kindly point me with the right direction..

@elattoo
Copy link

elattoo commented Jan 4, 2014

Hello. I'm having the "Bad Request" issue as well. Anybody still monitoring this? I'm using v2 c# api.

BoxFile file = boxManager.CreateFile(folder, fileName, fileStream);
file.Description = descriptiveTags;
boxManager.Update(file);
SharedLink sharedLink = new SharedLink(BoxApi.V2.Model.Enum.Access.Open);
BoxFile linkedFile = boxManager.ShareLink(file, sharedLink);
boxManager.Delete(linkedFile);

It barfs on the "ShareLink" attempt. Everything prior is working fine. BoxFile is an alias for BoxApi.V2.Model.File, and BoxFolder = BoxApi.V2.Model.Folder.

Thanks!
Kevin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants