prasannaadavi

Creating a Project in Project Server from SharePoint with selected Project Type

Blog Post created by prasannaadavi on Mar 10, 2016

Following up on my previous blog post, Enable on-demand Project Site creation for your PMO, my second demo at InspireX was to show how you could a similar process to collect requests in a SharePoint Site and then create projects in Project Server automatically.

 

If you are a Project Server user, you will understand how powerful this is. As for the workflow I have shown in the demo, Alex Burton has already blogged on this, so I will just link his post here.

 

One of the limitations, that Alex Burton covers in his post, is that the project you create will always get created using the default Enterprise Project Type in project Server. This could be a problem if you have multiple project Types, and you would like the workflow to create the correct project type.

In this post I will show you how to work around that issue.

 

For the sake of this post, I will assume you have read through Alex's post, and treat this as an extension of that workflow.

 

Step 1: Add a column to the Project Request List

 

Go ahead and add two columns to the SharePoint List, namely, Project Type. Make it a choice column.

 

You could add it to the form, and let the users pick this field, while creating a project request, or the approver could set it once he/she approves the request ( via Task Form).

 

 

Step 2: Get a list of all your Project template GUIDs and Enterprise Project Type GUIDs

Now, open up SQL Server Management Studio, run a couple of queries.

 

Query to get the GUIDs for Project Templates: SELECT PROJ_NAME, PROJ_UID FROM draft.MSP_PROJECTS WHERE PROJ_TYPE = 1
Query to get the GUIDs for Enterprise Project Types:  SELECT EnterpriseProjectTypeName,EnterpriseProjectTypeUID from MSP_EpmEnterpriseProjectType

 

In my case the information was as below:

 

EPT nameEPT GUIDTemplate GUID
Small7ADB5111-97DA-E511-940B-000D3A11B0767B910675-C1DA-E511-82B5-60029228F38E
Medium52B4B86B-97DA-E511-940B-000D3A11B076474DE41B-9CDA-E511-82B4-60029228F38E
Big538714D3-9EDA-E511-940B-000D3A11B0761CC23113-5EDA-E511-82B4-60029228F38E

 

Step 3: Modify the Workflow

For the sake of brevity, I will assume you have set up the workflow, and also have a way of selecting the project type at approval or after approval. I will only cover the steps that require to be added to Alex Burton 's workflow.

 

ActionConfiguration

After your Approval Action, add the "Set Variable" action,

to read the project type.

Now add a Switch action to do different

things based on different project type

For each branch on the Switch path, the following actions will

be the same, with different values

Call Web service to Create a project from Template.

Here you get to specify the template GUID you want to use.

The project will get created using this template GUID,

but will be created in the default EPT, which we will change later.

Call Web service to Publish the Project

 

We need to now change the Enterprise Project Type. So

Call Web service to Check-Out the project.

 

Now call a webservice, but note the change

in the ASMX and the web method. We are

calling the workflow.asmx webservice.

 

Here you get to set the EPT UID, to change the

project to your desired type.

 

And finally, check the project back in.

 

 

That's pretty much it. Now you can create projects in Project server, AND also have the projects to be of your desired type.

 

Now, this post assumes that the project site template is same for all project types. If the project site template is different for different project types, then you might need to defer the creation of the project site until after you create and change the project to your desired type.

 

Hope that helps!

Outcomes