如何创建没有预先填充的时间表? [英] How to create a Timesheet with NO pre-population?
本文介绍了如何创建没有预先填充的时间表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个空的时间表。 但是,下面的代码会创建一个预先填充的时间表 - 尽管"无"表示"无"。 CreateTimesheet方法中的参数。
I want to create an empty timesheet. However this code below creates a pre-populated timesheet - despite the "None" parameter in the CreateTimesheet method.
private SvcTimeSheet.TimesheetDataSet CreateNewTimesheet(Guid resUID, Guid periodUID)
{
//step 1: get the resource UID
//step 2: create the timesheet for the period passed in
SvcTimeSheet.TimeSheetClient tsClient = new SvcTimeSheet.TimeSheetClient();
SvcTimeSheet.TimesheetDataSet tsDS = new SvcTimeSheet.TimesheetDataSet();
SvcTimeSheet.TimesheetDataSet.HeadersRow headersRow = tsDS.Headers.NewHeadersRow();
headersRow.RES_UID = resUID; // cant be null.
headersRow.TS_UID = Guid.NewGuid();
headersRow.WPRD_UID = periodUID;
headersRow.TS_NAME = "Timesheet ";
headersRow.TS_COMMENTS = "Timesheet created via code while sleeping";
headersRow.TS_ENTRY_MODE_ENUM = (byte) Microsoft.Office.Project.Server.Library.TimesheetEnum.EntryMode.Daily;
tsDS.Headers.AddHeadersRow(headersRow);
Guid tsuid = headersRow.TS_UID;
tsClient.CreateTimesheet(tsDS, SvcTimeSheet.PreloadType.None); // Note the NONE parameter
SvcTimeSheet.TimesheetDataSet _tsDS = tsClient.ReadTimesheet(tsuid); // strangely this returns a pre-populated timesheet
return _tsDS;
}
提前致谢。
Thanks in advance.
推荐答案
不确定这是否适合您,但值得快速尝试,您是否检查过"服务器设置"中的"默认时间表创建模式"设置为"无",以防万一覆盖你的代码?
not sure if this is the answer for you but worth a quick try, have you checked that Default Timesheet Creation Mode in Server Settings is set to None, in case this is overriding your code?
这篇关于如何创建没有预先填充的时间表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文