TimeSheet.ReadTimesheetList method

Office 2013 and later

Reads a timesheet summary for the specified resource within the specified date range.

Namespace:  WebSvcTimeSheet
Assembly:  ProjectServerServices (in ProjectServerServices.dll)

[SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/TimeSheet/ReadTimesheetList", RequestNamespace = "http://schemas.microsoft.com/office/project/server/webservices/TimeSheet/", 
	ResponseNamespace = "http://schemas.microsoft.com/office/project/server/webservices/TimeSheet/", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public TimesheetListDataSet ReadTimesheetList(
	Guid resUID,
	DateTime startDate,
	DateTime finishDate,
	int select


Type: System.Guid

The resource GUID.

Type: System.DateTime

The date of earliest timesheet to return.

Type: System.DateTime

The date of the most recent timesheet to return.

Type: System.Int32

Filter for timesheet status; use TimesheetEnum.ListSelect.

Return value

Type: WebSvcTimeSheet.TimesheetListDataSet
DataSet with a summary list of timesheets that satisfy the parameters.

Use a Microsoft.Office.Project.Server.Library.TimesheetEnum.ListSelect value for the select parameter. You can combine the ListSelect values with the OR operation to filter for a combination of properties. For example, to select all timesheets that the user created that are in progress, set the select parameter to CreatedByMeORInProgress.

To return all timesheets plus an empty record for a period where there is no timesheet, set select to TimeSheetEnum.ListSelect.AllPeriods.

ReadTimesheetList ignores resUID if the value of select is just CreatedByMe. To get a list of another person's timesheets that were created by you—that is, timesheets for which you are the surrogate—pass the other user's resource GUID in resUID and a value for select that is an OR operation between CreatedByMe and InProgress, Submitted, Acceptable, Approved, Rejected, or AllExisting.

Valid dates in Project Server are January 1, 1984, through December 31, 2049.

This method uses the QueueSystem object. The CorrelationGUID property for the job is equal to the value of the TS_UID property.

Project Server Permissions




The current user is the timesheet owner, or the value of select is CreatedByMe.


Allows a user to view timesheets for a resource. Applies only if the current user is not the timesheet owner. Global permission.

The following code sample reads all timesheets within specified dates that are created by the user and that are in progress. The sample uses the TimeSheetUtils class and the ExceptionHandlers classe to separate functionality from the Program class. The TimeSheetUtils.GetMyTimeSheetsInProgress method uses the GetCurrentUserUid method in the Resource web service to return the user's GUID.

For information about compiling the sample, see Prerequisites for ASMX-based code samples in Project 2013.

using System;
using System.Net;
using System.Web.Services.Protocols;
using PSLibrary = Microsoft.Office.Project.Server.Library;

namespace Microsoft.SDK.Project.Samples.TestTimesheet
   class Program
      private static TimeSheetWebSvc.TimeSheet timesheet =
         new TimeSheetWebSvc.TimeSheet();
      private static ResourceWebSvc.Resource resource =
         new ResourceWebSvc.Resource();

      private static TimeSheetUtils timeSheetUtils = new TimeSheetUtils();
      private static ExceptionHandlers exceptionHandlers = new ExceptionHandlers();

      static void Main()
            const string PROJECT_SERVER_URI = "http:// ServerName/ProjectServerName/";
            const string RESOURCE_SERVICE_PATH = "_vti_bin/psi/resource.asmx";
            const string TIMESHEET_SERVICE_PATH = "_vti_bin/psi/timesheet.asmx";

            // Set up the web service objects.
            resource.Credentials = CredentialCache.DefaultCredentials;

            timesheet.Credentials = CredentialCache.DefaultCredentials;

            // Get timesheet information for the specified dates.
            DateTime startDate = new DateTime(2006, 11, 27);
            DateTime finishDate = new DateTime(2006, 12, 1);
            Guid resUid;

            TimeSheetWebSvc.TimesheetListDataSet dsTimeSheetList = 
                  timesheet, resource, startDate, finishDate, out resUid);

            Console.WriteLine("Active timesheets for resource: " + resUid.ToString());
            Console.WriteLine(string.Format("\tStart date: {0}\r\n\tFinish date: {1}", 
               startDate.ToString(), finishDate.ToString()));

            for (int i = 0; i < dsTimeSheetList.Timesheets.Count; i++)
         catch (SoapException ex)
         { exceptionHandlers.HandleSoapException(ex); }
         catch (WebException ex)
         { exceptionHandlers.HandleWebException(ex); }
         catch (Exception ex)
         { exceptionHandlers.HandleException(ex); }
         { exceptionHandlers.ResetConsole(); }

   class TimeSheetUtils
      public TimeSheetUtils()

      // Get a list of timesheets that were created by the user and that are in progress.
      public TimeSheetWebSvc.TimesheetListDataSet GetMyTimeSheetsInProgress(
          TimeSheetWebSvc.TimeSheet timesheet,
          ResourceWebSvc.Resource resource,
          DateTime startDate,
          DateTime finishDate,
         out Guid resUid)
         int select = Convert.ToInt32(
                       | PSLibrary.TimesheetEnum.ListSelect.InProgress);

         resUid = resource.GetCurrentUserUid();
         return timesheet.ReadTimesheetList(resUid, startDate, finishDate, select);

   class ExceptionHandlers
      public ExceptionHandlers()

      public void HandleSoapException(SoapException ex)
         PSLibrary.PSClientError error = new PSLibrary.PSClientError(ex);
         PSLibrary.PSErrorInfo[] errors = error.GetAllErrors();
         string errMess = "==============================\r\nError: \r\n";
         for (int i = 0; i < errors.Length; i++)
            errMess += "\n" + ex.Message.ToString() + "\r\n";
            errMess += "".PadRight(30, '=') + "\r\nPSCLientError Output:\r\n \r\n";
            errMess += errors[i].ErrId.ToString() + "\n";

            for (int j = 0; j < errors[i].ErrorAttributes.Length; j++)
               errMess += "\r\n\t" + errors[i].ErrorAttributeNames()[j] + ": "
                  + errors[i].ErrorAttributes[j];
            errMess += "\r\n".PadRight(30, '=');
         Console.ForegroundColor = ConsoleColor.Red;

      public void HandleWebException(WebException ex)
         string errMess = ex.Message.ToString() +
            "\n\nLog on, or check the Project Server Queuing Service";
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Error: " + errMess);

      public void HandleException(Exception ex)
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Error: " + ex.Message);

      public void ResetConsole()
         Console.WriteLine("\r\n\r\nPress any key...");