Admin.ReadTimeSheetSettings Method

Reads the current settings for timesheets.

Namespace:  [Admin Web service]
Service reference: http://ServerName:32843/[Project Service Application GUID]/PSI/Admin.svc
Web service reference: http://ServerName/ProjectServerName/_vti_bin/PSI/Admin.asmx?wsdl

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Admin/ReadTimeSheetSettings", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Admin/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Admin/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadTimeSheetSettings As TimeSheetSettingsDataSet
'Usage
Dim instance As Admin
Dim returnValue As TimeSheetSettingsDataSet

returnValue = instance.ReadTimeSheetSettings()
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Admin/ReadTimeSheetSettings", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Admin/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Admin/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public TimeSheetSettingsDataSet ReadTimeSheetSettings()

Return Value

Type: [Admin Web service].TimeSheetSettingsDataSet
Contains the current timesheet settings.

Remarks

Note

On a Project Web App site that is created from an upgrade of a site from Microsoft Office Project Server 2007, if you query for WADMIN_TS_PROJECT_MANAGER_COORDINATION in the returned TimeSheetSettingsDataSet, you get a System.InvalidCastException. The field value is DBNull, so the application cannot cast to a Boolean value.

Timesheet settings can be set on the Timesheet Settings and Defaults page in Project Web App (http:///ServerName/ProjectServerName/_layouts/pwa/Admin/TSSettings.aspx).

Project Server Permissions

Permission

Description

LogOn

Allows a user to log on to Project Server. Global permission.

Examples

The following example uses the SvcAdmin namespace in the ProjectServerServices.dll proxy assembly. The ConfigClientEndpoints method use an app.config file for setting the WCF binding, behavior, and endpoint. For information about creating a PSI proxy assembly and an app.config file, see Prerequisites for WCF-Based Code Samples.

If the WADMIN_TS_PROJECT_MANAGER_COORDINATION value is DBNull, applications should treat the value as False. In the example, the GetPMCoordination method uses Convert.IsDBNull to check the value of WADMIN_TS_PROJECT_MANAGER_COORDINATION.

using System;
using System.Text;

namespace Microsoft.SDK.Project.Samples.ReadTimeSheetSettings
{
    class Program
    {
        private const string ENDPOINT = "basicHttp_Admin";
        private const string OUTPUT_FILES = @"C:\Project\Samples\Output\";

        private static SvcAdmin.AdminClient adminClient;
        private static string outFilePath;
 
        static void Main(string[] args)
        {
            outFilePath = OUTPUT_FILES + "TimesheetSettings.xml";
            ConfigClientEndpoints(ENDPOINT);

            Console.WriteLine("Retrieving the timesheet settings...");
            SvcAdmin.TimeSheetSettingsDataSet timesheetSettingsDs =
                new SvcAdmin.TimeSheetSettingsDataSet();

            timesheetSettingsDs = adminClient.ReadTimeSheetSettings();

            if (GetPMCoordination(timesheetSettingsDs))
                Console.WriteLine(
                    "\nProject managers can view timesheet line item approvals.");
            else
               Console.WriteLine(
                   "\nProject managers cannot view timesheet line item approvals.");

            timesheetSettingsDs.WriteXml(outFilePath);

            Console.WriteLine("\nSee XML output of the TimeSheetSettingsDataSet at:\n\t{0}",
                outFilePath);
            Console.Write("\nPress any key to exit... ");
            Console.ReadKey(true);
        }

        private static bool GetPMCoordination(SvcAdmin.TimeSheetSettingsDataSet tsSettings)
        {
            bool pmCoord = false;

            // Check whether WADMIN_TS_PROJECT_MANAGER_COORDINATION is DBNull, which can occur
            // in upgrades from Project Server 2007 to Project Server 2010.
            // If so, treat the value as false.
            if (!Convert.IsDBNull(
                tsSettings.TimeSheetSettings[0].WADMIN_TS_PROJECT_MANAGER_COORDINATION))
            {    
                pmCoord = true;
            }
            return pmCoord;
        }

        // Use the endpoints that are defined in app.config to configure the client.
        public static void ConfigClientEndpoints(string endpt)
        {
            adminClient = new SvcAdmin.AdminClient(endpt);
        }
    }
}

Following is an example of the TimesheetSettings.xml file that the application saves.

<?xml version="1.0" standalone="yes"?>
<TimeSheetSettingsDataSet xmlns="https://schemas.microsoft.com/office/project/server/webservices/TimeSheetSettingsDataSet/">
  <TimeSheetSettings>
    <WADMIN_UIDFAKE>446855fe-d085-4ba0-8006-9fce73e9c9fb</WADMIN_UIDFAKE>
    <WADMIN_TS_IS_UNVERS_TASK_ALLOWED>true</WADMIN_TS_IS_UNVERS_TASK_ALLOWED>
    <WADMIN_TS_PROJECT_MANAGER_COORDINATION>true</WADMIN_TS_PROJECT_MANAGER_COORDINATION>
    <WADMIN_TS_PROJECT_MANAGER_APPROVAL>false</WADMIN_TS_PROJECT_MANAGER_APPROVAL>
    <WADMIN_TS_IS_AUDIT_ENABLED>false</WADMIN_TS_IS_AUDIT_ENABLED>
    <WADMIN_TS_IS_FUTURE_REP_ALLOWED>true</WADMIN_TS_IS_FUTURE_REP_ALLOWED>
    <WADMIN_TS_FIXED_APPROVAL_ROUTING>false</WADMIN_TS_FIXED_APPROVAL_ROUTING>
    <WADMIN_TS_TIED_MODE>true</WADMIN_TS_TIED_MODE>
    <WADMIN_TS_MIN_HR_PER_TS>0.000000</WADMIN_TS_MIN_HR_PER_TS>
    <WADMIN_TS_MAX_HR_PER_TS>59940000.000000</WADMIN_TS_MAX_HR_PER_TS>
    <WADMIN_TS_MAX_HR_PER_DAY>59940000.000000</WADMIN_TS_MAX_HR_PER_DAY>
    <WADMIN_TS_HOURS_PER_DAY>480000.000000</WADMIN_TS_HOURS_PER_DAY>
    <WADMIN_TS_HOURS_PER_WEEK>2400000.000000</WADMIN_TS_HOURS_PER_WEEK>
    <WADMIN_TS_DEF_DISPLAY_ENUM>7</WADMIN_TS_DEF_DISPLAY_ENUM>
    <WADMIN_TS_CREATE_MODE_ENUM>1</WADMIN_TS_CREATE_MODE_ENUM>
    <WADMIN_TS_REPORT_UNIT_ENUM>0</WADMIN_TS_REPORT_UNIT_ENUM>
    <WADMIN_TS_DEF_ENTRY_MODE_ENUM>0</WADMIN_TS_DEF_ENTRY_MODE_ENUM>
    <WADMIN_DEFAULT_TRACKING_METHOD>1</WADMIN_DEFAULT_TRACKING_METHOD>
    <WADMIN_IS_TRACKING_METHOD_LOCKED>true</WADMIN_IS_TRACKING_METHOD_LOCKED>
    <WADMIN_TS_ALLOW_PROJECT_LEVEL>true</WADMIN_TS_ALLOW_PROJECT_LEVEL>
  </TimeSheetSettings>
</TimeSheetSettingsDataSet>

See Also

Reference

Admin Class

Admin Members

Admin Web Service