none
Automatically publish project in project server 2016 RRS feed

  • Question

  • Hi,

    Some of the project manager in my organisation forgot to check and publish their project. So the imputations can't be update one the database.

    I would like to know if it's possible in the settings to automatically publish the projects in project server 2016. For example an automatic publication each week.

    Thanks,

    Friday, March 15, 2019 8:33 AM

Answers

  • Hello,

    No settings in PWA to do that but you can write some simple code to do it:

    JavaScript example: https://pwmather.wordpress.com/2014/04/17/projectserver-projectonline-publish-all-projects-javascript-jquery-sharepointonline-office365-ps2013/

    Or via PowerShell using CSOM - code sample below to help you get started (full test / update as needed on a non prod PWA instance etc.):

    #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 = "PWASite 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: $($_)"
        }
    }

    Paul


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

    Friday, March 15, 2019 4:33 PM
    Moderator
  • Poulet4500 --

    In addition to the excellent code-based solution from my esteemed colleague, PWA, I would add that what you are facing is definitely a training and performance issue.  I would strongly encourage you to teach the following process to your PMs and MANDATE that they all follow every step every week:

    1. Approve pending task updates in the Approval Center page in PWA for ONLY one project at a time.
    2. Once the updates have been approved for that project, open the enterprise project in Microsoft Project Professional.
    3. Set the Status Date value to the last day of last week's reporting period (normally last Friday, Saturday, or Sunday).
    4. Mark any milestones as 100% completed that were attained last week.
    5. Reschedule uncompleted work from last week into the current week.
    6. Analyze project variance, especially Finish Variance, Work Variance, and Cost Variance.
    7. Re-plan downstream tasks to make up for schedule slippage and bring the project back on track.
    8. Save the enterprise project.
    9. PUBLISH THE ENTERPRISE PROJECT.
    10. Close and check in the enterprise project, then return to step #1 and repeat this step for each successive project, one project at a time.

    There is really no excuse for your PMs failing to publish their projects every week.  But you (or someone with the authority) must MANDATE that the above process be followed by every PM, and then deal appropriately with any PM who does not or will not follow the above process.

    I hate to sound like a dictator, but using an enterprise tool requires discipline on the part of the organization to make sure that every Project Manager and Team Member follow the organization's prescribed processes.  This is how you succeed with Project Online.

    Hope this helps.


    Dale A. Howard [MVP]

    Saturday, March 16, 2019 12:36 AM
    Moderator

All replies

  • Hello,

    No settings in PWA to do that but you can write some simple code to do it:

    JavaScript example: https://pwmather.wordpress.com/2014/04/17/projectserver-projectonline-publish-all-projects-javascript-jquery-sharepointonline-office365-ps2013/

    Or via PowerShell using CSOM - code sample below to help you get started (full test / update as needed on a non prod PWA instance etc.):

    #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 = "PWASite 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: $($_)"
        }
    }

    Paul


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

    Friday, March 15, 2019 4:33 PM
    Moderator
  • Poulet4500 --

    In addition to the excellent code-based solution from my esteemed colleague, PWA, I would add that what you are facing is definitely a training and performance issue.  I would strongly encourage you to teach the following process to your PMs and MANDATE that they all follow every step every week:

    1. Approve pending task updates in the Approval Center page in PWA for ONLY one project at a time.
    2. Once the updates have been approved for that project, open the enterprise project in Microsoft Project Professional.
    3. Set the Status Date value to the last day of last week's reporting period (normally last Friday, Saturday, or Sunday).
    4. Mark any milestones as 100% completed that were attained last week.
    5. Reschedule uncompleted work from last week into the current week.
    6. Analyze project variance, especially Finish Variance, Work Variance, and Cost Variance.
    7. Re-plan downstream tasks to make up for schedule slippage and bring the project back on track.
    8. Save the enterprise project.
    9. PUBLISH THE ENTERPRISE PROJECT.
    10. Close and check in the enterprise project, then return to step #1 and repeat this step for each successive project, one project at a time.

    There is really no excuse for your PMs failing to publish their projects every week.  But you (or someone with the authority) must MANDATE that the above process be followed by every PM, and then deal appropriately with any PM who does not or will not follow the above process.

    I hate to sound like a dictator, but using an enterprise tool requires discipline on the part of the organization to make sure that every Project Manager and Team Member follow the organization's prescribed processes.  This is how you succeed with Project Online.

    Hope this helps.


    Dale A. Howard [MVP]

    Saturday, March 16, 2019 12:36 AM
    Moderator