Read Project Enterprise Field

P

Peter Schneider

Hi!

Perhaps someone can help me out...

I have a Project 2007 C# Addin and want to read Enterprise Custom Fields...
the code for reading
Task Enterprise Custom Fields as follows works great...

public static string GetEnterpriseField(Task t, string fieldname)
{
try
{
return t.GetField(
Globals.ThisAddIn.Application.FieldNameToFieldConstant(fieldname,
PjFieldType.pjTask));
}
catch
{
return String.Empty;
}
}

I want to read Enterprise Custom Fields of Entity Type Project (not Task or
Resource)... so it seems I have to change the field type, but unfortunatly
setting it to PjFieldType.pjProject doesn't work. And shouldn't there be a
way to read these type of fields without a task reference? Any clues?

greetings, Peter
 
R

Rod Gill

Hi,

Enterprise Project type fields can only be read using the Project Summary
Task. In VBA I would use:

activeproject.ProjectSummaryTask.GetField(Application.FieldNameToFieldConstant("My
Ent Field Name",pjProject))

I'll leave you to convert to C# !!
--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
P

Peter Schneider

Hi Rod!

I've managed to track down the error... it seems to be a problem with
Project itself.
I have forgotten to install SP1, afterwards it works perfectly.

Thanks again for your help...

greetings, Peter
 

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