Read Custom fields return no value

C

ctd

Hi,
I tried to display a dropdown list of a custom field values, but kept having
zero record return. Checked the database and see my custom field in the
custom field table with its values in the lookup table. Not sure what I was
missing in the code. Below is my code in C#:

private CustomFieldWS.CustomFieldDataSet readCustomFieldDS =
new CustomFieldWS.CustomFieldDataSet();
private LookupTableWS.LookupTableDataSet lookupDS =
new LookupTableWS.LookupTableDataSet();

private void ReadCustomFields()
{
strCustField = "Classification";

DataView dataview = new DataView(readCustomFieldDS.CustomFields);
dataview.RowFilter =
readCustomFieldDS.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow
row in lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}
}

Thanks,
ctd
 
S

Stephen Sanderlin [MVP]

You're never actually calling the ReadCustomFields() method.

Out of curiosity, why are you using a DataView instead of the PSI's
native Filter class?

--
Stephen C. Sanderlin, Project MVP
VP of Technology
msProjectExperts
90 John Street, Ste. 404
New York, NY 10038

E:    (e-mail address removed)
NYC:  (646) 736-1688 x26
PA:   (215) 538-5373
Cell: (267) 446-4064
Fax:  (973) 556-1191

http://www.msprojectexperts.com

 
Are You Project 2010 Ready?
Work Management Solutions for Individuals, Teams, and the Enterprise
 
C

ctd

Thanks. I used DataView just because I don't know how to use PSI's Filter
class. If there is a code sample, I could use it.

Now I call the ReadCustomFields() method and got the following error:

System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=GeneralUnhandledException Instructions: Pass this into
PSClientError constructor to access all error information at
Microsoft.Office.Project.Server.WebService.CustomFields.ReadCustomFields(String xmlFilter, Boolean autoCheckOut)

Exception was thrown at this line:
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

I have google for answers but couldn't find any that can solve. Below is
my code again:

CustomFieldWS.CustomFields cf = new CustomFieldWS.CustomFields();
cf.Url = PROJECT_SERVER_URI + CUSTOMFIELD_SERVICE_PATH;
cf.Credentials = CredentialCache.DefaultCredentials;
PSLib.Filter cfFilter = new PSLib.Filter();

bool autoCheckOut = false;
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

DataView dataview = new DataView(cfDataSet.CustomFields);
dataview.RowFilter = cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow row in
lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}

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

Stephen Sanderlin said:
You're never actually calling the ReadCustomFields() method.

Out of curiosity, why are you using a DataView instead of the PSI's
native Filter class?

--
Stephen C. Sanderlin, Project MVP
VP of Technology
msProjectExperts
90 John Street, Ste. 404
New York, NY 10038

E: (e-mail address removed)
NYC: (646) 736-1688 x26
PA: (215) 538-5373
Cell: (267) 446-4064
Fax: (973) 556-1191

http://www.msprojectexperts.com


Are You Project 2010 Ready?
Work Management Solutions for Individuals, Teams, and the Enterprise



Hi,
I tried to display a dropdown list of a custom field values, but kept having
zero record return. Checked the database and see my custom field in the
custom field table with its values in the lookup table. Not sure what I was
missing in the code. Below is my code in C#:

private CustomFieldWS.CustomFieldDataSet readCustomFieldDS =
new CustomFieldWS.CustomFieldDataSet();
private LookupTableWS.LookupTableDataSet lookupDS =
new LookupTableWS.LookupTableDataSet();

private void ReadCustomFields()
{
strCustField = "Classification";

DataView dataview = new DataView(readCustomFieldDS.CustomFields);
dataview.RowFilter =
readCustomFieldDS.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow
row in lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}
}

Thanks,
ctd

.
 
C

ctd

I figured out the problem and got it to work already. Thank you again for
your help!


ctd said:
Thanks. I used DataView just because I don't know how to use PSI's Filter
class. If there is a code sample, I could use it.

