A while ago I wrote a tutorial on how to use the old style Project Server Interfaces (PSI) with Project Online. In the meantime the Project Online team deprecated a few PSI interfaces, but some others are still available.
The attached sample code reflects those changes and provides a Project Online client context enhanced with the available PSIs in Project Server 2016. Note that some of these will probably be deprecated in the future, so if you’re getting weird communication fault errors it’s likely the case. The sample itself calls into the PWA PSI and enumerates the list of projects.
Download the Project Online PSI Sample (updated) sample and please leave a comment.
What do you think?
Great post, Ionut! I cannot run the sample code since I am missing references for the Iproject service contract. Any thoughts on where to obtain the dll? I am using Project Online. Thanks!
You need to reference the DLLs from the SharePoint 2016 on-premises. The IProject was removed, but most of its functionality is in the IPWA interface, the methods are prefixed with “Project”. For example, IProject.ReadProjectList became IPWA.ProjectReadProjectList.
Currently we are having Project Server 2010 code which we are planning to remediate for Project Online. I tried solution provided by you but Microsoft.Project.Server.Communication is missing and found in mentioned SharePoint 2016 on-premises. Colud you please help me to resolve this error.
Hi, I am trying to run this sample code to learn a bit more about accessing PSI components but the solution is missing dlls. Microsoft.Project.Server.Schema, Communication and Library are not found. Also there is a reference to a UMT360 solutions library that is missing. Would it be possible to get directions on where to find these dll’s I had an old installation of Project Server 2010 and I did find the project server ones there but wasn’t sure I could use them. I get errors on ICSOM and IPSAutomation missing directive errors. Any help would be great.
If you’re trying to connect to Project Online, then you need to have at least the SharePoint 2016 version of those DLLs. They’re not distributable but as you already figured out they’re part of a SharePoint installation. Then, another thing you need to be aware of is the approach will not work if the Project Online tenant has Modern Authentication enabled.
That being said, when connecting to Project Online we strongly suggest to use the newer CSOM libraries. The article describes an unuspported hack which was useful back in the days when the CSOM was not yet fully supporting most of the features of the PSI.
Thanks. I’ve been using CSOM but I’m trying to move views and other settings which isn’t part of CSOM yet. Hopefully they will add in all those pieces soon.
thanks for the samples, they are very helpful! This way we can use functionalities which are not (yet) supported by CSOM.
Have you ever tried to contact the PSI of a Project Online environment using impersonation? I’m trying to create and update timesheets for all resources. In Project Server, you had to use impersonation to achieve this, otherwise you would get a “GeneralSecurityAccessDenied”.
This is the same case in Project Online when contacting the Timesheet PSI. So I’ve added impersonation by these lines of code:
PSLibrary.PSContextInfo contextInfo = new PSLibrary.PSContextInfo(isWindowsUser, userNTAccount, userGuid, trackingGuid, siteId, languageCulture, localeCulture);
String contextInfoString = PSLibrary.PSContextInfo.SerializeToString(contextInfo);
httpRequestMessage.Headers[“PjAuth”] = impersonationContext;
Now sometimes this works… but most of the times it does not. When it’s not working, I get this error: Impersonation attempt failed. The calling identity is not a trusted account.
Sometimes I get this error when creating a timesheet, sometimes the creation works but the read timesheet fails with this error, sometimes reading works but the update fails,… It’s a bit random.
Do you have any clue?
As far as I know, in order for the impersonation request to succeed the call must be authenticated with an user having the permission to impersonate. That is usually is either an instance administrator or a service account. Can you share more details on how are you trying to authenticate with PSI Online in this scenario?