Project Server Recycle Bin

I found it strange the Project Server does not have a recycle bin for cases of accidental deletion of a project. One of my clients also found this strange and so I setup a project recycle bin. It works fairly simply by taking advantage of the archiving system of project server. This worked pretty well except that there is no way to specify how long a project will stay in the archive. So I figured the simplest way of accomplishing this was to setup a timer job that will access all of the projects in the archive and check for the custom description set when the project is sent to the “Recycle Bin”. It would then check when the project was deleted to see if it needed to be flushed from the archive. So far so good. Project server provides a method for programmatically deleting a project from the archive. The documentation seems fairly clear, it can be found at http://msdn.microsoft.com/en-us/library/office/gg204474.aspx. So I had my timer job call this method on the projects that needed to be removed. The documentation says to call the function passing the following parameters in this order:

  1. Guid JobUID
  2. Guid ProjectUID
  3. Guid ArchiveUID

So I used the following line of code.

archiveSvc.QueueDeleteArchivedProject(JobId, project.PROJ_UID, project.PROJ_VERSION_UID);

Well when ever the job ran nothing was getting removed. I pulled my hair out trying to figure out why this wasn’t working. Then I had an epiphany, maybe the parameters are reversed. So I created a test console app where I could try changing the values around. What I found was that if I reversed that last two parameters the project gets deleted as expected. So I changed the code in my timer job to:

archiveSvc.QueueDeleteArchivedProject(JobId, project.PROJ_VERSION_UID, project.PROJ_UID);

Now everything works as expected. So what happens is that you are passing the VersionID as the project ID and the Project ID as the Archive ID. Go figure.

 

SharePoint Saturday Silicon Valley – SharePoint Apps Slides

Thank you everyone for a great day at SharePoint Saturday in Palo Alto and thanks to everyone that attended my session. As I said, here are the slides for my presentation. I am also including a link to a survey if you didn’t get a chance to fill one out. I tried uploading the raw slides but they are too big. If you would like a digital copy and cannot get it from SlideShare shoot me a message and I will send it to you. Let me know if you have any questions.

 

Slides on SlideShare

 Survey

[SURVEYS 1]

SP.UI.ModalDialog.showWaitScreenWithNoClose and showModalDialog

Gotta love undocumented features. I have come to learn thanks to Sharepoint 2013 that for both the showModalDialog function and the showWaitScreenWithNoClose function you do not need to specify a height and width. If you do not provide these values SharePoint will automatically size your content for you.

I have been taking advantage of this “feature” for modal windows for quite some time. In the process of upgrading some web parts to SharePoint 2013, the larger fonts were causing problems with my wait messages. So I thought, why don’t I try and remove the height and width and see if SharePoint will handle it like it does modal windows. I removed the last two parameters and tried again and it worked beautifully.

For example change this

SP.UI.ModalDialog.showWaitScreenWithNoClose(“Processing”, “Your request is being processed. Please wait while this process completes.”, 100, 200);

to this

SP.UI.ModalDialog.showWaitScreenWithNoClose(“Processing”, “Your request is being processed. Please wait while this process completes.”);

and SharePoint will handle the sizing making it easier to deal with variable content size. Even on MSDN the parameters are not marked as optional. Hopefully they don’t pull this in the future.