-->

Retrieving Enterprise Project Types using Project

2019-08-27 03:07发布

问题:

I am currently building an app to programatically create projects in Microsoft Project Server using the web services exposed through the Project Server Interface (PSI).

I am able to create a project with an Enterprise Project Type using the QueueCreateProject method, however, I need to specify the GUID of the EPT which I don't want to hard code into the code.

Is there another web service or way to get the GUID of a specific EPT found by its name?

Also, can the same be done for custom fields in the same way?

回答1:

I think what you're looking for is PSI Filter parameters. Check out this post for an example of retrieving the Guid of a custom field.

Really, I think the key is setting the filter criteria:

cfFilter.Criteria = new PSLibrary.Filter.FieldOperator(equal, nameColumn, customFieldName);

Where nameColumn is cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName and customFieldName is a value you pass in.

If you are like me, you want to do this for a lot of fields. I used a filter to query all the field names and MD_PROP_UID's and then just put it in a hashtable so I don't have to keep making PSI calls.

Disclaimer: I use 2007 but I'm assuming it is mostly the same for custom fields (not for the EPT part which I didn't include).



回答2:

Here is an answer: https://stackoverflow.com/a/12267251/1594383

In short: the methods are available from Workflow service.