Admin.ReadTimeSheetSettings 方法
读取时间表的当前设置。
命名空间: WebSvcAdmin
程序集: ProjectServerServices(位于 ProjectServerServices.dll 中)
语法
声明
<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
用法
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()
返回值
类型:WebSvcAdmin.TimeSheetSettingsDataSet
包含当前的时间表设置。
备注
备注
在Project Web App网站即如果查询中返回TimeSheetSettingsDataSetWADMIN_TS_PROJECT_MANAGER_COORDINATION的创建从网站从Microsoft Office Project Server 2007,升级,您获取System.InvalidCastException。字段值是DBNull,因此应用程序不能转换为Boolean值。
时间表设置可以设置在Project Web App (http:///ServerName/ProjectServerName/_layouts/pwa/Admin/TSSettings.aspx) 的时间表设置值和默认值页上。
Project Server 权限
权限 |
说明 |
---|---|
允许用户登录到 Project Server。全局权限。 |
示例
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 Project 2013 中基于 WCF 的代码示例的先决条件.
如果WADMIN_TS_PROJECT_MANAGER_COORDINATION值DBNull,则应用程序应将值视为False。在示例中, GetPMCoordination方法使用Convert.IsDBNull检查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);
}
}
}
下面是应用程序保存 TimesheetSettings.xml 文件的示例。
<?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>