none
how to change task's status manager using PSI? RRS feed

  • Question

  • Dear All:

           i have a question about task status manager!  now i create some task using PSI in Web Service, the task status manager always is Administrator(i use administrator run the PSI) , but i need set Project Mangager as the task status manager. How ?

          In EPM 2007:)

          Thanks!


    peardong


    Monday, March 5, 2012 2:39 PM

All replies

  • Hello everyone!

           can we find some methods to resolve this?


    peardong

    Tuesday, March 6, 2012 1:47 AM
  • Hi There,
    Once a projec is created, a Project Manaager can manually change the status manager.

    Change the Status Manager

    To change the Status Manager of the project, the new project manager must complete the following steps:

    1. Open the enterprise project in question in Project Professional 2007.

    2. Apply any Task view, such as the Gantt chart view.

    3. Right-click on the column header to the right of the Task Name column and select Insert Column from the shortcut menu.

    4. Select the Status Manager Field from the list of available fields.

    The system inserts the Status Manager Field to the right of the Task Name field.

    5. Click the Status Manager pick list and select your name from the list for every regular task that you must manage.

    Note: You do not need to change the Status Manager value for summary tasks.  In addition, keep in mind that the Status Manager pick list includes the names of all other Status Managers in the project, plus your own name. If you are the third manager to open the project, for example, the Status Manager pick list includes the names of the first two managers, along with your name.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82



    Tuesday, March 6, 2012 6:33 AM
  • Hi there,

    Missed to update you that I am not aware of  the method in PS2007  PSI which can update the Status manager of a task, thought it's possible in PS2010 . You can read the status manager value through the Statusing Service

    (http://msdn.microsoft.com/en-s/library/websvcstatusing.statusingdataset.assignmentsrow.wr es_uid_manager(office.12).aspx), but you can't change it. The supported project fields for updating through the Statusing Service (http://msdn.microsoft.com/en-us/library/bb428845.aspx) do NOT include status manager.

    May be another reason for you to upgrade to PS2010 :)


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82

    Tuesday, March 6, 2012 6:51 AM
  • Thanks a lot for your reply!

    Maybe there is no method in PSI 2007. I had tried update PROJECTSERVER_DRAFTE.DBO.MSP_ASSIGNEMNTS.WRES_STATSU_MANAGER using SQL, it works! But when open the Project in project professional, task status manager can't change.

    i need look for another method!

    anyway thanks!


    peardong

    Tuesday, March 6, 2012 3:32 PM
  • HI there,

    We shouldn't be modifing/update the table's data using SQL query , that is not supported. IN SP2007, After the project is created by administartor, PM will need to open the project & set him/her self as the status Manager manually. (process is very  simple & one time activity)

    Hope that helps.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82

    Wednesday, March 7, 2012 11:44 AM
  • HI there,

    We shouldn't be modifing/update the table's data using SQL query , that is not supported. IN SP2007, After the project is created by administartor, PM will need to open the project & set him/her self as the status Manager manually. (process is very  simple & one time activity)

    Hope that helps.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82

    Hi Amit,

    I'm also looking the way to do this (change status manager using PSI API) in project server 2010. I have a test code below

    however the value of StatusManager always empty, so do you guys have any idea about changing StatusManager, am I using the correct way?

            [TestMethod]
            public void Test_Change_Status_Manager_Case_01()
            {            
                NetworkCredential creads = new NetworkCredential(username, password, domain);
                SetupService(creads);

                string projectName = "Project 1";

                ProjectDataSet projectData = projectSvc.GetProjectDataFromPublishedStore(projectName); // a custom method to read project data

                if (projectData != null)
                {
                    Console.WriteLine("Project name = {0}, ID = {1}, Manager = {2}", 
                        projectData.Project.Rows[0]["PROJ_NAME"].ToString(),
                        projectData.Project.Rows[0]["PROJ_UID"].ToString(),
                        projectData.Project.Rows[0]["PROJ_PROP_MANAGER"].ToString());

                    Console.WriteLine("************All the project tasks***************");
                    for (int i = 0; i < projectData.Task.Rows.Count; i++)
                    {
                        Service.ProjectWebSvc.ProjectDataSet.TaskRow dtrTask =
                                projectData.Task.Rows[i] as Service.ProjectWebSvc.ProjectDataSet.TaskRow;

                        if (dtrTask != null)
                        {
                            Console.WriteLine("Task name = {0}, Status manager = {1}", dtrTask.TASK_NAME,
                                dtrTask.IsStatusManagerNull() ? string.Empty : dtrTask.StatusManager.ToString());
                            
                        }                   
                    }
                    
                }
            }

    public ProjectDataSet GetProjectDataFromPublishedStore(string projectName)
            {                       
                ProjectDataSet projectDs = this.ReadProjectStatus(
                        Guid.Empty, Service.ProjectWebSvc.DataStoreEnum.PublishedStore, projectName,
                        (int)PSLibrary.Project.ProjectType.Project);

                Guid projUid = projectDs.Project[0].PROJ_UID;

                if (projUid == Guid.Empty)
                    throw (new ArgumentException(
                        string.Format("\nThe project '{0}' does not exist.", projectName)));

                // Get the full information for the project.
                projectDs = this.ReadProject(projUid, Service.ProjectWebSvc.DataStoreEnum.PublishedStore);

                return projectDs;
            }

    Thank you,

    Steven



    • Edited by Steven Hua Saturday, September 15, 2012 4:49 AM
    Thursday, September 13, 2012 4:32 AM
  • Hi Steven,

    Did you get the solution through PSI, i am in the same situation where i need to do Status Manager update for all projects created through programming (using service account).

    Please suggest.



    Thanks & Regards
    Ravishankar Polepalli (MCP,MCC)
    Microsoft Dynamics, Project Server and SharePoint Server Consultant
    ravi.polepalli@gmail.com

    Thursday, November 8, 2012 9:17 AM
  • Hi Ravishankar Polepalli,

    I still cannot get this work with the PSI API, seems that what are in the PSI document and what happen actually are different :)

    I have used another approach for my requirement but I still want to know how to deal with this StatusManager field, maybe I'll try to upgrade my project server to SP1 and try it.

    Regards,

    Steven

    Monday, January 7, 2013 8:12 AM
  • Hi Ravi,

    Please find the code snippet to update the status manager through PSI:

    protected void StatusManagerProcessButtonClick(object sender, EventArgs e) { try { if (!IsRefresh) { Guid sessionUid; bool isProjectCheckin = false; //DateTime startTime = DateTime.Now; ProjectWebSvc.Project projectSvc = new ProjectWebSvc.Project(); projectSvc.Url = SERVER_URI + PROJECT_SERVICE_PATH; projectSvc.CookieContainer = new CookieContainer(); projectSvc.Credentials = CredentialCache.DefaultCredentials; string oprojectid = "9FC90EEC-8D06-4527-8982-1E4AB602DCCD"; // get the project id dynamically Guid Projectid = new Guid(oprojectid); string oSM = "D0D8F22A-E1C3-4FA0-ACDC-D771E24EB783"; // get the SM id dynamically Guid SM = new Guid(oSM); projectDs = projectSvc.ReadProject(Projectid, ProjectWebSvc.DataStoreEnum.WorkingStore); sessionUid = Guid.NewGuid(); projectSvc.CheckOutProject(Projectid, sessionUid, "Check Out:PSI"); foreach (ProjectWebSvc.ProjectDataSet.TaskRow row in projectDs.Task.Rows) { // Note: Summary tasks can't be changed. if (!(row.TASK_IS_SUMMARY)) { row.StatusManager = SM; } } jobGuid = Guid.NewGuid(); projectSvc.QueueUpdateProject(jobGuid, sessionUid, projectDs, false); System.Threading.Thread.Sleep(2000); //WaitForQueue(SvcQueueSystem.QueueMsgType.ProjectCreate, queueSystemClient, startTime); Guid publishguid = Guid.NewGuid(); const string WSS_URL = null; projectSvc.QueuePublish(publishguid, Projectid, true, WSS_URL); System.Threading.Thread.Sleep(2000); //WaitForQueue(SvcQueueSystem.QueueMsgType.ProjectCreate, queueSystemClient, startTime); jobGuid = Guid.NewGuid(); projectSvc.QueueCheckInProject(jobGuid, Projectid, false, sessionUid, "Check In:PSI"); System.Threading.Thread.Sleep(2000); //isProjectCheckin = true; //WaitForQueue(SvcQueueSystem.QueueMsgType.ProjectCreate, queueSystemClient, startTime); this.messageDelEncodedLiteral.Text = "Status Manager updated successfully"; } else { this.messageDelEncodedLiteral.Text = ""; } } catch (Exception ex) { if (ex.Message.Contains("CICOCheckedOutToOtherUser")) { this.messageDelEncodedLiteral.Text = "Error! Message: Project Checked out. Please Check in the project before updating Status Manager"; } else { String error = string.Empty; error = "Error! Message: " + ex.Message.ToString(); this.messageDelEncodedLiteral.Text = error; } } Finally { //If (isProjectCheckin = false) //projectSvc.QueueCheckInProject(jobGuid, Projectid, false, sessionUid, "Check In:PSI"); } }

    Finally execute the below query in the Reporting DB to check whether Status Manager is updated or not:

    Select ProjectUid,TaskUid, TaskStatusManagerUid, (select ResourceName from msp_epmresource_userview R where R.Resourceuid =T.TaskStatusManagerUid) as [Status Manager Name] from msp_epmtask_userview T

    where T.ProjectUid ='9FC90EEC-8D06-4527-8982-1E4AB602DCCD' and T.Taskissummary <> 1

    Regards,

    Vivek

    Monday, February 18, 2013 2:38 PM
  • You can write the event handler OnCheckIn for change the status manager.
    Whenever we create the project or task using PSi then it's use the administrator as
    status manager.

    below mention the code to update the status manager:

    SvcProject.ProjectDataSet projectDs = projectClient.ReadProject(ProjectGuid, SvcProject.DataStoreEnum.WorkingStore);
    Guid OwnerGUid = new Guid (projectDs.Project.Select("PROJ_UID = '" + ProjectGuid + "'")[0][projectDs.Project.ProjectOwnerIDColumn].ToString());

    foreach (SvcProject.ProjectDataSet.TaskRow taskRow in projectDs.Task)
                    {
                        if (taskRow.TASK_OUTLINE_LEVEL != 0)
                        {
                            taskRow.StatusManager = OwnerGUid;
                            
                        }
                    }
    projectClient.CheckOutProject(ProjectGuid, SessionGuid, "CheckOut by PSI");
    projectClient.QueueUpdateProject(JobGuid, SessionGuid, projectDs, false);
    projectClient.QueueCheckInProject(JobGuid, ProjectGuid, true, SessionGuid, "CheckIn by PSI");
    projectClient.QueuePublish(JobGuid, ProjectGuid, true, "Published by PSI");

    Thanks & Regards
    Vaneet Thakur


      
    Monday, March 18, 2013 2:05 PM