Problem
Violation of PRIMARY KEY constraint error encountered when trying to delete files and folders.
Solution
If you encounter error 2627, a good place to look is the deleted items folder in ProjectWise Explorer if it is enabled. In the instance I ran into, there was a direct mention of the table pk_dms_trash which is the table that holds deleted items in PWE.
The user I was working with has been setting up a test environment for training and pre-production testing. During this process, he had done imports and exports, and at some point had deleted several folders and files which were kept in the deleted items folder. When he tried to delete folders or files again, the system threw the unique constratint error and error 2627 was logged in the pwc.log.
The fix is to either permanently delete the contents of the deleted items folder if it is safe to do so, or to browse through the contents of deleted items to see if the file you are trying to delete already exists in the deleted items folder and delete it individually.