Create a Project from a SharePoint List Item Using AppStep

Posted By Posted by: Peter Williams on November 5, 2015

Objective

To create a project in Project Server 2013 by initiating a workflow from a SharePoint list item. A user who initiates the workflow may not necessarily have the Project Server 2013 permission to create a project in PWA.

Feature Highlight

Use the SharePoint Designer 2013 “AppStep” feature to resolve the hurdle of the workflow initiator having insufficient permissions to create a project in the Project Web App instance.

Notes

The SharePoint farm is configured for multi-tenancy.

A lot of the necessary steps are detailed in the following blog https://msdn.microsoft.com/en-us/library/jj822159.aspx

For further detail on assigning the require permissions to the workflow app please see https://msdn.microsoft.com/en-us/library/office/fp142383.aspx

High Level Prerequisites

  • An AppCatalog must be provisioned.
  • The Workflow app must be assigned the necessary permission.
  • The “SharePoint App” user must be granted sufficient permission in project server web app instance.
  • The SharePoint Designer 2013 workflow needs to contain the ‘Create Project from SharePoint List Item” action with an AppStep.

Step By Step

  1. Provision an AppCatalog if not done so already.
    In a multi-tenancy environment, this should be done by navigating to the tenant Administration site >> Manage App Catalog >> Create a new app catalog site.
    I named the site collection “AppCatalog”.

    Appstep image 01

  2. Activate the Site feature “Workflows can use app permissions”. Please note that this is not a site collection feature but a site feature.
  3. Grant the SharePoint full control permission and the Project Server manage permission to a workflow.
    1. Click the Settings (gear) icon.
    2. Select “Site Settings” from the context menu
    3. Click on “site app permissions”
    4. Copy the client section of the App Identifier. This is the identifier between the last “|” and the “@” sign, as shown in the screenshot below.

      Appstep Image 02

    5. Navigate to the Grant permission to an app page. This must be done by browsing to the appinv.aspx page of the site. E.g.

      https://tenanthostname/sites/appcatalog/_layouts/15/appinv.aspx

      Appstep Image 03

    6. Paste the client id in the App Id field and then click Lookup, as shown in the figure.

      Appstep Image 04

    7. Paste the following Permissions Request XML to grant Full Control (SharePoint) permission and Manage (Project Server) permission. Paste the contents below exactly as is.<AppPermissionRequests>
      <AppPermissionRequest Scope=”http://sharepoint/content/tenant” Right=”FullControl” />
      <AppPermissionRequest Scope=”http://sharepoint/projectserver” Right=”Manage” />
      </AppPermissionRequests>Appstep Image 05

    8. Click on the “Create” button.
    9. You will then be asked to trust the Workflow app, as shown in the screenshot below. Click Trust It.

      Appstep Image 06

  4. Create a new custom list in your Project Web App (PWA) site. In my example, I have a list called “AppStep Test”
  5. Open PWA in SharePoint Designer 2013
  6. Click Workflows in the navigation window
  7. Create a new list workflow on the custom list just created (e.g. AppStep Test).
    I labelled my new workflow “CreateProjectUsingAppStep”.
  8. Click on the App Step icon on the toolbar.
    Before App Step is inserted


    Appstep Image 07

    After App Step is inserted

    Appstep Image 08

  9. Chose the action “Create Project from Current Item” and insert it within the App Step section. This will cause the project to be created under the credentials used by the Workflow App, which earlier we gave Full Control of the tenant site collection and Manage permissions of Project Web app (which allows for a project to be created).

    Appstep Image 09

    Appstep Image 10

  10. Once your workflow is complete, publish your completed workflow.
  11. At this stage, I was expecting the ability to create a project by logging as a user with Team Member permissions, creating an item on my AppStep Test list and finally running the workflow on the new item. However, the workflow failed and was stuck in a suspended state.
    Another step was required!!
  12. After the first failed attempt to create a project, I added a new user with the following id “i:0i.t|00000003-0000-0ff1-ce00-000000000000|app@sharepoint”. This is done by navigating to PWA Settings >> Manage Users >> Click on New User button. I added this user to the Administrators PWA security group.

    Appstep Image 11

  13. Now I can successfully create a project by creating a new item on my AppStep Test list and running the workflow created in this blog. The credentials used only have Team Member permissions. The screenshot below shows my new project appearing in Project Center.

    Appstep Image 112

 


Blog Posted In Blog Posted In: Blog, How to, SharePoint
Blog Posted In 

3 thoughts on “Create a Project from a SharePoint List Item Using AppStep”

  1. Great post! Step 12, where you added the “i:0i.t|00000003-0000-0ff1-ce00-000000000000|app@sharepoint” account to PWA resolved our last work workflow issue. Thanks a ton!

    -Eugene

  2. Hi, I’ve followed the steps above, but when the workflows tries to create the project I get the following error:

    PJClientCallableException: GeneralNotLicensed
    GeneralNotLicensed
    method = CSOM.CreateProjectFromListItem
    user = i:0i.t|00000003-0000-0ff1-ce00-000000000000|app@sharepoint

    Has this happened to you? Any help would be appreciated.

  3. Hi AndyG,

    The issue you’re facing is due to Project Online (as opposed to SharePoint 2013 On-Premise) demanding an Office 365 licence for the account i:0i.t|00000003-0000-0ff1-ce00-000000000000|app@sharepoint. As it is not possible to assign the “internal” account an Office 365 licence, it means that at this time, Project Online does not support the functionality in this blog.

Leave a Reply

Your email address will not be published.