Can't add a TaskCustomField - Gives me ITaskTable already contains this task

J

Joe Mitchel

Hi,

I'm trying to update task field 'Text5' and it's failing. I create
the new TaskCustomFieldRow and fill out the data but upon the call to
QueueAddToProject I get the below exception.

Here is my code to generate the Task data...

WebSvcProject.ProjectDataSet.TaskCustomFieldsRow CFRow =
CPData.TaskCustomFields.NewTaskCustomFieldsRow();
CFRow.PROJ_UID = ProjectUID;
CFRow.TASK_UID = TaskUID;
CFRow.CUSTOM_FIELD_UID = Guid.NewGuid();
CFRow.MD_PROP_UID =
PSLibrary.CustomField.LOCAL_CUSTOM_FIELD_MD_PROP_UID_TASK_TEXT5;
CFRow.MD_PROP_ID = PSLibrary.TaskProperties.Text5.WinProjId;
CFRow.FIELD_TYPE_ENUM = (byte)PSLibrary.CustomField.Type.TEXT;
CFRow.TEXT_VALUE = Value;
CPData.TaskCustomFields.AddTaskCustomFieldsRow(CFRow);


WebSvcProject.ProjectDataSet AddChanges =
(WebSvcProject.ProjectDataSet)CPData.GetChanges(System.Data.DataRowState.Added);
if (AddChanges != null)
{
JobID = Guid.NewGuid();
ProjectService.QueueAddToProject(JobID, SessionGuid,
AddChanges, false);
WaitForQueue(ProjectQueue, JobID);
}


Value in this case is a valid string. Anyone know why this is
happening. I can't for the life of me figure it out.


----------[ Exception ]------------------------------

System.ApplicationException: An Error Occurred while attempting to
update the queue: System.ApplicationException: <?xml version="1.0"
encoding="utf-16"?>
<errinfo>
<general>
<class name="GeneralQueueException">
<error id="9131" name="GeneralQueueException"
uid="df9fbb26-37e4-407f-a207-2597f1fd4e8e" messageID="2"
exception="Microsoft.Office.Project.Scheduling.SchedulingException:
The ITaskTable already contains this task.
at
Microsoft.Office.Project.Scheduling.TaskTable.Insert(ITask
task)
at
Microsoft.Office.Project.Server.BusinessLayer.SchedulingData.CreateNewRows()

at
Microsoft.Office.Project.Server.BusinessLayer.SchedulingData.LoadData(Boolean
isDelete)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectMain.LoadSchedulingData(Boolean
isDelete, Int32 revisionCounter)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectMain.HandleProject(ProjectDataSet
dataset, Guid projectUid, Guid userUid, String userName, Boolean
isNew, Boolean addColumns, ProjectLocks projectLock, Boolean
fCheckReadOnly, Boolean fCheckProtectedActuals, Boolean
fAllowAddEntRes)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectMain.HandleProject(ProjectDataSet
dataset, Guid projectUid, Guid userUid, String userName, Boolean
isNew, Boolean addColumns, ProjectLocks projectLock)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectQueueDispatch.HandleProject(MessageContext
mContext, ProjectMain project, ServerEventManager sem, ProjectDataSet
dataset, Guid projectUid, Guid userUid, String userName, Boolean
isNew, Boolean addColumns, ProjectLocks projectLock)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectQueueDispatch.InternalDispatchMessage(PlatformContext
context, Message msg, Group messageGroup, JobTicket jobTicket,
MessageContext mContext)" />
</class>
<class name="Queue">
<error id="26000" name="GeneralQueueJobFailed"
uid="42864af9-2014-42f4-aab4-3cf973d590ea"
JobUID="bc3ba401-b461-4df1-810e-378213d91e9a"
ComputerName="DEVPROJECT" GroupType="ProjectUpdate" MessageType=""
MessageId="" Stage="" />
</class>
</general>
</errinfo>

at UPTSync.MainForm.WaitForQueue(QueueSystem ProjectQueue, Guid
JobID) in D:\UnrealProjectTracker\Src\UPTSync\MainForm.cs:line 678

at UPTSync.MainForm.UpdateProject(Guid ProjectUID, UPTDataContext
UPTData) in D:\UnrealProjectTracker\Src\UPTSync\MainForm.cs:line 583

at UPTSync.MainForm.UpdateProject(Guid ProjectUID, UPTDataContext
UPTData) in D:\UnrealProjectTracker\Src\UPTSync\MainForm.cs:line 620
 
R

Rod Gill

I don't think PSI can work with local custom fields. Hopefully someone else
can confirm or deny!

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com



Joe Mitchel said:
Hi,

I'm trying to update task field 'Text5' and it's failing. I create
the new TaskCustomFieldRow and fill out the data but upon the call to
QueueAddToProject I get the below exception.

Here is my code to generate the Task data...

