Friday, April 13, 2012 9:19 AM
I have some enterprise resources created and a custom field called resourceId for each one. I'm trying to get the RES_UID value but the dataset always get null value. Here I paste the code, can anyone tell me what was wrong?
// Function that returns the Uid for a enterprise custom field Guid? customFieldUId = GetCustomFieldUIdByName("resourceId", EntityTypes.Recursos); ResourceWebSvc.ResourceDataSet resourceDs = new ResourceWebSvc.ResourceDataSet(); string tableName = resourceDs.ResourceCustomFields.TableName; string cfUidColumn = resourceDs.ResourceCustomFields.MD_PROP_UIDColumn.ColumnName; string valueColumn = resourceDs.ResourceCustomFields.NUM_VALUEColumn.ColumnName; string resUidColumn = resourceDs.ResourceCustomFields.RES_UIDColumn.ColumnName; PSLibrary.Filter.FieldOperationType equal = PSLibrary.Filter.FieldOperationType.Equal; PSLibrary.Filter.LogicalOperationType and = PSLibrary.Filter.LogicalOperationType.And; PSLibrary.Filter resourceFilter = new PSLibrary.Filter(); resourceFilter.FilterTableName = tableName; resourceFilter.Fields.Add(new PSLibrary.Filter.Field(resUidColumn)); PSLibrary.Filter.FieldOperator byCustomFieldUid = new PSLibrary.Filter.FieldOperator(equal, cfUidColumn, customFieldUId); PSLibrary.Filter.FieldOperator byIdRecurso = new PSLibrary.Filter.FieldOperator(equal, valueColumn, idRecurso); resourceFilter.Criteria = new PSLibrary.Filter.LogicalOperator(and, byCustomFieldUid, byIdRecurso); resourceDs = resourceSVC.ReadResources(resourceFilter.GetXml(), false); // After this, resourceDs is always null
Thank you in advanced!
Sunday, April 15, 2012 3:25 AMModeratorCan't help you with this code, but one way is to read from the Reporting db. The Resource_Userview View has all Resource custom fields appended automatically, so search for the value you want and read teh UID.
Rod GillThe one and only Project VBA Book Rod Gill Project Management
- Marked As Answer by LyE- Monday, April 16, 2012 9:04 AM
Monday, April 16, 2012 9:07 AM
Thank you for your answer... that had been my solution. At leats it was working...