Skip to main content

Project Server 2010 - PSI - Calendar Exceptions (AddCalendarExceptionsRow, RemoveCalendarExceptionsRow)

In the recent week we were creating an integration with vacation information from an external system into Project Server (2010).
We wanted to replicate all the calendar exceptions from the external system into Project Server.

This task looked quite simple until we got started using the PSI interface. We encountered a couple of problems and strange documentation. In our scenario we could not update the Project Server to the latest service pack so i do not know if these errors already are fixed.

In the following I will demonstrate how to delete all calendar exceptions on a resource and add only one new exception. This program was only created to outline how the PSI interface worked with calendar exceptions (creating one random exception does not make a lot of sense).

//The resource uid on the resource we want to change.
Guid resUID = new Guid("10b4d15c-4b62-417b-9b4d-924000c14cac");

WS_Resources.Resource wsresource = new WS_Resources.Resource();
wsresource.Url = "http://MyPWA/PWA/" + "/_vti_bin/psi/resource.asmx";
wsresource.Credentials = new System.Net.NetworkCredential("Administrator", "pass@word1", "CONTOSO");
WS_Resources.ResourceDataSet resDS = wsresource.ReadResources(""/*no filter*/, false);

WS_Resources.ResourceDataSet.CalendarExceptionsRow[] calExceptions = null;

//Not needed, only part of test
foreach (WS_Resources.ResourceDataSet.ResourcesRow rrow in resDS.Resources)
    if (rrow.RES_UID == resUID)
        //Find exceptions so we can call RemoveCalendarExceptionsRow on each row
        calExceptions = rrow.GetCalendarExceptionsRows();
foreach (WS_Resources.ResourceDataSet.CalendarExceptionsRow row in calExceptions)
    if (row.RES_UID == resUID)
        //You would think this will do the trick, however this actually caused
        // an Unhandled Comunication Error when we called UpdateResources().

foreach (WS_Resources.ResourceDataSet.CalendarExceptionsRow calexrow in resDS.CalendarExceptions)
    if (calexrow.RES_UID == resUID)
        //This is what works

WS_Resources.ResourceDataSet.CalendarExceptionsRow newCE = resDS.CalendarExceptions.NewCalendarExceptionsRow();
newCE.RES_UID = resUID;
newCE.Start = new DateTime(2013, 08, 12);
newCE.Finish = new DateTime(2013, 08, 16);
newCE.Name = "Vacation";
newCE.RecurrenceFrequency = 1;
newCE.RecurrenceType = (int)PSLibrary.CalendarConstants.CalendarRecurrenceType.Daily;
    wsresource.CheckOutResources(new Guid[] { resUID });
    wsresource.UpdateResources(resDS, false, false);
    wsresource.CheckInResources(new Guid[] { resUID }, false);
catch (Exception Ex) { wsresource.CheckInResources(new Guid[] { resUID }, true); throw Ex; }
finally {  }


Popular posts from this blog

Sharepoint 2013 - Fullscreen mode/hide quick launch

If you want to hide the quick launch on a SharePoint page or web part page in 2013 you could of cause use CSS scripts as in 2010.
But as a new thing in 2013 the user have the possibility to click on full screen mode. so why not load your page in this mode and then the user can choose to exit the mode if he prefers.

Add a content editor webpart to your page and click on Edit HTML from the ribbon.
Add the following code:

<script type="text/javascript">
window.onload = function()

Install DLL in GAC - Windows 2008/2012 (Using Powershell, No GacUtil.exe)

If you want to install a DLL in the GAC and do not have the GACUtil.exe available. Powershell is properly the easiest way to procede.

Before Powershell you would properly just drag the DLL file into the C:\Windows\Assembly but this option is usually not available anymore.

Powershell - Add DLL to GAC So to install a DLL file in the GAC simply execute the below Powershell script. Remember you migth want to run the Powershell prompt as an administrator.
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")$publish=New-ObjectSystem.EnterpriseServices.Internal.Publish$publish.GacInstall("c:\temp\MyDllFile.dll")iisreset
The first line adds a reference to the assembly we need to be able to mange the GAC.
The second and third lines retrives the GAC object and publish a new DLL file to it.
The last line resets the Internet Information Services. This is only needed if your DLL file is used in a websi…

SharePoint/Project Server - Firewall port open list

Firewall port open list Every time I have to install a new instance of Project Server I forget which ports have to be open.
The ports are divided into 3 lists, one list for the web front end servers, one list for the application server and one list for the SQL server.
These ports are based on a 2013 installation of SharePoint/Project Server. the 2010 installation defer a little bit.

Web Frontend ServerWhen a range is specified all ports between the range must be opened.
-80 TCPInhttp
-443 TCPInhttps/ssl
-25 TCPInSMTP for e-mail integration
-16500-16519TCPInPorts used by the search index component
-22233-22236TCPIn/OutPorts required for the AppFabric Caching Service
-32843-32845TCPInCommunication between Web servers and service applications
-32846TCPIn/OutSharePoint User Code Service
-808-809TCPInOffice Web Apps