Creating projects using PSI

C

Claudio Hidetoshi

Hi all.

I'm changing the sample code "ProjTool" (it comes with PJ2007 SDK) to create
new projects. But the global template requires that I set value to a custom
field, named "Docs"(number field). So, I coded:

ProjectWebSvc.ProjectDataSet.ProjectRow projectRow =
dataset.Project.NewProjectRow();
projectRow.PROJ_UID = projGuid;
projectRow.PROJ_NAME = projectName;

if (txtCalendarUid.Text.ToString() != "" )
{
projectRow.CAL_UID = new Guid(txtCalendarUid.Text.ToString());
}
projectRow.PROJ_TYPE = getProjectType();
dataset.Project.AddProjectRow(projectRow);
//the above code is original from the sdk

//my custom code
ProjectWebSvc.ProjectDataSet.ProjectCustomFieldsRow custom =
dataset.ProjectCustomFields.NewProjectCustomFieldsRow();
custom.CUSTOM_FIELD_UID = Guid.NewGuid();
custom.NUM_VALUE = (decimal)1;
custom.MD_PROP_ID = 188744704;
custom.PROJ_UID = projGuid;
dataset.ProjectCustomFields.AddProjectCustomFieldsRow(custom);

When I call project.QueueCreateProject an error apears:
"<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<errinfo>\r\n <dataset
name=\"ProjectDataSet\">\r\n <table name=\"ProjectCustomFields\">\r\n
<row CUSTOM_FIELD_UID=\"161b089c-f4fd-435a-8dbe-eb2b1f456b93\">\r\n
<error id=\"11704\" name=\"CustomFieldInvalidTypeColumnFilledIn\"
uid=\"6fd994bf-9d7b-4861-a6d7-41cc29d2111b\" />\r\n <error
id=\"11713\" name=\"CustomFieldRequiredValueNotProvided\"
uid=\"99584033-8f42-4c19-af07-e241e65951f3\" mdpropuid=\"\" />\r\n
</row>\r\n </table>\r\n </dataset>\r\n</errinfo>"

I don't know what is wrong.

Any help will be very appreciated.

Claudio Hidetoshi.
Rio de Janeiro - Brazil
 
C

Claudio Hidetoshi

Hi Martin,

Thanks for your help,

I filled the MD_PROP_UID and the same error appears.
 
A

albupp

Did you ever fiand any resolution to this problem, because I'm getting the
same error message? I'm sure that the problem is due to an unset
MD_PROP_UID.

Regards, Albert
 
A

albupp

In my case, I figured out that the cause of this error was due to trying
assign a value to the TEXT_VALUE property for a custom field that had an
associated LookupTable. I resolved the problem by setting the
CustomFieldsRow.CODE_VALUE property to the Guid corresponding the LookupTable
value instead.
 
C

Claudio Hidetoshi

I was making a mistake. I didn't define the FIELD_TYPE_ENUM property.

Another thing, it's not necessary to assing a value for MD_PROP_UID and
MD_PROP_ID properties. Choose one of them.

Cláudio Hidetoshi.
Rio de Janeiro
 

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