|
|
|
date: Sun, 24 Aug 2008 23:40:44 +0200,
group: microsoft.public.project.developer
back
Re: Read Project Enterprise Field
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
"Peter Schneider" wrote:
> Hi Rod!
>
> Thanks for your answer! I've converted to function to C#.
>
> public static string GetEnterpriseProjectField(string fieldname)
> {
> try
> {
>
> return
> Globals.ThisAddIn.Application.ActiveProject.ProjectSummaryTask.GetField(
> Globals.ThisAddIn.Application.FieldNameToFieldConstant(fieldname,
> PjFieldType.pjProject));
> }
> catch (System.Exception ex)
> {
> return ex.Message.ToString ();
> }
> }
>
> Yet.. if I use it, I always get a "The argument value is not valid"
> Exception, although the fieldname is correct and shows up in Project 2007
> Client.
> Anything more to take care of?
>
> greetings, Peter
>
>
> "Rod Gill" <rodATproject-systemsDOTcoDOTnz> schrieb im Newsbeitrag
> news:uUK7H9jBJHA.1012@TK2MSFTNGP06.phx.gbl...
> > 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
> >
> >
> >
> > "Peter Schneider" wrote in message
> > news:5EFE9B26-AB6D-446C-9275-947F4D35087D@microsoft.com...
> >> 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
> >>
> >
>
date: Mon, 25 Aug 2008 01:08:13 -0700
author: Peter Schneider Peter
Re: Read Project Enterprise Field
That was a big SP that one but then it had a lot to fix!!
--
Rod Gill
Microsoft MVP for Project
Author of the only book on Project VBA, see:
http://www.projectvbabook.com
"Peter Schneider" <Peter Schneider@discussions.microsoft.com> wrote in
message news:1C791A9D-4D86-46A7-8E96-443A01438241@microsoft.com...
> 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
>
> "Peter Schneider" wrote:
>
>> Hi Rod!
>>
>> Thanks for your answer! I've converted to function to C#.
>>
>> public static string GetEnterpriseProjectField(string fieldname)
>> {
>> try
>> {
>>
>> return
>> Globals.ThisAddIn.Application.ActiveProject.ProjectSummaryTask.GetField(
>>
>> Globals.ThisAddIn.Application.FieldNameToFieldConstant(fieldname,
>> PjFieldType.pjProject));
>> }
>> catch (System.Exception ex)
>> {
>> return ex.Message.ToString ();
>> }
>> }
>>
>> Yet.. if I use it, I always get a "The argument value is not valid"
>> Exception, although the fieldname is correct and shows up in Project 2007
>> Client.
>> Anything more to take care of?
>>
>> greetings, Peter
>>
>>
>> "Rod Gill" <rodATproject-systemsDOTcoDOTnz> schrieb im Newsbeitrag
>> news:uUK7H9jBJHA.1012@TK2MSFTNGP06.phx.gbl...
>> > 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
>> >
>> >
>> >
>> > "Peter Schneider" wrote in message
>> > news:5EFE9B26-AB6D-446C-9275-947F4D35087D@microsoft.com...
>> >> 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
>> >>
>> >
>>
date: Mon, 25 Aug 2008 23:27:20 +1200
author: Rod Gill rodATproject-systemsDOTcoDOTnz
|
|