WebSvcProject.ProjectDataSet.TaskCustomFieldsRow CFRow =
CPData.TaskCustomFields.NewTaskCustomFieldsRow();
CFRow.PROJ_UID = ProjectUID;
CFRow.TASK_UID = TaskUID;
CFRow.CUSTOM_FIELD_UID = Guid.NewGuid();
CFRow.MD_PROP_UID =
PSLibrary.CustomField.LOCAL_CUSTOM_FIELD_MD_PROP_UID_TASK_TEXT5;
CFRow.MD_PROP_ID = PSLibrary.TaskProperties.Text5.WinProjId;
CFRow.FIELD_TYPE_ENUM = (byte)PSLibrary.CustomField.Type.TEXT;
CFRow.TEXT_VALUE = Value;
CPData.TaskCustomFields.AddTaskCustomFieldsRow(CFRow);


WebSvcProject.ProjectDataSet AddChanges =
(WebSvcProject.ProjectDataSet)CPData.GetChanges(System.Data.DataRowState.Added);
if (AddChanges != null)
{
JobID = Guid.NewGuid();
ProjectService.QueueAddToProject(JobID, SessionGuid,
AddChanges, false);
WaitForQueue(ProjectQueue, JobID);
}


Value in this case is a valid string. Anyone know why this is
happening. I can't for the life of me figure it out.


----------[ Exception ]------------------------------

System.ApplicationException: An Error Occurred while attempting to
update the queue: System.ApplicationException: <?xml version="1.0"
encoding="utf-16"?>
<errinfo>
<general>
<class name="GeneralQueueException">
<error id="9131" name="GeneralQueueException"
uid="df9fbb26-37e4-407f-a207-2597f1fd4e8e" messageID="2"
exception="Microsoft.Office.Project.Scheduling.SchedulingException:
The ITaskTable already contains this task.
at
Microsoft.Office.Project.Scheduling.TaskTable.Insert(ITask
task)
at
Microsoft.Office.Project.Server.BusinessLayer.SchedulingData.CreateNewRows()

at
Microsoft.Office.Project.Server.BusinessLayer.SchedulingData.LoadData(Boolean
isDelete)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectMain.LoadSchedulingData(Boolean
isDelete, Int32 revisionCounter)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectMain.HandleProject(ProjectDataSet
dataset, Guid projectUid, Guid userUid, String userName, Boolean
isNew, Boolean addColumns, ProjectLocks projectLock, Boolean
fCheckReadOnly, Boolean fCheckProtectedActuals, Boolean
fAllowAddEntRes)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectMain.HandleProject(ProjectDataSet
dataset, Guid projectUid, Guid userUid, String userName, Boolean
isNew, Boolean addColumns, ProjectLocks projectLock)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectQueueDispatch.HandleProject(MessageContext
mContext, ProjectMain project, ServerEventManager sem, ProjectDataSet
dataset, Guid projectUid, Guid userUid, String userName, Boolean
isNew, Boolean addColumns, ProjectLocks projectLock)
at
Microsoft.Office.Project.Server.BusinessLayer.ProjectQueueDispatch.InternalDispatchMessage(PlatformContext
context, Message msg, Group messageGroup, JobTicket jobTicket,
MessageContext mContext)" />
</class>
<class name="Queue">
<error id="26000" name="GeneralQueueJobFailed"
uid="42864af9-2014-42f4-aab4-3cf973d590ea"
JobUID="bc3ba401-b461-4df1-810e-378213d91e9a"
ComputerName="DEVPROJECT" GroupType="ProjectUpdate" MessageType=""
MessageId="" Stage="" />
</class>
</general>
</errinfo>

at UPTSync.MainForm.WaitForQueue(QueueSystem ProjectQueue, Guid
JobID) in D:\UnrealProjectTracker\Src\UPTSync\MainForm.cs:line 678

at UPTSync.MainForm.UpdateProject(Guid ProjectUID, UPTDataContext
UPTData) in D:\UnrealProjectTracker\Src\UPTSync\MainForm.cs:line 583

at UPTSync.MainForm.UpdateProject(Guid ProjectUID, UPTDataContext
UPTData) in D:\UnrealProjectTracker\Src\UPTSync\MainForm.cs:line 620
 
J

Joe Mitchel

I don't think PSI can work with local custom fields. Hopefully someone else
can confirm or deny!

It can set the value if it's already there so I can't believe it can't
create a new value. That would be a pretty big oversight. I guess I
can manipulate the sql directly but I'd rather not have to do that.
 
H

HansH

PSI has limited support for manipulating local custom fields. From the SDK:

/What the PSI Does Not Do
Defining local custom fields. However, the PSI does support editing
local custom field values on tasks, resources, and assignments./

So it all depends on whether the local custom fields has already been
defined locally in the plan or not.
If you are talking about new values, are those new values for a local
custom fields which do contain data for other tasks? Or are those new
values for an unused local field?

I hope this helps,
Hans

Projectopolis <http://msepm.hsquared.be>
 
J

Joe Mitchel

I'm not sure what you mean by a defined local custom field. I'm
manipulating the data in Text5. If someone in project adds a value to
Text5 for a given task, I can find that value, change it and save it
back out.

If however, I try to add a value for Text5 to a task that hadn't been
setup in project, I get the error.
 
R

Rod Gill

So why not use an Enterprise Custom Field? They can be included in cube
reports and all Enterprise reports and PSI has much better control over
them.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 

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