Create document version for document already checked-out

Is there a function to create a new version of a document on check-in?

Parents
  • Yes, take a look at aaApi_DocumentCheckInActionDlg2().

    You may already be aware of the "problem" of finding what you are looking for in the ProjectWise SDK documentation.  A "trick" I have covered before, and cover in the ProjectWise SDK training that I teach, is to be "clever" on how you search for your item of interest.  Unfortunately, it's a bit of "you don't know what you don't know" as well as "words get in the way" type of problem, particularly if your native language is not English!

    For example, to find the function to MOVE a FOLDER, it isn't clear that the key word here is PARENT.  To move a folder, you need to change a folder's parent folder.

    That function is aaApi_SetParentProject().  And of course, in this context and this instance, a folder is called a project.  

    Another example, is how I found the function to create a version on check in, to answer the question in this post.

    What I did was to search the *.h and *.fdf files delivered with the SDK for text that I thought might be related to what I was looking for.

    To find the above function I used this search in Notepad++:

    Then by browsing through the results I noticed this:

    And clicking on line 2553 I then see this:

    Then by looking at the documentation in the help file, I found a function that will allow a new version to be created on check in!

    HTHs

  • Thanks Dan, but I can't use a dialog in this case. I am trying to use aaApi_NewDocumentVersion but it requires the document to be checked in. But if I can't update the Server before creating a new version so I am trying to free the document, create the new version and check-out the document again with aaApi_FetchDocumentFromServer and flags AADMS_DOCFETCH_CHECKOUT | AADMS_DOCFETCH_IGNORE_UPTODATECOPY.

    When the file gets checked-out it overwrites the local copy. I have tried using AADMS_DOCFETCH_LOCK but I can't specify a working folder.

  • Oh, no dialog.

    I think your logic is OK, but you will have to move or copy the file that you have in your working directory so that you can overwrite the file that will be checked out, before you check it in again.

    Or, you could save a copy of the file somewhere safe, free the document, create a new version and then replace the newly created document version's file with one of the aaApi_ChangeDocumentFileX() functions.

    I have had problems with replacing files on documents in the past, and my workaround was to first remove the file, and then add the file, but try the "change doc file" functions first to see if they do what you need.

    FWIW, this is another case of not knowing what to look for.  I want to replace a document's file, but the functions that will do that are named with "change".  And again I searched the *.h and *.fdf for the search string replace.*file and found this:

    Answer Verified By: Kevin Cox 

Reply
  • Oh, no dialog.

    I think your logic is OK, but you will have to move or copy the file that you have in your working directory so that you can overwrite the file that will be checked out, before you check it in again.

    Or, you could save a copy of the file somewhere safe, free the document, create a new version and then replace the newly created document version's file with one of the aaApi_ChangeDocumentFileX() functions.

    I have had problems with replacing files on documents in the past, and my workaround was to first remove the file, and then add the file, but try the "change doc file" functions first to see if they do what you need.

    FWIW, this is another case of not knowing what to look for.  I want to replace a document's file, but the functions that will do that are named with "change".  And again I searched the *.h and *.fdf for the search string replace.*file and found this:

    Answer Verified By: Kevin Cox 

Children