I need to determine the type of a custom field not using PSI

S

SunGard

I cannot find a way in the local project object model to find the type of a
custom field. Using PSI, I can do this as follows:

Dim fieldType As
Microsoft.Office.Project.Server.Library.CustomField.Type = Nothing
Dim cf As Microsoft.Office.Interop.MSProject.PjCustomField = some custom
field
...
dim cfs As New CustomFieldsWebSvc.CustomFields()
dim cfds As New CustomFieldsWebSvc.CustomFieldDataSet()
...
cfs.ReadCustomFieldsByEntity(New Guid(projectEntity))
...
' Get field type
fieldType =
cfds.CustomFields.FindByMD_PROP_UID(cf.MD_PROP_UID).MD_PROP_TYPE_ENUM


How can I do this when not connected to the Project Server?

I also need to get whether the field is required or not (which works with
PSI below):

' Get field "requiredness"
isRequired =
cfds.CustomFields.FindByMD_PROP_UID(cf.MD_PROP_UID).MD_PROP_IS_REQUIRED


MS Project knows this information somehow because "Project Information"
displays the fields with asterisks, etc. in the custom field editor even when
not connected to Project Server. It must be in the "Active Cache" which I
can't seem to get to.

Please help - just this issue is forcing a redesign of the whole code base I
have been working on!
 
R

Rod Gill

Hi,

I know Project Pro knows the answer you want, but Project does not make this
information available in the Object model.
 
S

SunGard

Hi Rod,

Exactly and thank you for confirming what I am seeing!

I am finding that there is an abundance of information in the "Active Cache"
that is not exposed at all. In order to provide functionality for users that
are on the road and not connected to Project Server, I am going to have to
create my own definitions in an xml file for such things as:

- If a field is required or not
- The project server type of field (i.e. DATE, COST, NUMBER, etc.)
- Whether a numeric field is "0" or really NULL (Nothing). The getfield
method simply returns "0" and I can't tell if the user actually entered "0"
or the field was NULL. If I use the PSI, I can tell that information - but
then I am dependent upon the server.

There is too much covered up in the Object Model I think. I hope Microsoft
can expose much more soon.

In any case, we have to give up what was a great development and do a "copy
and paste" of information from Project Server custom fields into an xml file.

Please pass this message on to Microsoft - I really appreciate it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top