ProjToolV2

Microsoft recently released a new ProjToolV2 that uses CSOM. The tool is in the 365-Project-Online-OMProjectToolV2 section. The tool can be ran against Project Server 2013 & 2016, as well as Project Online.

*Note: the tool is not meant to be used as an editing tool, and it is not suggested to be used on Production systems.

One way to use the tool is for when you have several projects to create, this will be a quick way to get it done, without manually having to create them.

We hope everyone has a great weekend, and if you have any question just Contact Us

 

 

Below is the full article and steps to set up the ProjToolV2 written by Brian Smith at Microsoft:

Many of you will be familiar with the original ProjTool which we released as a sample for Project Server 2007 and 2010 for use of the PSI to program against Project Server.  We have just released a new ProjTool that uses CSOM and has many of the familiar options of the original tool.  This is distributed as per our other recent samples via the OfficeDev section on GitHub and can be downloaded with all the other samples from https://github.com/OfficeDev/O365-Project-Online-.Net-Samples.  Take care where you unzip these as you can end up getting warning in Visual Studio about path lengths.  The specific ProjToolV2 is in the 365-Project-Online-OM-ProjToolV2 section, and despite the name it can be run against Project Server 2013 and 2016 as well as Project Online.

To walk you through getting this up and running I’ll assume you have some version of Visual Studio already loaded (I have Visual Studio 2015 Professional) so you first download the samples (may as well get them all – you can then play with the others too!)

Project CSOM Samples

Unzip and read the license agreement (of course) then open ProjToolV2.sln.

ProjToolV2

If you try and build it straight off you will hit some namespaces not found errors – as you need the SharePoint Client Object Model libraries.  I happened to choose to use the ones for SharePoint Online as these are conveniently available via nuget.org.  The GitHub page also lists the Project Server 2013 ones. However, to get the SharePoint Online ones you navigate to https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/ and take a look at the link for the Package Manager Console.  I already have the console installed – so I can just enter

Install-Package Microsoft.SharePointOnline.CSOM – and hit return to get this loaded:

package manager console

One other error – we have an .ico file referenced in the wrong location – so you will get this:

Error opening icon file D:\Tools\365-Project-Online-OM-ProjToolV2\ProjToolV2\Project.ico — Could not find file ‘D:\Tools\365-Project-Online-OM-ProjToolV2\ProjToolV2\Project.ico’

I simply copied it from the images directory to the location where it was looking – but you could reference the images directory instead.  Click Start again and my ProjToolV2 was ready to go!

enter credentials to login to ProjectServer

I’ve set my Url (which, despite the name, happens to be a Project Server 2013 machine) and I can use Windows to log in.  If you want to connect to a Project Online PWA then just check the box.

Project Server

The next screen is where you can really start doing stuff – plenty of option down the left to interact with the various Project entities, as well as being able to turn logging on so you can track what the application is doing (under Settings – top right).  First I’ll click Project under the Update section – select a project from the dropdown that gets populated and see what I can see.  I’ve navigated to the Tasks tab as there is more to see – and scrolled across a bit.

Project Server CSOM

Filter fields is a feature from the previous ProjTool that can be very useful – if I am only interested in fields that contain ‘start’ – then I can filter away!

Project Info Tasks

This isn’t meant to be an editing tool for projects – so we don’t suggest you point this at your production systems – but it is a great way to get started with CSOM programming with Project Server and Project Online!

Here is the Project Creation dialog – with plenty of options for choosing how your new plans are configured:

Project Server CSOM

This is great for creating a bunch of Projects – but they tend to be pretty boring with set names and tasks etc.  But you can also have it set assignments and use either local or enterprise resources.  There are plenty of other options for resources, lookup tables and custom fields for you to try out, and of course look at the code that makes it all happen  However, the release of this was really timely as I had a need today to check out a CSOM method for creating a project from a template.  Now this isn’t one of the features present in the initial release (Robert has added to the backlog!) but one thing I’ve often used ProjTool for is a ready made harness for other stuff I need to do – without having to build from scratch.  There is a parameter you can set in your ProjectCreationInformation to set a Enterprise Project Type Id.

I could find out the EPT Id from the Url of the Enterprise Project Type – just by clicking through from the PWA Settings, Enterprise Project Types page – and here is the full string – http://brismithp16/PWA/_layouts/15/PWA/Admin/EnterpriseProjectTypeDetails.aspx?entProjectTypeUid=e60ecff8-28ed-e411-80d2-001dd8b731f9.

The code I needed to change can be found in the Creation folder – and specifically the ProjectsCreation.cs file.

Project Creation

Mine was a quick and dirty test – so I was happy to hard code in the GUID, so just needed to add the parameter after the projName.  So my new code looked like this:

string projName = txtProjName.Text + projCount;
List projectTeam = new List();
PublishedProject newProject = ProjContext.Projects.Add(new ProjectCreationInformation { Name = projName, EnterpriseProjectTypeId = new Guid(“e60ecff8-28ed-e411-80d2-001dd8b731f9″) });

(Careful if copying – WordPress sometimes turns quotes into ‘smart quotes’ – which isn’t very smart! – and of course use your own GUID)

This would probably get confused if you also checked the options for adding task, assignments etc. – but worked perfectly to test out creating a project from a template using CSOM.  I was also very pleased to see this work – as we recently broke the CreateProjectFromTemplate method in Project Server 2013 with the March Update (it appears to work but you never see the projects show up!).

Have fun with ProjToolV2 – take a look at the code and use this as an easy path into Github, Nuget and CSOM if, like me, these are all pretty new concepts for you.