Now I call the ReadCustomFields() method and got the following error:

System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=GeneralUnhandledException Instructions: Pass this into
PSClientError constructor to access all error information at
Microsoft.Office.Project.Server.WebService.CustomFields.ReadCustomFields(String xmlFilter, Boolean autoCheckOut)

Exception was thrown at this line:
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

I have google for answers but couldn't find any that can solve. Below is
my code again:

CustomFieldWS.CustomFields cf = new CustomFieldWS.CustomFields();
cf.Url = PROJECT_SERVER_URI + CUSTOMFIELD_SERVICE_PATH;
cf.Credentials = CredentialCache.DefaultCredentials;
PSLib.Filter cfFilter = new PSLib.Filter();

bool autoCheckOut = false;
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

DataView dataview = new DataView(cfDataSet.CustomFields);
dataview.RowFilter = cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow row in
lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}

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

Stephen Sanderlin said:
You're never actually calling the ReadCustomFields() method.

Out of curiosity, why are you using a DataView instead of the PSI's
native Filter class?

--
Stephen C. Sanderlin, Project MVP
VP of Technology
msProjectExperts
90 John Street, Ste. 404
New York, NY 10038

E: (e-mail address removed)
NYC: (646) 736-1688 x26
PA: (215) 538-5373
Cell: (267) 446-4064
Fax: (973) 556-1191

http://www.msprojectexperts.com


Are You Project 2010 Ready?
Work Management Solutions for Individuals, Teams, and the Enterprise



Hi,
I tried to display a dropdown list of a custom field values, but kept having
zero record return. Checked the database and see my custom field in the
custom field table with its values in the lookup table. Not sure what I was
missing in the code. Below is my code in C#:

private CustomFieldWS.CustomFieldDataSet readCustomFieldDS =
new CustomFieldWS.CustomFieldDataSet();
private LookupTableWS.LookupTableDataSet lookupDS =
new LookupTableWS.LookupTableDataSet();

private void ReadCustomFields()
{
strCustField = "Classification";

DataView dataview = new DataView(readCustomFieldDS.CustomFields);
dataview.RowFilter =
readCustomFieldDS.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow
row in lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}
}

Thanks,
ctd

.
 
S

Stephen Sanderlin [MVP]

No problem... it seems that the news server ate my reply to you, which
I've reposted.

What was the problem?

--
Stephen Sanderlin, Project MVP
VP of Technology
msProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read our blog at: http://www.projectserverhelp.com



I figured out the problem and got it to work already. Thank you again for
your help!


ctd said:
Thanks. I used DataView just because I don't know how to use PSI's Filter
class. If there is a code sample, I could use it.

Now I call the ReadCustomFields() method and got the following error:

System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=GeneralUnhandledException Instructions: Pass this into
PSClientError constructor to access all error information at
Microsoft.Office.Project.Server.WebService.CustomFields.ReadCustomFields(String xmlFilter, Boolean autoCheckOut)

Exception was thrown at this line:
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

I have google for answers but couldn't find any that can solve. Below is
my code again:

CustomFieldWS.CustomFields cf = new CustomFieldWS.CustomFields();
cf.Url = PROJECT_SERVER_URI + CUSTOMFIELD_SERVICE_PATH;
cf.Credentials = CredentialCache.DefaultCredentials;
PSLib.Filter cfFilter = new PSLib.Filter();

bool autoCheckOut = false;
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

DataView dataview = new DataView(cfDataSet.CustomFields);
dataview.RowFilter = cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow row in
lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}

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

Stephen Sanderlin said:
You're never actually calling the ReadCustomFields() method.

Out of curiosity, why are you using a DataView instead of the PSI's
native Filter class?

--
Stephen C. Sanderlin, Project MVP
VP of Technology
msProjectExperts
90 John Street, Ste. 404
New York, NY 10038

E: (e-mail address removed)
NYC: (646) 736-1688 x26
PA: (215) 538-5373
Cell: (267) 446-4064
Fax: (973) 556-1191

