Share this page

# searchTimeSheets

## Purpose

Search for a list of time sheets in PPM Center by using specific criteria.

Note: This operation supports the Day in Days option and Period in Days option, which were introduced since PPM Center version 8.00 Service Pack 1. For more information, see the Time Sheet Update Service section in Project and Portfolio Management Center Version 8.00.01 (Service Pack 1) Release Notes.

## Function

This operation searches for time sheets, according to the search criteria.

The user performing this operation must have the Time Mgmt: View Time Sheets access grant.

## Input

TimeSheetSearchCriteriaBean

## Return

A list of String values of the time sheet IDs.

## Limitation

The maximum number of results cannot exceed 1,000.

## Java Interface

`SearchTimeSheetsResponseDocument searchTimeSheets(SearchTimeSheetsDocument in)`

Parameters | Description
--- | ---
SearchTimeSheetsDocument | Wrapper for TimeSheetSearchCriteriaBean. See the following example for the construction. The criteria bean includes the following fields: Long periodTypeId; Long periodId; Long previousTimePeriodsCount; List resourceIdList; // list of Long resource ids String descriptionKeywords; List statusList; // list of Long, statuses from model.TimeSheet List managerIdList; // list of Long user ids List orgUnitIdList; // list of Long orgUnit ids
SearchTimeSheetsResponseDocument | Wrapper for an array of long values, each holding a time sheet ID. See the following example for retrieving the array.

## Java Examples

Example: search for time sheets.

    public void testSearchTimeSheets() {
            System.out.println("testSearchTimeSheets started ...");
            try {
                TimeServiceStub stub = new TimeServiceStub(ctx,
    WSURL);
                SearchTimeSheetsDocument searchTimeSheetsDocument =
    SearchTimeSheetsDocument.Factory.newInstance();
                TimeSheetSearchCriteriaBean
    timeSheetSearchCriteriaBean =
    searchTimeSheetsDocument.addNewSearchTimeSheets().addNewSearchC
    riteriaBean();

    timeSheetSearchCriteriaBean.setPeriodTypeId(tmPeriod.getPeriodT
    ypeId().longValue());

    timeSheetSearchCriteriaBean.setPeriodId(tmPeriod.getPeriodId().
    longValue());

    timeSheetSearchCriteriaBean.setPreviousTimePeriodsCount(10);

    timeSheetSearchCriteriaBean.setResourceIdListArray(new
    long[]{1}); // list of Long resource ids // admin

    timeSheetSearchCriteriaBean.setDescriptionKeywords("description
    ");
               timeSheetSearchCriteriaBean.setStatusListArray(new
    long[]{1});// TimeSheet.STATUS_UNSUBMITTED from model.TimeSheet
               SearchTimeSheetsResponseDocument response =
    stub.searchTimeSheets(searchTimeSheetsDocument);
               long[] returnArray =
    response.getSearchTimeSheetsResponse().getTimeSheetIdArray();

               System.out.println("Time Sheet search brought " +
    returnArray.length + " results");
           }
           catch(Exception e) {
               e.printStackTrace();
           }
           System.out.println("testSearchTimeSheets completed");
        }

## Errors and Exceptions

N/A

https://admhelp.microfocus.com PPM 8942
Tips to improve your search results... OpenText™ Project and Portfolio Management Help Center PPM Help 26.2-26.3 All View Local Help Center View Online Help Center Version: