Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API: Get file id by file name

6 REPLIES 6
Reply
Message 1 of 7
rjwinkelman
1295 Views, 6 Replies

API: Get file id by file name

I am new to using the Vault API. Many API functions require a fileid or fileMasterid. From my position I am starting out with a file name. I must be overlooking something or missing a concept. I don't see a function like GetFileIDByName. I have created a sub using FindFilesBySearchConditions to get a file by it's name. Is there a function that you give a file name and file ID(s) are returned?

Thanks
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: rjwinkelman


The search is indeed your best solution.

 

It is possible [depending on your configuration] to
have multiple files with the same name. So there is not necessarily a 1-1
mapping between file name and ID.

 

Paul Gunn


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am new to using the Vault API. Many API functions require a fileid or
fileMasterid. From my position I am starting out with a file name. I must be
overlooking something or missing a concept. I don't see a function like
GetFileIDByName. I have created a sub using FindFilesBySearchConditions to get
a file by it's name. Is there a function that you give a file name and file
ID(s) are returned? Thanks
Message 3 of 7
rjwinkelman
in reply to: rjwinkelman

Thanks for the explanation Paul, I can now shake the feeling that I was overlooking something else. We are going with unique file names, so I'll create my own front end subs based on names.

Thanks,

Rich
Message 4 of 7
Anonymous
in reply to: rjwinkelman

If you know the full Vault path, FindLatestFilesByPaths is a good function
to use.

If you just have the name, FindFilesBySearchConditions, like you are
currently doing, is a good option. Another option is to use
GetLatestFilePathsByNames which will give you all the matching File objects
and the Vault path.
NOTE: A file can be shared across multiple folders.


Doug Redmond
Software Engineer, Autodesk Inc.
Message 5 of 7
rjwinkelman
in reply to: rjwinkelman

Thanks Doug, I'll give those functions another look.
Message 6 of 7
rjwinkelman
in reply to: rjwinkelman

Thanks Doug, I'll give those functions another look.
Message 7 of 7
Felix-Saibel
in reply to: Anonymous

"GetLatestFilePathsByNames": it's a great hint, I was was look for quite a while, also

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report