EPMFAQ Forums - Connect with the EPM Community  

Go Back   EPMFAQ Forums - Connect with the EPM Community > Microsoft Project Forums > Project 2007 Development


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2008, 05:19 AM
Junior Member
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default PSI - Add Task with AddPositionType.Middle

Hi,

I'm new to this forum. Ok, in this moment I think everybody is new to this place .

I got a problem with adding tasks to an existing project using PSI. I use the
AddPositionType.Middle and set the "AddAfterTaskUID" to a correct value.
All works fine, if adding only a few task, but, if I try to add more tasks, say about 40, I get the queue error "TaskUnableToInsert".

if tried lots of things, like:

QueueAddToProject in small blocks (after 1,2,5,10,900 tasks added to the update dataset)

QueueAddToProject, then wait for jobdone state.
and other debugging thinks, but none of them works ...

Here is some code:

PHP Code:
 public ProjectDataSet.TaskRow AddNewTask(
            
string taskName,
            
Guid addAfterTaskUid,
            
int taskOutlineLevel,
            
int taskDuration,
            
Task.DurationFormat taskDurationFMT)
        {
            
// - increase and watch change count;
            
IncreaseChangeCount();

            
ProjectDataSet.TaskRow newTask ChangesDataSet.Task.NewTaskRow();
            
newTask.PROJ_UID this.ProjUid;
            
newTask.TASK_UID Guid.NewGuid();
            
newTask.TASK_NAME taskName;
            
newTask.TASK_DUR taskDuration;
            
newTask.TASK_DUR_FMT = (int)taskDurationFMT;//(int)Task.DurationFormat.Day;
            
newTask.TASK_OUTLINE_LEVEL taskOutlineLevel;
            
newTask.TASK_IS_SUMMARY = (taskDuration == 0);

            
// - if no addAfterTask, attach task at last position
            
if (addAfterTaskUid == Guid.Empty)
            {
                
newTask.AddPosition = (short)Task.AddPositionType.Last;
            }
            else
            {
                
//newTask.AddPosition = (short)Task.AddPositionType.Last;
                
newTask.AddPosition = (short)Task.AddPositionType.Middle;
                
newTask.AddAfterTaskUID addAfterTaskUid;
            }
            
ShowMessage((string.Format("Task \"{0}\" added"taskName)));
            
ChangesDataSet.Task.AddTaskRow(newTask);

            return 
newTask;
        } 
PHP Code:
public void PsiUpdateProject()
        {
            try
            {
                
Guid sessionUid PsiGetSessionUid();
                
Guid jobUid Guid.NewGuid();
                
//ServiceFactory.ProjectSvc.QueueUpdateProject(jobUid, session, this.ChangesDataSet, false);
                
ProjectDataSet changesAdded
                    
this.ChangesDataSet.GetChanges(DataRowState.Added) as ProjectDataSet;
                if (
changesAdded != null)
                {
                     
ServiceFactory.ProjectSvc.QueueAddToProject(
                        
jobUid,
                        
sessionUid,
                        
changesAdded,
                        
false);
                     
ShowMessage(string.Format("project \"{0}\" updated add"this.ProjUid));
                     
this.PsiWaitForQueue(this.ServiceFactory.QueueSystemSvcjobUid);
                }
                
changesAdded null;
                
ProjectDataSet changesModified
                    
this.ChangesDataSet.GetChanges(DataRowState.Modified) as ProjectDataSet;
                if (
changesModified != null)
                {                
                    
ServiceFactory.ProjectSvc.QueueUpdateProject(
                        
jobUid,
                        
sessionUid,
                        
changesModified,
                        
false);

                    
ShowMessage(string.Format("project \"{0}\" updated mod"this.ProjUid));
                }
                
changesModified null;
                
ProjectDataSet changesDeleted
                    
this.ChangesDataSet.GetChanges(DataRowState.Deleted) as ProjectDataSet;
                if (
changesDeleted != null)
                {
                    
ServiceFactory.ProjectSvc.QueueUpdateProject(
                        
jobUid,
                        
sessionUid,
                        
changesDeleted,
                        
false);
                    
ShowMessage(string.Format("project \"{0}\" updated del"this.ProjUid));
                }
                
changesDeleted null;
                
this.ChangesDataSet.AcceptChanges();
                
this.ChangeCount 0;

                
//System.Threading.Thread.Sleep(TimeSpan.FromSeconds(4));
                //this.ChangesDataSet.Task.Clear();
            
}
            catch (
Exception ex)
            {
                
ShowMessage("QueueAddToProject failed on project." ex.Message);
            }
        } 
Does anybody have some problems or some answers?








Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
  #2 (permalink)  
Old 04-16-2008, 01:48 AM
ssanderlin's Avatar
EPMFAQ Founder/Owner
 
Join Date: Feb 2008
Location: Quakertown, PA
Posts: 171
Thanks: 0
Thanked 17 Times in 17 Posts
Default

Welcome to the Forum!

Can you provide the full detail from the Queue error?
__________________
Stephen Sanderlin
Founder/Owner - EPMFAQ
VP of Technology - MSProjectExperts
Microsoft Project MVP

If you found this message useful, please click the Thanks button in the post!

