Updating Base Calendar property in Resources using Powershell RRS feed

  • Question

  • Hello, I'm trying to modify in bulk the base calendar property in Resources using powershell, to do that I write a script, but until now it is not working and I have no clue to solve it, that is why I like to ask to you, the people that know.

    My Script is the following, it is simple I have a CSV file with the Resource ID ($Resource.RES_UID) and a calendar index ($Resource.Calendar, it point to the right calendar in the list calendars on the Project Server):


    $pwaUrl = "http://server/pwa"
    $PSsvcUrl = $pwaUrl + "/_vti_bin/PSI/Resource.asmx?wsdl" 
    $PSsvcUrlCal = $pwaUrl + "/_vti_bin/PSI/Calendar.asmx?wsdl" 
    $c = Get-Credential
    $svcPSProxy = New-WebServiceProxy -uri $PSsvcUrl -credential $c 
    $svcPSProxyCal = New-WebServiceProxy -uri $PSsvcUrlCal -credential $c 
    #$svcPSProxy.ReadUserList("ALL").Resources | Export-CSV Resources.txt -Delimiter "|"
    $users = Import-Csv -delimiter ';' 'Resources_cal.csv'
    $calendars = $svcPSProxyCal.ListCalendars().Calendars

    function Set-Calendar{
    param( $Resource )
        $ResourceID = $Resource.RES_UID
        $calendar = $Resource.Calendar

        $dsResource = $svcPSProxy.ReadResource($ResourceID)
        $svcPSProxy.CheckoutResources($ResourceID) > $null

        $dsResource.Resource.BaseCalendarUniqueId = $calendars[$calendar].CAL_UID

        $svcPSProxy.UpdateResources($dsResource, $false, $true) > $null

        $svcPSProxy.CheckInResources($resourceObj, $false) > $null


    foreach($usr in $users){
        if ($usr.res_type -eq 2){
            Set-Calendar $usr


    I'm stuck with the following error:

    Property 'BaseCalendarUniqueId' cannot be found on this object; make sure it exists and is settable.
    At C:\Datos\Project Server 2010\Set-Resource-Calendar.ps1:19 char:26
    +     $dsResource.Resource. <<<< BaseCalendarUniqueId = $calendars[$calendar].CAL_UID
        + CategoryInfo          : InvalidOperation: (BaseCalendarUniqueId:String) [], RuntimeException
        + FullyQualifiedErrorId : PropertyNotFound

    But I never try if the CheckIn works also, that is any clue will be welcome.

    Thank you in advance, for your help.


    Tuesday, February 25, 2014 9:56 PM

All replies

  • Hello, I continued researching and I found this page:

    Reading this PSI information page about "What the PSI does and does not do", I realize that maybe that I'm trying to modify is not possible because of the following paragraph about "What the PSI does not do", about Editing resource Calendar is not allowed, and I'm trying to change the base calendar for the resource, I suppose. If anyone can confirm or denied that, I will be grateful.



    • Requesting or performing resource leveling.

    • Changing the resource on an assignment. (You can use the PSI to delete the assignment and create a new one.)

    • Deleting or replacing a resource that has actual work accepted (actuals).

    • Changing a resource type between work, material, and cost.

    • Creating or editing resource calendars.

    • When adding a resource to a task, the PSI does not automatically redistribute work the way Project Professional does. It is up to the developer to choose and explicitly set the work distribution on the assignments.

    Wednesday, February 26, 2014 2:57 PM
  • Hi Maximiliano,

    Indeed based on this link (, I confirm that you can't update enterprise resources calendar through PSI or CSOM.

    Hope this helps.

    Guillaume Rouyre - MBA, MCP, MCTS

    Wednesday, February 26, 2014 3:07 PM