PS2007: Add a new task between two existing tasks Part 2

T

Tiffy Huxtable

Hello,

I have massive trouble with inserting/adding a new task between two
existing tasks programmatically via Project Webservice (not VBA).
Two examples, one working and one not working, shall explain what the
problem is.

Example 1)

Given is the following project plan in Project Professional:

Task 1
Task 2

Two lines, nothing more.
Adding programmatically via Project Webservice a third task "Task 3"
between the two existing tasks works, so the result project plan is:

Task 1
Task 3
Task 2



Example 2:

Task 1
<empty line>
Task 2

Yes, you can insert empty lines in Project Professional. Those 3 lines
are now viewable in the project plan. Now when I try to insert a new
task "Task 3" then the insertion fails with
"TaskUnableToInsert" (id=7025) and the queued job is blocked in the
queue.

The SharePoint log offers lots of entries, one is:

10/13/2009 14:42:14.95 Microsoft.Office.Project.Server (0x13C8)
0x173C Project Server Project Server-side Project Ope
8syo Medium PWA:http://sample.test.local/PWA, SSP:SharedServices1,
User:TEST\superadmin, PSI: SSP: HandleTaskInserts exception
System.InvalidCastException: Specified cast is not valid. at
Microsoft.Office.Project.Server.BusinessLayer.ProjectOutline.HandleTaskInserts
(ProjectDataSet dataset, Guid projectUid, Hashtable tasksToInsert,
Boolean isUpdate) 4cfd0822-6602-4bb6-8a05-553fd54da20d


After lots of time and tries I found out that the empy line is the
reason why it fails. MSDN says that in order to insert a new task
between existing tasks I have to assign the TASK_UID of the task after
that I want to insert.
In my example TASK_UID of "Task 1" is relevant and is assigned to the
"AddAfterTaskUID" property of my new task "Task 3".



So, inserting a new task between existing tasks programmatically via
PSI Project Webservice works as long as there are no empty lines. But
when there are empty lines like in my example then the insertion via
PSI fails.

Any suggestions or workarounds to this problem?

TIA and best regards, Tiffy
 
T

Tiffy Huxtable

Addition:
when a project plan has one or more empty lines then adding a new task
with ProjectWebSvc.QueueAddToProject() always fails, no matter where I
want to place the new task in the plan.

Assing new tasks is impossible and lead to an exception when the
project plan has empty lines.
Project Server 2007 SP2 version is 12.0.6425.1000

Tiffy
 
G

Gary Chefetz

Tiffy:

Project Server doesn't like blank lines in a schedule and using blank lines
is a bad practice. This is not the only problem you will experience if you
don't eliminate this habit in your user community.
 

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