The Recycle Bin

Let’s start things off with a bang.  Here is a fully working utility with full source code.  Enjoy.



(click image for larger view)

Overview:

The Recycle Bin prevents users from deleting files directly.  Instead of using the Delete command, they can send files to the Recycle Bin state.  On the weekend, a utility backs up all the files in the Recycle Bin and deletes them from the Vault.

Requirements:

Vault Workgroup 2010 or Vault Collaboration 2010 or Vault Manufacturing 2010

Introduction:

This is what I will refer to as a “high touch” utility.  What I mean by high touch is that the utility doesn’t work entirely on its own.  It will only work if the Vault is configured in a special way.  In this case, we need to add a Recycle Bin state to the lifecycle definition.  We also need to create a specialized user.

Click here to download the application

Click here to download the source code

Configuring the Vault:

First let’s create a Vault to put all our backup files:

  1. Open the Autodesk Data Management Server Console
  2. Select the Vaults entry in the left tree
  3. Select Actions -> Create from the menu
  4. Create a new Vault with the name BackupVault
  5. Exit the console

Next let’s create the specialized user:

  1. Log into Vault as an administrator
  2. In the menu, select Tools -> Administration
  3. Select the Users tab
  4. Click on the Users button
  5. Click on the New User button
  6. Fill in “AppRecycleBin” as the UserName, choose a password, and set the role as “Administrator”, “Document Editor (Level 2)” and “Document Manager (Level 2)”.  Also, give access to the main Vault and the backup Vault.

  7. Click OK to create the user.
  8. [Optional] Create a Group called Automations and add AppRecycleBin to that group.  In the future, any other application specific logins can go in this group.
  9. Close all open windows by clicking OK.

Now let’s configure the lifecycle states.  For this example I will use the Flexible Release Process.

  1. In the menu, select Tools -> Administration
  2. Select the Behaviors tab
  3. Click on the Lifecycles button
  4. Select the Flexible Release Process and click on the Edit button
  5. Click on the Add button in the Lifecycle Details section
  6. Create a new state called Recycle Bin

  7. Click OK to go back to the Lifecycle Definition dialog.  You should now see the Recycle Bin state in blue
  8. Click Apply and the Recycle Bin state should turn black
  9. Click on the Recycle Bin state and select the Transitions tab

  10. Select Recycle Bin -> Released then click the Edit button
  11. Select the Security tab
  12. Uncheck the No Restrictions checkbox
  13. Click the Add button and select Everyone
  14. Give Everyone the Deny permission
  15. Click OK

  16. Repeat steps 10-15 for states Recycle Bin -> Quick-Change, Released -> Recycle Bin, and Quick-Change -> Recycle Bin
  17. In the Lifecycle Definition dialog, select the Security tab for the Recycle Bin state
  18. Uncheck the No State Based Security checkbox
  19. Add an entry for Everyone and set the permission to Allow Read.
  20. Add an entry for AppRecycleBin and set the permission to Allow Read, Write and Delete.

  21. Update the security on the Work In Progress and For Review states so that Everyone has a Deny Delete setting and Allow for Read and Modify.

  22. Exit all dialogs by clicking OK.

Now we have our Vault configured properly.  The only way to delete a file using the Flexible Release Process is to put it in the Recycle Bin and let the Recycle Bin utility delete it.

Configuring the Recycle Bin Utility:

  1. Download and unzip the utility
  2. Create a file called Run.bat in the same directory ast RecycleBinUtil
  3. Edit Run.bat in a text editor and write out the RecycleBinUtil command.  See the readme.txt file for a description of the parameters.

    Example:  RecycleBinUtil -U AppRecycleBin -P pass -S novdrwxp -V Vault -BV BackupVault -L out.txt
  4. [Optional] Run the bat file to make sure things work
  5. Go to the Windows Control Panel and select Scheduled Tasks
  6. Right click and select New->Scheduled Task
  7. Name the scheduled task.  Ex. Empty Vault Recycle Bin
  8. Right click the task and select Properties
  9. Go to the Task tab
  10. Set the Run parameter to the Run.bat file.   Set the Start In parameter to be the directory that run.bat lives in.

  11. Go to the Schedule tab
  12. Set the task to run once a week at 1:00 AM on Sunday, or whenever you want.

  13. Click OK and set login info if needed.



Disclaimer:


This application is experimental in nature. It has not been tested in any manner, and Autodesk does not represent that it is reliable, accurate, complete, or otherwise valid. Accordingly, this application is provided “as is” with no warranty of any kind and you use the application at your own risk.


Comments

4 responses to “The Recycle Bin”

  1. This is great! What else you got?
    Anything on, creating a list of files in vault that are “Released”?
    What about creating PDF’s of “Released” files?
    I have needs for somehting like this today!

  2. Creating a list of Released files is something you can do in Vault Explorer. You can run the Find command and search for cases where “State” is “Released”.
    In the API, you can run the search with FindFilesBySearchConditions in the Document Service. The VaultFileBrowser example in the SDK has an example of how to use this function.

  3. Doug, could this be applied to Productstream 2009?

  4. Unfortunately no. The Recycle Bin utility is based on the ability to set a lifecycle state on a file. That feature was introduced in the 2010 product line and not available in PS 2009.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading