GeneralOnlyUpdatesAllowed adding/modifying a task using PSI

T

Tim Andrews

I can modify a project, reassign resources, etc. no problem but anytime I try
to update the TaskDataTable by either modifying an existing record or adding
a new one, I get an error during the QueueUpdateProject process,
"GeneralOnlyUpdatesAllowed". I just loaded the Dec. '08 hotfixes for
Sharepoint and Project Server but that didn't help. Here is the code minus
the helper functions that access the web services and manage the queue, which
as far as I can tell are not the problem.

Sub ModifyTask(ByVal PROJ_UID As Guid)
Dim proj As ProjectDataSet = projsvc.ReadProject(PROJ_UID,
DataStoreEnum.PublishedStore)
Dim projdata As ProjectDataSet.ProjectRow =
proj.Project.FindByPROJ_UID(PROJ_UID)
Dim projtask As ProjectDataSet.TaskDataTable = proj.Task
Dim upd_jobid As Guid = Guid.NewGuid
projsvc.CheckOutProject(PROJ_UID, sessionid, "Test Task")

'Create new task
Dim TASK_UID As Guid = Guid.NewGuid
Dim taskrow As ProjectDataSet.TaskRow = projtask.NewTaskRow
taskrow.PROJ_UID = PROJ_UID
taskrow.TASK_UID = TASK_UID
taskrow.TASK_NAME = "Test Task"
taskrow.PROJ_NAME = projdata.PROJ_NAME
taskrow.TASK_DUR_FMT = PSLibrary.Task.DurationFormat.Hour
taskrow.TASK_DUR = 4800
taskrow.TASK_START_DATE = Now()
taskrow.AddPosition = PSLibrary.Task.AddPositionType.Last
projtask.AddTaskRow(taskrow)

'This is where I get the error "GeneralOnlyUpdatesAllowed":
projsvc.QueueUpdateProject(upd_jobid, sessionid, proj, False)
q.WaitForQueue(upd_jobid)

'Check in project
Dim checkin_jobid As Guid = Guid.NewGuid
projsvc.QueueCheckInProject(checkin_jobid, PROJ_UID, False,
sessionid, "Test Task")
q.WaitForQueue(checkin_jobid)

'Publish project
Dim publish_jobid As Guid = Guid.NewGuid
projsvc.QueuePublish(publish_jobid, PROJ_UID, True, Nothing)
q.WaitForQueue(publish_jobid)
End Sub

I even wrote out the project dataset before and after the update and
compared the differences, the only thing that changes is the addition of the
following data:
<Task>
<PROJ_UID>8537388f-0cd0-4ecd-8461-b9f15e1f84a6</PROJ_UID>
<TASK_UID>e2eab3f1-e2b3-447e-900b-a267e9e22e4e</TASK_UID>
<TASK_NAME>Test Task</TASK_NAME>
<TASK_LOCKDOWN_BY_MANAGER>false</TASK_LOCKDOWN_BY_MANAGER>
<TASK_DUR>4800</TASK_DUR>
<TASK_DUR_FMT>5</TASK_DUR_FMT>
<TASK_START_DATE>2009-01-08T15:19:30.108094-08:00</TASK_START_DATE>
<AddPosition>2</AddPosition>
<PROJ_NAME>Tim Test 2</PROJ_NAME>
</Task>

It shouldn't be a permissions issue as I have full control of the server and
I even created this project myself. Any ideas would be greatly appreciated.
Thanks,

TIM
 
S

Stephen Sanderlin

QueueUpdateProject does not create or delete project entities; it
modifies existing entities such as tasks, assignments, and project
resources. QueueUpdateProject can also add, modify, or delete custom
field values in a project, but cannot create or delete a custom field
itself (use CreateCustomFields or DeleteCustomFields). (Quoted from
http://msdn.microsoft.com/en-us/library/websvcproject.project.queueupdateproject.aspx)

GeneralOnlyUpdatesAllowed means "Only updates are allowed."
(http://msdn.microsoft.com/en-us/library/ms508961.aspx)

Project.QueueUpdateProject is not the appropriate method to use when
adding new entities to a project. You need to use
Project.QueueAddToProject
(http://msdn.microsoft.com/en-us/library/websvcproject.project.queueaddtoproject.aspx)
to do this.

--
Stephen Sanderlin
Principal Consultant
MSProjectExperts

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

Read my blog at: http://www.projectserverhelp.com
Join the community at: http://forums.epmfaq.com
 
T

Tim Andrews

Awesome, that did the trick. Guess I missed that little detail in the
examples - although the first time I tried QueueAddToProject I got a
GeneralInsertsOnlyAllowed error, but after looking back at the sample code
for QueueAddToProject I noticed the new task row was add to an *empty*
project dataset, I was loading the project dataset and adding rows to it, and
submitting the entire dataset to the queue. Changed it to a new dataset and
it works great now. Thanks!

TIM
 
R

Rayees

Hello ,
I am not able to update the task information like Task name or work .
Following is the code using which i try to update my task.
projectDs = projectSvc.ReadProject(proj_Uid,
WebSvcProject.DataStoreEnum.PublishedStore)
Dim sessionUid As Guid
sessionUid = Guid.NewGuid
projectSvc.CheckOutProject(proj_Uid, sessionUid, "")

Dim tskDT As WebSvcProject.ProjectDataSet.TaskDataTable
tskDT = projectDs.Task
tskRow = tskDT.Rows(1)
tskRow.TASK_WORK = 480
tskDT.AcceptChanges()
projectDs.AcceptChanges()
Dim jobUId As Guid = Guid.NewGuid
projectSvc.QueueUpdateProject(jobUId, sessionUid, projectDs,
False)
WaitForQueue(jobUId)
projectSvc.QueueCheckInProject(Guid.NewGuid, proj_Uid, True,
sessionUid, "")
It is very urgent .Please help.
Regards
Rayees Wani
 

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