Hi, Whats the best way to find a Document Id by filename? I found aaApi_GetProjectIdFromFileName2
Your question is too vague. It reminds me of advice I got from a mentor long ago on how to answer questions from clients that start with "What is the best way...". The only correct answer (from a consultant) to such questions is always "It depends..."
The api function you mentioned is to locate the document in a datasource for a file in a working directory. So what's the problem?
Do you mean, "where in a ProjectWise datasource is a document that has a file named 'myfilename.xyz'?"
Have you looked at aaApi_SelectDocumentsByNameProp()? That function can return 0, 1, or more results since a document or filename has to be unique in a folder, not in a datasource. (It might have to be unique in an environment if document coding is used.)
If you have more information about your "file", you could try using aaApi_SelectDocuments2() and populate the LPAADOCSELECT_ITEM structure appropriately.
Once you have selected your document into a buffer such as AADMSBUFFER_DOCUMENT, then you can use aaApi_GetDocumentStringProperty(), aaApi_GetDocumentNumericProperty(), etc. to retrieve the specific document properties.
Dan WilliamsSolution ConsultantBentley Systems, IncorporatedPortland, OR, USA (Pacific Time UTC-08:00)
I’m trying to re-identify a previously checked out file, in a new session of my application. Upon opening my said file(s) app, I would like to regain the information needed to check the file back in. Anyway I found I can iterate the properties aaApi_SelectDocumentsByProjectId.
aaApi_GetDocumentFileName == fullpath;
Answer Verified By: Daniel Marcotte
OH! Now I think I understand what your "problem" is. If the document/file has been checked out, that information is available from the "location" functions, which access the information a user "sees" when selecting the menu item "Local Document Organizer..." under "Tools" on the main menu of ProjectWise Explorer.
It might be a "better" approach, but of course that would depend upon your needs and what information is available to you. The location information includes what you see on that dialog box, i.e. Datasource, Node, User, PW folder, Doc/file name, working directory path, etc.
These functions are under ProjectWise DMS API -> Location Functions in the PW SDK help.