PS2013 CSOM How to lookup project by custom field value RRS feed

  • Question

  • I am importing projects from another system into Project Server 2013 and I need to be able to see if the project already exists before I add it. There is a unique project id from the other system that I am putting in a custom field on the project. I want to look up the project by that custom field in one request. When I try to do this I get a "not supported" error on the request.  The alternative to this is to do a ctx.Load(p.IncludeCustomFields) on every project in a loop.  This takes about 0.5 seconds per project and I expect to have about 500 or more active projects in the system.  This means that it will be around 4 minutes to be able to do lookups by this custom field. 

    Is there a more efficient way?  Why can't I get a list of projects with their custom fields in one request?

    Bruce Lofland

    Wednesday, September 30, 2015 3:44 PM


  • This has always been a problem with the PSI (predecessor to CSOM) as well. It seems like the best work around for this, if you want it to be fast, is to query for the data in the reporting tables. The other way, would be to grab the data using the Odata api, which lets you get the project name and any custom field in one call.

    Another, more rudimentary method, that I have used in the past is to put the unique id from the other system in the project name somewhere, e.g. 

    Project A - (34253523)

    where 34253523 is the ID from your other system.

    That way you can just use CSOM to get all of the project names, parse the names and build your own internal collection/array to do your lookups.

    Tuesday, October 20, 2015 12:53 AM