Partager via


Admin.ReadTimeSheetSettings - Méthode

Lit les paramètres actuels de feuilles de temps.

Espace de noms :  WebSvcAdmin
Assembly :  ProjectServerServices (dans ProjectServerServices.dll)

Syntaxe

'Déclaration
<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
'Utilisation
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()

Valeur renvoyée

Type : WebSvcAdmin.TimeSheetSettingsDataSet
Contient les paramètres actuels de la feuille de temps.

Remarques

Notes

Sur un Project Web App de sites qui est créé à partir d'une mise à niveau d'un site à partir de Microsoft Office Project Server 2007, si vous interrogez pour WADMIN_TS_PROJECT_MANAGER_COORDINATION dans le renvoyé TimeSheetSettingsDataSet, vous obtenez un System.InvalidCastException. La valeur du champ est DBNull, de sorte que l'application ne peut pas effectuer un cast sur une valeur Boolean .

Paramètres de la feuille de temps peuvent être définis dans la page Paramètres de la feuille de temps et les valeurs par défaut dans Project Web App (http:///ServerName/ProjectServerName/_layouts/pwa/Admin/TSSettings.aspx).

Autorisations Project Server

Autorisation

Description

LogOn

Permet à un utilisateur de se connecter à Project Server. Autorisation globale.

Exemples

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.

Si la valeur de WADMIN_TS_PROJECT_MANAGER_COORDINATION est DBNull, les applications doivent traiter la valeur comme False. Dans l'exemple, la méthode GetPMCoordination utilise Convert.IsDBNull pour vérifier la valeur de 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);
        }
    }
}

Voici un exemple du fichier TimesheetSettings.xml qui enregistre l'application.

<?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>

Voir aussi

Référence

Admin classe

Admin - Membres

WebSvcAdmin - Espace de noms