This may be similar to my other post, except that we have come to grips with the reality that (at least for now) we won't be able to change the names of versioned files.
I have about 15000 files to rename, and I would like to automate the process to save time, and to avoid errors inherrent with tedious processes.
So far the only API function I have found that will rename a document is aaApi_RenameDocumentDlg, which doesn't really rename the document it just pops open the dialog so that the user can renmame it.
Am I missing something? Also any tips on how to go about iterating or searching through the files in my document library would be appreciated.
TIA, John
John,
Attempting to rename a file in ProjectWise could fail for a number of reasons. You could simply try and then check the error. Take a look at aaApi_GetLastErrorId() and the related functions. You might want to try this approach just to help you determine why you cannot rename this particular document's file. You cannot rename files of previous document versions, so I would check and verify that the document you are trying to modify is in fact the "Active" document. Check the documentation for the document property DOC_PROP_ORIGINALNO.
You can only rename a file if the active document is checked in and the user has write access to the document and file. Also, "Final status" will also keep you from being able to rename a file. You can examine a document properties by selecting it into a document buffer and then using aaApi_GetDocumentNumericProperty() or aaApi_GetDocumentStringProperty().
Instead of selecting the document into a buffer and using the "Get" functions, you can also use convenience functions such as aaApi_IsDocumentCheckedIn() to check if a document is checked in or not. You can check if you have write access to the file with aaApi_GetDocumentAccess() although I'm not sure if this will actually tell if you have write access to the file as you can have write access to the document, but not the file. For that level of detail, you may have to use aaApi_SelectAccessControlItems() and then aaApi_GetAccessControlItemNumericProperty() and then take a look at ACCE_PROP_ACCEMASK.
HTHs