Hi all!
PW SDK 08.11.07.443
I have been requested to rename certain specific files that were imported into the ProjectWise system over a year ago.
The scenario is this:
Only files matching a specific file name format of "50XXXXXXXX.dgn" will be processed. The same text string was used for the document name and description by default when the files were bulk loaded.
The new file name, document name and description format needs to be "550-XXXXX-XXX.dgn"
I noticed that the only function calls I found in the PW SDK to rename a document are "dialog" functions. I want to run my program against small groups of docs, on a folder by folder basis, but I don't want to have user input. Are there any other functions to rename a doc or does the "aaApi_RenameDocumentDlg " not require user input?
While it is my intention to only change the doc name, file name and description (not the GUIID), are there any "gotcha's" I should watch out for?
Are there any code examples/samples of the use of the "aaApi_RenameDocumentDlg" function call available?
Thanks and Merry Christmas!
Regards,
Bert
I think you need aaApi_ModifyDocument() or aaApi_ModifyDocument2(). Like this:
aaApi_ModifyDocument (folderID, docID, 0, 0, 0, 0, 0, newFileName, newDocName, newDocDescription);
balys
You'll want to check a few things before renaming.
1. Make sure the document is checked in. If you're using the static buffer, just get string property DOC_PROP_DMSSTATUS for the current selection (it needs to be AADMS_ITEM_IN).
2. You'll need rights to write to the data and the file. I use aaApi_GetDocumentAccess to check.
3. Naming conflicts. The "Name" must be unique within the folder (not considering versions). Same for file name. If you try to use a Name or file name already in use, ModifyDocument will fail.
4. If you have prior versions of documents that also need to be renamed, in my experience not even the API allows it.
Hi Jeff and Balys,
Thanks very much for the information and tips!