http://www.msprojectexperts.com


Are You Project 2010 Ready?
Work Management Solutions for Individuals, Teams, and the Enterprise




Hi,
I tried to display a dropdown list of a custom field values, but kept having
zero record return. Checked the database and see my custom field in the
custom field table with its values in the lookup table. Not sure what I was
missing in the code. Below is my code in C#:

private CustomFieldWS.CustomFieldDataSet readCustomFieldDS =
new CustomFieldWS.CustomFieldDataSet();
private LookupTableWS.LookupTableDataSet lookupDS =
new LookupTableWS.LookupTableDataSet();

private void ReadCustomFields()
{
strCustField = "Classification";

DataView dataview = new DataView(readCustomFieldDS.CustomFields);
dataview.RowFilter =
readCustomFieldDS.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow
row in lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}
}

Thanks,
ctd

.
 
S

Stephen Sanderlin [MVP]

I can't be sure because you're not unpacking the SoapException, but I
would imagine that the exception is due to you passing in an empty
filter object -- if you want to call ReadCustomFields() without sending
a PSI filter parameter, you send String.Empty, not an empty filter
instance. So, change:

cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

to

cfDataSet = cf.ReadCustomFields(String.Empty, autoCheckOut);

Regarding the use of filters, take a look at
http://msdn.microsoft.com/en-us/library/ms453399.aspx. I also have an
old blog post (available at
http://www.epmfaq.com/ssanderlin/pr...eve-the-guid-of-a-custom-field-using-its-name)
which uses a filter against the CustomFields web service that may help
you.

--
Stephen Sanderlin, Project MVP
VP of Technology
msProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read our blog at: http://www.projectserverhelp.com



Thanks. I used DataView just because I don't know how to use PSI's Filter
class. If there is a code sample, I could use it.

Now I call the ReadCustomFields() method and got the following error:

System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=GeneralUnhandledException Instructions: Pass this into
PSClientError constructor to access all error information at
Microsoft.Office.Project.Server.WebService.CustomFields.ReadCustomFields(String xmlFilter, Boolean autoCheckOut)

Exception was thrown at this line:
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

I have google for answers but couldn't find any that can solve. Below is
my code again:

CustomFieldWS.CustomFields cf = new CustomFieldWS.CustomFields();
cf.Url = PROJECT_SERVER_URI + CUSTOMFIELD_SERVICE_PATH;
cf.Credentials = CredentialCache.DefaultCredentials;
PSLib.Filter cfFilter = new PSLib.Filter();

bool autoCheckOut = false;
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

DataView dataview = new DataView(cfDataSet.CustomFields);
dataview.RowFilter = cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow row in
lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}

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

Stephen Sanderlin said:
You're never actually calling the ReadCustomFields() method.

Out of curiosity, why are you using a DataView instead of the PSI's
native Filter class?

--
Stephen C. Sanderlin, Project MVP
VP of Technology
msProjectExperts
90 John Street, Ste. 404
New York, NY 10038

E: (e-mail address removed)
NYC: (646) 736-1688 x26
PA: (215) 538-5373
Cell: (267) 446-4064
Fax: (973) 556-1191

http://www.msprojectexperts.com


Are You Project 2010 Ready?
Work Management Solutions for Individuals, Teams, and the Enterprise



Hi,
I tried to display a dropdown list of a custom field values, but kept having
zero record return. Checked the database and see my custom field in the
custom field table with its values in the lookup table. Not sure what I was
missing in the code. Below is my code in C#:

private CustomFieldWS.CustomFieldDataSet readCustomFieldDS =
new CustomFieldWS.CustomFieldDataSet();
private LookupTableWS.LookupTableDataSet lookupDS =
new LookupTableWS.LookupTableDataSet();

private void ReadCustomFields()
{
strCustField = "Classification";

DataView dataview = new DataView(readCustomFieldDS.CustomFields);
dataview.RowFilter =
readCustomFieldDS.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow
row in lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}
}

