none
What must I use instead of Project Server Interface (PSI) for project Server 2016-2019? RRS feed

  • Question

  • Hello!

    We are a partner of Microsoft.

    We develop integration of our internal corporative on-premises Project Server 2016 and our internal-use YouTrack instance.

    We know of recommendations from Microsoft to use the PSI (Project Server Interface) 2013.

    https://docs.microsoft.com/en-us/office/client-developer/project/project-server-2013-architecture-and-programmability

    We failed to access the PSI on our instance of MS Project server 2016:

    PS C:\Users\latyshev.kon> $svcPSProxy = New-WebServiceProxy -uri "http://msk-project-t/pwa/_vti_bin/PSI/Project.asmx?wsdl" -useDefaultCredential

    New-WebServiceProxy : The request failed with HTTP status 404: Not Found.

    At line:1 char:15

    + ... vcPSProxy = New-WebServiceProxy -uri "http://msk-project-t/pwa/_vti_b ...

    +                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

       + CategoryInfo         : ObjectNotFound: (http://msk-proj...oject.asmx?wsdl:Uri) [New-WebServiceProxy], WebException

       + FullyQualifiedErrorId : WebException,Microsoft.PowerShell.Commands.NewWebServiceProxy

    PS C:\Users\latyshev.kon>

    PSI_2016_error.png

    To fulfill our Project Server - YouTrack integration we need to solve a local problem:

    How to publish a selected enterprise project on Enterprise PWA using a PowerShell script?

    What can You recommend us?

    Tuesday, December 17, 2019 6:25 PM

Answers

  • Hello,

    The Project class is removed from the PSI from 2016 onward - you will need to use CSOM: https://docs.microsoft.com/en-us/office/client-developer/project/getting-started-with-the-project-server-csom-and-net similar to below for publishing all projects:

    #Update correct location for the Project Server Client dll
    Import-Module 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.ProjectServer.Client.dll'
    #Update the PWA URL for the on-prem Project Server 2016 PWA URL
    $pwaPath = "PWA URL"
    
    $projContext = New-Object Microsoft.ProjectServer.Client.ProjectContext($pwaPath)
    
    $projects = $projContext.Projects    
    $projContext.Load($projects)
    $projContext.ExecuteQuery()
    
    $projects = $projContext.Projects | select Id,Name
    
    Foreach ($project in $projects){
    Try{
            $proj = $projContext.Projects.GetByGuid($project.Id)
            $draftProject = $proj.CheckOut()
            $draftProject.Publish($true) | Out-Null
            $projContext.ExecuteQuery()
            Write-host -ForegroundColor Green $project.Name " has been published"    
        }
    Catch{
            write-host -ForegroundColor Red "Add error occurred whilst attempting to publish project: "$project.Name". The error details are: $($_)"
        }
    }
    Update and fully test etc. on a non production PWA instance before Production.  

    Paul



    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Wednesday, December 18, 2019 12:37 PM
    Moderator

All replies

  • Hello,

    The Project class is removed from the PSI from 2016 onward - you will need to use CSOM: https://docs.microsoft.com/en-us/office/client-developer/project/getting-started-with-the-project-server-csom-and-net similar to below for publishing all projects:

    #Update correct location for the Project Server Client dll
    Import-Module 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.ProjectServer.Client.dll'
    #Update the PWA URL for the on-prem Project Server 2016 PWA URL
    $pwaPath = "PWA URL"
    
    $projContext = New-Object Microsoft.ProjectServer.Client.ProjectContext($pwaPath)
    
    $projects = $projContext.Projects    
    $projContext.Load($projects)
    $projContext.ExecuteQuery()
    
    $projects = $projContext.Projects | select Id,Name
    
    Foreach ($project in $projects){
    Try{
            $proj = $projContext.Projects.GetByGuid($project.Id)
            $draftProject = $proj.CheckOut()
            $draftProject.Publish($true) | Out-Null
            $projContext.ExecuteQuery()
            Write-host -ForegroundColor Green $project.Name " has been published"    
        }
    Catch{
            write-host -ForegroundColor Red "Add error occurred whilst attempting to publish project: "$project.Name". The error details are: $($_)"
        }
    }
    Update and fully test etc. on a non production PWA instance before Production.  

    Paul



    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Wednesday, December 18, 2019 12:37 PM
    Moderator
  • Hello, Paul!

    I tried the code on my collection of projects.

    Result: all published projects are re-published.

    Non-published projects:

    Non-published projects cause message like this:

    Add error occurred whilst attempting to publish project:  AM1011_Project . The error details are: Exception calling "ExecuteQuery" with "0" argument(s): "CICOCheckedOutInOtherSession".

    What is my "missing" action?

    How to publish totally all my projects?

    Thanks in advance!

    Thursday, December 19, 2019 3:04 PM
  • Hello,

    That is because those projects are checked out already elsewhere.

    Paul


    Paul Mather | Twitter | http://pwmather.wordpress.com | CPS | MVP | Downloads

    Thursday, December 19, 2019 3:54 PM
    Moderator
  • Thanks!
    Thursday, December 19, 2019 10:18 PM