Problem and solution

S

shahaji gole

I had the same issue. I wanted to add new task in existing project. Initially I was trying with "QueueUpdateProject" method. Later on I understood that this method is just to update or modify the existing entities and NOT to add new entities.

I refered MS office project SDK and I found "QueueAddToProject" method, which allows to add new entities. But this alone didn't solve the problem. I had call "QueuePublish" method appear the newly added task on the list.

I hope this helps you.

Thanks,
Shahaji.



Mike Glen wrote:

Hi albupp ,Thanks for posting your solution.
01-Feb-08

Hi albupp

Thanks for posting your solution. :) Perhaps next time, try posting on the
developer newsgroup. Please see FAQ Item: 24. Project Newsgroups. FAQs,
companion products and other useful Project information can be seen at this
web address: http://project.mvps.org/faqs.ht

Mike Gle
Project MV

albupp wrote:

Previous Posts In This Thread:

Error updating a project via PSI
Greetings Everyone

I'm hoping that someone here might be able to help me understand a specific
error code I'm getting back from the PSI remote web service, namely:
GeneralOnlyUpdatesAllowed. I've searched the SDK docs, the web and this forum
for more information about this error code, but without learning much. The
SDK docs are terse, they simply say: "Only updates are allowed.

I'm simply trying to update the TASK_DUR column of a given task for a given
project. My code looks something like this

ProjectDataSet prjDs = new ProjectDataSet()
ProjectDataSet.TaskRow task = prjDs.Task.NewTaskRow()
task.PROJ_UID = prjGuid
task.TASK_UID = oldTask.TASK_UID()
task.TASK_DUR_FMT = (int)Enum.Parse(typeof(PSLib.Task.DurationFormat),
"Hour")
task.TASK_DUR = nDurValue
prjDs.Task.AddTaskRow(task)

Guid sessionGuid = Guid.NewGuid()
CheckOutProject(prjGuid, sessionGuid, "Checked out for update.")
Guid jobGuid = Guid.NewGuid()
QueueUpdateProject(jobGuid, sessionGuid, prjDs)

This results in a LastError=GeneralOnlyUpdatesAllowed response from the
project server. Any help I could get interpretting what this means would be
greatly appreciated

Thanks in advance.

I was able to resolve this error by following the C# code example in the MS
I was able to resolve this error by following the C# code example in the M
Office Project SDK help, under QueueUpdateProject method.

Hi albupp ,Thanks for posting your solution.
Hi albupp

Thanks for posting your solution. :) Perhaps next time, try posting on the
developer newsgroup. Please see FAQ Item: 24. Project Newsgroups. FAQs,
companion products and other useful Project information can be seen at this
web address: http://project.mvps.org/faqs.ht

Mike Gle
Project MV

albupp wrote:


Submitted via EggHeadCafe - Software Developer Portal of Choice
FREEWARE: ClearCache IE Cache Control Utility
http://www.eggheadcafe.com/tutorial...e3-133591db718a/freeware-clearcache-ie-c.aspx
 
P

P P

Hi shahaji,

I note has helped me to relove "LastError=GeneralOnlyUpdatesAllowed" error.

Thanks lot!!!!!

working code:
private void addTask(Guid existingProjectGUID)
{
//Read given work plan
ProjectWebService.ProjectDataSet projectDataSet = new ProjectWebService.ProjectDataSet();
projectDataSet = _projectWS.ReadProject(existingProjectGUID, ProjectWebService.DataStoreEnum.WorkingStore);

//add Task1 to project
ProjectWebService.ProjectDataSet.TaskRow taskOne = projectDataSet.Task.NewTaskRow();
taskOne.PROJ_UID = existingProjectGUID;
taskOne.TASK_UID = Guid.NewGuid();
taskOne.TASK_NAME = "Task 5";
taskOne.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Day;
taskOne.TASK_DUR = 4800; // 8 hours in duration units (minute/10)[ 4800/10 = 480/8]
string startDate = "9/12/2011";
taskOne.TASK_START_DATE = DateTime.Parse(startDate);
//taskOne.TASK_IS_SUMMARY=true;
projectDataSet.Task.AddTaskRow(taskOne);


//add Task2.2 to project
ProjectWebService.ProjectDataSet.TaskRow taskTwo = projectDataSet.Task.NewTaskRow();
taskTwo.PROJ_UID = existingProjectGUID;
taskTwo.TASK_UID = Guid.NewGuid();
taskTwo.TASK_NAME = "Task 5.1";
taskTwo.TASK_OUTLINE_LEVEL = 2;
// The Task Duration format must be specified.
taskTwo.TASK_DUR_FMT = (int)PSLibrary.Task.DurationFormat.Day;
taskTwo.TASK_DUR = 4800; // 8 hours in duration units (minute/10)
startDate = "9/13/2011";
taskTwo.TASK_START_DATE = DateTime.Parse(startDate);
//taskTwo.StatusManager = "WILL SET GUID HERE"

projectDataSet.Task.AddTaskRow(taskTwo);


Guid sessionGuid = Guid.NewGuid();

//Check-out the work plan
_projectWS.CheckOutProject(existingProjectGUID, sessionGuid, "Checkout");

// Save the project to the database.
bool validateOnly = false;

_projectWS.QueueAddToProject(Guid.NewGuid(), sessionGuid, (ProjectWebService.ProjectDataSet)projectDataSet.GetChanges(), validateOnly);

//_projectWS.QueueUpdateProject(Guid.NewGuid(), sessionGuid, (ProjectWebService.ProjectDataSet)projectDataSet.GetChanges(), validateOnly);

//Check-in the work plan
_projectWS.QueueCheckInProject(Guid.NewGuid(), existingProjectGUID, true, sessionGuid, string.Empty);

//publis the project
_projectWS.QueuePublish(Guid.NewGuid(), existingProjectGUID, true, string.Empty);


}
 

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