Proper SDK Method of Moving Folder of Files & Sub-Folders

We have an external database tool that is used in issuing file Transmittals to customers. When a project utilizes ProjectWise (not all do) then this is done within the ProjectWise environment. So when a new Transmittal is started, the tool creates a "working folder" in the PW environment for users to place all files to be included in the current issue. There may be hundreds of files and sub-folders of files. Days or weeks later, when the Transmittal is ready for issue, the user checks the "Issue Complete" checkbox. At this time, all files, sub-folders, etc. that were in the "working folder" in PW should be moved to a read-only "Issue Folder" that is created in the PW environment where it will remain until the project is fully completed & archived.

Obviously, we would like all of these files to be properly "tracked" so we are not looking to copy them to a new location and delete the old files. Instead we want all files & sub-folders to be physically moved so the history will show when they were originally created, where they originally resided, when they were moved to their new location etc... all file IDs should remain the same for the entire set of files. We're having trouble determining how this is best accomplished via the ProjectWise SDK. Are there any examples of this or can you point us in the direction that is recommended?

Thanks!

Parents
  • Use the GUIDs as the ProjectId and ItemNo (DocumentID) will change if you move documents.  If you move just the folders, then the Folder ID won't change, but best to use the folder's GUID if you want to "track" things.

    You may have already looked at Bentley's solution https://www.bentley.com/en/products/product-line/project-delivery-software/projectwise-deliverables-management 

    but if you haven't, you might consider that approach rather than "rolling your own" and having to maintain it over time, etc.

    Answer Verified By: Dave B 

  • Dan, it sounds like you're saying the SDK allows moving the folders themselves. It would indeed be ideal if we could simply make an SDK call on the top level folder containing everything in the transmittal and move it to a different location. Whereby everything contained within it now resides at the new location. Is there such an SDK function/method for doing that? It seems like there would be, but we have apparently overlooked it. 

    Thanks for your help!

  • Is it just a matter of changing the parent folder of the top level folder to a different folder at the appropriate "Issue folder" location via aaApi_SetParentProject?

  • If you knew me better, you would know that I won't answer questions like this without specifics (sample data) because it all depends upon the details, as well as "words get in the way", meaning assumptions made by you or me, for instance, I really don't know what you mean by "issue folder".

    Generally speaking, yes, aaApi_SetParentProject will move a folder from one location in your datasource to another, but beware of the noted requirements in the help.  The function can also fail for other reasons, so be sure to capture the error and be prepared to deal with that possibility.  As always, test your code against a test/development datasource and try to find some scenario that you suspect might make the code fail and go from there.  User rights and security are the most obvious reasons why a move would fail, but perhaps there are other reasons why the move might fail. 

    One "side effect" where the move works, but the results are not what you anticipated, that I can think of off hand is for you to be prepared to handle any security requirements that might change.  If your folder is inheriting security from "above" (workflow and/or object security), then moving that folder will obviously change what its security is being inherited from.  So again, be sure to thoroughly test your code and try to break it with scenarios that you aren't necessarily using now.

    Answer Verified By: Dave B 

Reply
  • If you knew me better, you would know that I won't answer questions like this without specifics (sample data) because it all depends upon the details, as well as "words get in the way", meaning assumptions made by you or me, for instance, I really don't know what you mean by "issue folder".

    Generally speaking, yes, aaApi_SetParentProject will move a folder from one location in your datasource to another, but beware of the noted requirements in the help.  The function can also fail for other reasons, so be sure to capture the error and be prepared to deal with that possibility.  As always, test your code against a test/development datasource and try to find some scenario that you suspect might make the code fail and go from there.  User rights and security are the most obvious reasons why a move would fail, but perhaps there are other reasons why the move might fail. 

    One "side effect" where the move works, but the results are not what you anticipated, that I can think of off hand is for you to be prepared to handle any security requirements that might change.  If your folder is inheriting security from "above" (workflow and/or object security), then moving that folder will obviously change what its security is being inherited from.  So again, be sure to thoroughly test your code and try to break it with scenarios that you aren't necessarily using now.

    Answer Verified By: Dave B 

Children
No Data