Thanks,
ctd

.
 
C

ctd

Hi Stephen,
Thanks for your reply. I got it now. I also used
ReadCustomFieldsByEntity() and it worked too. Thanks for the link to your
old post. Very useful stuffs. I can apply some of the codes. Thanks.

Stephen Sanderlin said:
I can't be sure because you're not unpacking the SoapException, but I
would imagine that the exception is due to you passing in an empty
filter object -- if you want to call ReadCustomFields() without sending
a PSI filter parameter, you send String.Empty, not an empty filter
instance. So, change:

cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

to

cfDataSet = cf.ReadCustomFields(String.Empty, autoCheckOut);

Regarding the use of filters, take a look at
http://msdn.microsoft.com/en-us/library/ms453399.aspx. I also have an
old blog post (available at
http://www.epmfaq.com/ssanderlin/pr...eve-the-guid-of-a-custom-field-using-its-name)
which uses a filter against the CustomFields web service that may help
you.

--
Stephen Sanderlin, Project MVP
VP of Technology
msProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read our blog at: http://www.projectserverhelp.com



Thanks. I used DataView just because I don't know how to use PSI's Filter
class. If there is a code sample, I could use it.

Now I call the ReadCustomFields() method and got the following error:

System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=GeneralUnhandledException Instructions: Pass this into
PSClientError constructor to access all error information at
Microsoft.Office.Project.Server.WebService.CustomFields.ReadCustomFields(String xmlFilter, Boolean autoCheckOut)

Exception was thrown at this line:
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

I have google for answers but couldn't find any that can solve. Below is
my code again:

CustomFieldWS.CustomFields cf = new CustomFieldWS.CustomFields();
cf.Url = PROJECT_SERVER_URI + CUSTOMFIELD_SERVICE_PATH;
cf.Credentials = CredentialCache.DefaultCredentials;
PSLib.Filter cfFilter = new PSLib.Filter();

bool autoCheckOut = false;
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

DataView dataview = new DataView(cfDataSet.CustomFields);
dataview.RowFilter = cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow row in
lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}

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

Stephen Sanderlin said:
You're never actually calling the ReadCustomFields() method.

Out of curiosity, why are you using a DataView instead of the PSI's
native Filter class?

--
Stephen C. Sanderlin, Project MVP
VP of Technology
msProjectExperts
90 John Street, Ste. 404
New York, NY 10038

E: (e-mail address removed)
NYC: (646) 736-1688 x26
PA: (215) 538-5373
Cell: (267) 446-4064
Fax: (973) 556-1191

http://www.msprojectexperts.com


Are You Project 2010 Ready?
Work Management Solutions for Individuals, Teams, and the Enterprise




Hi,
I tried to display a dropdown list of a custom field values, but kept having
zero record return. Checked the database and see my custom field in the
custom field table with its values in the lookup table. Not sure what I was
missing in the code. Below is my code in C#:

private CustomFieldWS.CustomFieldDataSet readCustomFieldDS =
new CustomFieldWS.CustomFieldDataSet();
private LookupTableWS.LookupTableDataSet lookupDS =
new LookupTableWS.LookupTableDataSet();

private void ReadCustomFields()
{
strCustField = "Classification";

DataView dataview = new DataView(readCustomFieldDS.CustomFields);
dataview.RowFilter =
readCustomFieldDS.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow
row in lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}
}

Thanks,
ctd

.

.
 
S

Stephen Sanderlin [MVP]

No problem -- happy to help!

--
Stephen Sanderlin, Project MVP
VP of Technology
msProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read our blog at: http://www.projectserverhelp.com



Hi Stephen,
Thanks for your reply. I got it now. I also used
ReadCustomFieldsByEntity() and it worked too. Thanks for the link to your
old post. Very useful stuffs. I can apply some of the codes. Thanks.

