Beginner question - How do I get the File ID for file if I know path and file name?
Wow, a lot of doc on API! Trying to sort thru it all.
I have an in-house ASP.NET web forms app that displays information for an order. I want to put a link on the page that will pull up a given .pdf file that is stored in the our companies Box folder available to anyone using the web page (read only).
I will know the folder path/name where the file will be stored as well as the exact file name (order#.pdf).
So looking thru the doc, I believe the function I want is the "Get Shared Link" from https://developer.box.com/reference
string fileId = "11111"; BoxFile file = await client.FilesManager.GetInformationAsync(fileId); string sharedLinkUrl = file.SharedLink.Url;
Then the link I want to put on the page is passed in from file.SharedLink.Url. Correct?
The piece I am not finding is how do I get "fileId" of a file when I know it's path and name?
Is there a function for that?
Thanks
-
If you just want a link to the file instead of displaying the actual file on your webpage then yes, a shared link is the way to go. Do you have access to the file in the webapp? If so, the easiest way to get a file ID is to navigate to the file within the webapp and look at the URL, which will be something like: https://kourtneybiz.app.box.com/file/412627423792. In this example 412627423792 is the file ID.
-
Hey Kourt,
Thanks for the reply.
I think we may be using the webapp. I can put in a URL like:
"https://MyCompanyName.app.box.com/folder/0123456789" and get to the exact folder I want.
So now I have a new question. You know how on that page there is a "Search Files and Folders" box at the top.
Is there someway that I can add text to my URL to have that text auto-populate that Search box?
Thanks,
-
We have folders divided up by plant. In each folder, our file names start with Order-Item number. We only want to see the files for the particular order/item we pass to the search. (We don't want the user to have to bother typing or copy/pasting into the search bar. We want it automated.)
Someone in our company figured it out. You do it like this:
https://MyCompany.app.box.com/folder/1234567890/search?metadata=&owners=&query="11111111_222"
If there is documentation on how to very useful things like this, I would like to know where to find it.
Any other useful tips along this line?
Thanks
サインインしてコメントを残してください。
コメント
4件のコメント