Need to update custom field values via .NEt app

M

Maruf

Hi.
I have all the projects stored on project server (and not
in files).
I want to add/delete values of Custom Fields (NOT
Enterprie Custom Fields)from a particular project.

Can someone send me a code sample or something?

I have the following code which works for an mpp file but
is of no use to me. I can call the CustomValuesAdd method
for doing the job. But i dont know how to connect to
projectserver and get the project reference.

******************
Dim projApp As MSProject.Application
Dim Proj As MSProject.Project
Dim T As MSProject.Task

Set projApp = New MSProject.Application

projApp.FileOpen "C:\test.mpp" //Need help here

Set Proj = projApp.ActiveProject

For Each T In Proj.Tasks
If Not T Is Nothing Then
Debug.Print T.ID, T.Name
End If
Next

projApp.FileClose pjDoNotSave
projApp.Quit
Set projApp = Nothing

******************

Any help would be appreciated.

Thanks,
Maruf
 
R

Rod Gill

Hi,

Search for the projdb.htm (pjdb.htm for P2003) file on your Project CD or
Project's program folders. It describes how to do what you want.

Note: Nothing gets recalculated until the project is next opened in Project.


--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.projectlearning.com/
 
M

Maruf

Rod,
Thanks for the reply. Pjdb.htm exposes direct SQL Updates
which i am currently using. I am following all the rules
like setting flags (EXT_EDITED) after removing/adding a
value in the Custom Field. When the project is opened, it
removes the Custom Field Data from all the previous tasks.

To avoid this problem, i want to use the
CustomFieldsValueAdd (and delete) methods. But i am unable
to get a reference to the project stored on Project
server.

If i can find a way to logon to projectserver and get a
reference to a project and assign it to
projApp.ActiveProject, Life will be easier.

Thanks,
Maruf.
(e-mail address removed). Do u mind if i add u in my MSN
contact list?
 
R

rnoda

Try using PDS. Check int the Project Server SDK the file "pj11sdk2003.chm"
for the PDS reference. Also check a sample application that comes with the
SDK called PDSTest.NET. This little sample app shows how to connect to
project server and call PDS methods.

The method you need specifically for updating custom fields is
EnterpriseCustomFieldsUpdate. See the PDS reference for a complete
description. Here is the PDS call syntax:
<Request>
<EnterpriseCustomFieldsUpdate>
<CustomFields>
<CustomField>
<FieldID></FieldID>
<FieldName></FieldName>
<SelectionRequired></SelectionRequired>
<Default></Default>
<ValuelistInUse></ValuelistInUse>
<ValuelistSortOrder></ValuelistSortOrder>
<ValueList>
<ValueItem>
<Phonetic></Phonetic>
<Value></Value>
<Description></Description>
</ValueItem>
<ValueItem>
<Phonetic></Phonetic>
<Value></Value>
<Description></Description>
</ValueItem>
</ValueList>
</CustomField>
</ CustomFields>
</ EnterpriseCustomFieldsUpdate >
</Request>I hope this helps.

Roberto.
 

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