Stephen Sanderlin said:
I can't be sure because you're not unpacking the SoapException, but I
would imagine that the exception is due to you passing in an empty
filter object -- if you want to call ReadCustomFields() without sending
a PSI filter parameter, you send String.Empty, not an empty filter
instance. So, change:

cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

to

cfDataSet = cf.ReadCustomFields(String.Empty, autoCheckOut);

Regarding the use of filters, take a look at
http://msdn.microsoft.com/en-us/library/ms453399.aspx. I also have an
old blog post (available at
http://www.epmfaq.com/ssanderlin/pr...eve-the-guid-of-a-custom-field-using-its-name)
which uses a filter against the CustomFields web service that may help
you.

--
Stephen Sanderlin, Project MVP
VP of Technology
msProjectExperts

For Project Server Consulting: http://www.msprojectexperts.com
For Project Server Training: http://www.projectservertraining.com

Read our blog at: http://www.projectserverhelp.com



Thanks. I used DataView just because I don't know how to use PSI's Filter
class. If there is a code sample, I could use it.

Now I call the ReadCustomFields() method and got the following error:

System.Web.Services.Protocols.SoapException: ProjectServerError(s)
LastError=GeneralUnhandledException Instructions: Pass this into
PSClientError constructor to access all error information at
Microsoft.Office.Project.Server.WebService.CustomFields.ReadCustomFields(String xmlFilter, Boolean autoCheckOut)

Exception was thrown at this line:
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

I have google for answers but couldn't find any that can solve. Below is
my code again:

CustomFieldWS.CustomFields cf = new CustomFieldWS.CustomFields();
cf.Url = PROJECT_SERVER_URI + CUSTOMFIELD_SERVICE_PATH;
cf.Credentials = CredentialCache.DefaultCredentials;
PSLib.Filter cfFilter = new PSLib.Filter();

bool autoCheckOut = false;
cfDataSet = cf.ReadCustomFields(cfFilter.GetXml(), autoCheckOut);

DataView dataview = new DataView(cfDataSet.CustomFields);
dataview.RowFilter = cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow row in
lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}

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

:

You're never actually calling the ReadCustomFields() method.

Out of curiosity, why are you using a DataView instead of the PSI's
native Filter class?

--
Stephen C. Sanderlin, Project MVP
VP of Technology
msProjectExperts
90 John Street, Ste. 404
New York, NY 10038

E: (e-mail address removed)
NYC: (646) 736-1688 x26
PA: (215) 538-5373
Cell: (267) 446-4064
Fax: (973) 556-1191

http://www.msprojectexperts.com


Are You Project 2010 Ready?
Work Management Solutions for Individuals, Teams, and the Enterprise




Hi,
I tried to display a dropdown list of a custom field values, but kept having
zero record return. Checked the database and see my custom field in the
custom field table with its values in the lookup table. Not sure what I was
missing in the code. Below is my code in C#:

private CustomFieldWS.CustomFieldDataSet readCustomFieldDS =
new CustomFieldWS.CustomFieldDataSet();
private LookupTableWS.LookupTableDataSet lookupDS =
new LookupTableWS.LookupTableDataSet();

private void ReadCustomFields()
{
strCustField = "Classification";

DataView dataview = new DataView(readCustomFieldDS.CustomFields);
dataview.RowFilter =
readCustomFieldDS.CustomFields.MD_PROP_NAMEColumn.ColumnName +
" = '" + strCustField + "'";
if (dataview.Count == 0) return;

CustomFieldWS.CustomFieldDataSet.CustomFieldsRow rowCF =

(CustomFieldWS.CustomFieldDataSet.CustomFieldsRow)dataview[0].Row;

foreach (LookupTableWS.LookupTableDataSet.LookupTableTreesRow
row in lookupDS.LookupTableTrees.Rows)
{
if (rowCF.MD_LOOKUP_TABLE_UID == row.LT_UID)
{
ddlTitleClass.Items.Add(row.LT_VALUE_TEXT);
}
}
}

Thanks,
ctd

.

.
 

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