This electronic message, along with any information, advice, and opinions it contains, are mine alone and are not representative of my employer. All information is provided in "GOOD FAITH" and on an "AS IS" basis only. I provide no presentations or warranties, express or implied, including implied warranties of fitness for a particular purpose, merchantability, title, and noninfringement. I strongly advise you to extensively test any changes, workarounds, or techniques described herein on a development system prior to implementation in a production environment, and you are hereby notified that I bear no responsibility whatsoever for any loss, harm, or otherwise negative outcomes resulting from your actions, whether or not said actions were a result of this electronic message, directly or indirectly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-16-2008, 02:25 AM
Junior Member
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, for sure. Here it is.

I add tasks in blocks of ten with calling "queueAddToProject", then wait for job complete state from the queue system, then I read the project dataset again. After 3 to 4 updates I get this error:

PHP Code:
System.ApplicationException was caught
  Message="Queue request failed \"Failed\" Job ID: 5b7c0d70-60b5-4b9a-895d-bc8253610846.
<?xml version="1.0\" encoding=\"utf-16\"?>
    <errinfo>
        <general>
            <class name=\"Project\">
                <error id=\"7025\" name=\"TaskUnableToInsert\" uid=\"598f8f96-19b6-4cf1-80c6-73ed5137e11e\" />
            </class>
            <class name=\"Queue\">
                <error id=\"26000\" name=\"GeneralQueueJobFailed\" uid=\"7bf06bc4-f28c-49ae-9c8b-9448d47f54bd\" JobUID=\"5b7c0d70-60b5-4b9a-895d-bc8253610846\" ComputerName=\"S01RKM02\" GroupType=\"ProjectUpdate\" MessageType=\"\" MessageId=\"\" Stage=\"\" />
            </class>
        </general>
    </errinfo>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-16-2008, 08:50 AM
ssanderlin's Avatar
EPMFAQ Founder/Owner
 
Join Date: Feb 2008
Location: Quakertown, PA
Posts: 171
Thanks: 0
Thanked 17 Times in 17 Posts
Default

Quote:
Originally Posted by tlenz View Post
Yes, for sure. Here it is.

I add tasks in blocks of ten with calling "queueAddToProject", then wait for job complete state from the queue system, then I read the project dataset again. After 3 to 4 updates I get this error:

PHP Code:
System.ApplicationException was caught
  Message="Queue request failed \"Failed\" Job ID: 5b7c0d70-60b5-4b9a-895d-bc8253610846.
<?xml version="1.0\" encoding=\"utf-16\"?>
    <errinfo>
        <general>
            <class name=\"Project\">
                <error id=\"7025\" name=\"TaskUnableToInsert\" uid=\"598f8f96-19b6-4cf1-80c6-73ed5137e11e\" />
            </class>
            <class name=\"Queue\">
                <error id=\"26000\" name=\"GeneralQueueJobFailed\" uid=\"7bf06bc4-f28c-49ae-9c8b-9448d47f54bd\" JobUID=\"5b7c0d70-60b5-4b9a-895d-bc8253610846\" ComputerName=\"S01RKM02\" GroupType=\"ProjectUpdate\" MessageType=\"\" MessageId=\"\" Stage=\"\" />
            </class>
        </general>
    </errinfo>
Interesting.... Less helpful than I had hoped, though.

What version of Project Server 2007 are you working with?
__________________
Stephen Sanderlin
Founder/Owner - EPMFAQ
VP of Technology - MSProjectExperts
Microsoft Project MVP

If you found this message useful, please click the Thanks button in the post!

This electronic message, along with any information, advice, and opinions it contains, are mine alone and are not representative of my employer. All information is provided in "GOOD FAITH" and on an "AS IS" basis only. I provide no presentations or warranties, express or implied, including implied warranties of fitness for a particular purpose, merchantability, title, and noninfringement. I strongly advise you to extensively test any changes, workarounds, or techniques described herein on a development system prior to implementation in a production environment, and you are hereby notified that I bear no responsibility whatsoever for any loss, harm, or otherwise negative outcomes resulting from your actions, whether or not said actions were a result of this electronic message, directly or indirectly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-17-2008, 06:01 AM
Junior Member
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I solved it!

Install the post service pack 1 hotfix (kb941426) and all goes well ...

thanks to Heiner Eichmann.
__________________
INNEO Solutions
ProjektPortal
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-17-2008, 01:02 PM
ssanderlin's Avatar
EPMFAQ Founder/Owner
 
Join Date: Feb 2008
Location: Quakertown, PA
Posts: 171
Thanks: 0
Thanked 17 Times in 17 Posts
Default

Quote:
Originally Posted by tlenz View Post
I solved it!

Install the post service pack 1 hotfix (kb941426) and all goes well ...

thanks to Heiner Eichmann.
Great -- good to know this is resolved by the rollup.

Thanks for letting us know!
__________________
Stephen Sanderlin
Founder/Owner - EPMFAQ
VP of Technology - MSProjectExperts
Microsoft Project MVP

If you found this message useful, please click the Thanks button in the post!

This electronic message, along with any information, advice, and opinions it contains, are mine alone and are not representative of my employer. All information is provided in "GOOD FAITH" and on an "AS IS" basis only. I provide no presentations or warranties, express or implied, including implied warranties of fitness for a particular purpose, merchantability, title, and noninfringement. I strongly advise you to extensively test any changes, workarounds, or techniques described herein on a development system prior to implementation in a production environment, and you are hereby notified that I bear no responsibility whatsoever for any loss, harm, or otherwise negative outcomes resulting from your actions, whether or not said actions were a result of this electronic message, directly or indirectly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -4. The time now is 07:53 AM.


Powered by: vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Ad Management by RedTyger

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24