How to Program a code to Approve a TimeSheet in Project Server 2007

Answered How to Program a code to Approve a TimeSheet in Project Server 2007

  • Thursday, April 26, 2012 12:57 PM
     
     

    Hi,

    I Want to Code a WebService to Approve/Reject  a TimeSheet of a Particular Resource, I am very new on Project Server Programming can anyone please provide some inputs on how can i do this.

    The Idea is, that i Will Pass Manager Name,Resource Name,"Approve/Reject string" and TimeSheet Week Date to the Web Method to perform the action and return a Boolean Value as Status.

    Very thankfull for every suggestion in advance.


    Ankur Madaan MCTS|MCP SharePoint Application Developer 2010

All Replies

  • Friday, April 27, 2012 11:59 AM
     
     

    Hi Ankur--

    The idea seems to be simple but the implementation requires a huge , complex & time consuming code. The action which you want to perform is already with PWA Approval center.

    What exactly you want to achieve from code, it's OOB feature & doesn't require a custom code. If you are looking for additional solution , It's something like a rework.
    Anyway, the steps will be:
    1. One you know the Timesheet Manager (TsM) name, get all the resources to whom the TsM is the Timesheet manager using the Resource Web service
    http://msdn.microsoft.com/en-us/library/websvcresource_di_pj14mref.aspx
    http://msdn.microsoft.com/en-us/library/websvcresource.resource_di_pj14mref.aspx
    2. Get all the timesheets & filter with RES_UID, Timesheet period of the Resource team member who has submiited timesheet to TsM using the Timesheet web service:
    http://msdn.microsoft.com/en-us/library/websvctimesheet_di_pj14mref.aspx
    http://msdn.microsoft.com/en-us/library/websvctimesheet.timesheet_di_pj14mref.aspx

    3. Use the QueueReviewTimesheet & approve/reject:
    http://msdn.microsoft.com/en-us/library/gg206749.aspx

    I hope that helps you to start thinking a OOB solution or custom solution pros n cons.

    Thanks & Good luck


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

  • Wednesday, May 02, 2012 12:50 PM
     
     

    Hi Amit,

    Thanks for your Reply, i created a Service and it works perfectly, i used three webservices of Project Server : Timesheet.asmx, Queuesystem.asmx and resource.asmx.

    and QueueReviewTimesheet function works.

    But the problem which remains is Impersonating the Credentials of a Manager, as strangely QueueReviewTimesheet function is bypassing the mgrUID i am passing as Parameter and Approving/Rejecting the timesheet using the credentials i am using while Instantiating the "TimesheetWS.TimeSheetSvc.Credentials".

    Can you please suggest any solution for this.

    I am Creating a WebService, the method in this will return me string message of success and failure after Queuestatus comes as Success.

    What way i shall impersonate the credentials of TimesheetManager while running the QueueReviewTimesheet Function


    Ankur Madaan MCTS|MCP SharePoint Application Developer 2010

  • Wednesday, May 02, 2012 2:34 PM
     
     Answered

    Great Ankur..

    QueueReviewTimesheet does require the current user's Global permission as AcceptTimesheets.

    Can you please verify from code  Timesheet Manager's permissions in PSLibrary.
    http://msdn.microsoft.com/en-us/library/microsoft.office.project.server.library.pssecurityglobalpermission.accepttimesheets_di_pj14mref.aspx


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

    • Marked As Answer by Ankur Madaan Tuesday, October 16, 2012 6:14 PM
    •