Automating Timesheet Import

B

Bill Busby

We're having trouble with a piece of code that, if successful, will be used
to set a trigger on the submit event of a timesheet to automate the import of
the timesheet data into the project tasks. The code below is very rough poc
code that we're running as an application and is only a segment that
demonstrates the calls made to do the import. We don't get any error codes
but the import doesn't happen. Does anyone have any insight on coding this
process? We're clearly missing something but the documentation is rather
sparse on some of these calls.

Dim timesheet As New TimesheetWebSrv.TimeSheet
Dim resource As New ResourceWebSrv.Resource
Dim adminsvc As New AdminWebSvr.Admin
Dim statusingSvc As New StatusingWebSrv.Statusing
resource.Url = PROJECT_SERVER_URI & RESOURCE_SERVICE_PATH
resource.UseDefaultCredentials = True
timesheet.Url = PROJECT_SERVER_URI & TIMESHEET_SERVICE_PATH
timesheet.UseDefaultCredentials = True
adminsvc.Url = PROJECT_SERVER_URI & ADMIN_SERVICE_PATH
adminsvc.UseDefaultCredentials = True
statusingSvc.Url = PROJECT_SERVER_URI + STATUSING_SERVICE_PATH
statusingSvc.UseDefaultCredentials = True

Dim tsUID As New Guid("70ce58c2-fedf-4a60-a837-fc842396ee20")
Dim timesheetDS As TimesheetDataSet = timesheet.ReadTimesheet(tsUID)
'Dim headerrow As TimesheetDataSet.HeadersRow
'MsgBox(timesheetDS.Headers(0).WPRD_UID.ToString)

'headerrow.WPRD_UID
'MsgBox(timesheetDS.HeadersRow("WPRD_UID"))
Dim chadguid As New Guid("63834d01-68ce-47dd-93fd-d6662ddfb3e5")
'timesheetds.Headers.
'timesheetDS.Headers.per()
Dim importTimeSheetDS As StatusingWebSrv.ImportTimesheetDataSet =
statusingSvc.ReadImportTimesheetData(timesheetDS.Headers(0).WPRD_UID)

'Dim asdfasdf
statusingSvc.ImportTimesheet(timesheetDS.Headers(0).WPRD_UID)

MsgBox("wait")

Label1.Text = "Updated on " & Now()
 
D

Dale Howard [MVP]

Bill --

I would recommend you post this question in the
microsoft.public.project.developer newsgroup, as you are more like to get an
answer there. Hope this helps.
 
K

Kyle Reese

You are close in your code. You need a statusing update to mimic the "save
and submit" button on the my tasks page. Note that call below does this for
all assignments if you need only select ones replace the null parameter to
SubmitStatus with a array of update guids.

Samples.PSI.DevTimesheet.TimesheetDataSet tsDS =
timeSheet.ReadTimesheet(tsListDS.Timesheets.TS_UID);
Samples.PSI.DevStatusing.ImportTimesheetDataSet importDS =
statusing.ReadImportTimesheetData(tsDS.Headers[0].WPRD_UID);

statusing.ImportTimesheet(tsDS.Headers[0].WPRD_UID);
// A null value for updateAssignments array of GUIDs submits all changed
assignments.
statusing.SubmitStatus(null, "TimeSheet imported via Automated Process @" +
DateTime.Now.ToLongDateString());
 
B

bchild

Kyle,

We are trying to get a similiar process to occur but would like to do it via
an event handler. We are having issues importing the current timesheet
information for the update string. Is there any good documentation/examples
of this?

-Brian
 
G

Guest

A new piece of code is now available to automate the 'import timesheet
process'.
check this out:
http://blogs.msdn.com/project_progr.../16/tied-mode-between-timesheet-my-tasks.aspx
- Michael

bchild said:
Kyle,

We are trying to get a similiar process to occur but would like to do it
via
an event handler. We are having issues importing the current timesheet
information for the update string. Is there any good
documentation/examples
of this?

-Brian

Kyle Reese said:
You are close in your code. You need a statusing update to mimic the
"save
and submit" button on the my tasks page. Note that call below does this
for
all assignments if you need only select ones replace the null parameter
to
SubmitStatus with a array of update guids.

Samples.PSI.DevTimesheet.TimesheetDataSet tsDS =
timeSheet.ReadTimesheet(tsListDS.Timesheets.TS_UID);
Samples.PSI.DevStatusing.ImportTimesheetDataSet importDS =
statusing.ReadImportTimesheetData(tsDS.Headers[0].WPRD_UID);

statusing.ImportTimesheet(tsDS.Headers[0].WPRD_UID);
// A null value for updateAssignments array of GUIDs submits all changed
assignments.
statusing.SubmitStatus(null, "TimeSheet imported via Automated Process @"
+
DateTime.Now.ToLongDateString());
 
B

bchild

Michael,

Thank you very much! I will try and give feedback were applicable.



A new piece of code is now available to automate the 'import timesheet
process'.
check this out:
http://blogs.msdn.com/project_progr.../16/tied-mode-between-timesheet-my-tasks.aspx
- Michael

bchild said:
Kyle,

We are trying to get a similiar process to occur but would like to do it
via
an event handler. We are having issues importing the current timesheet
information for the update string. Is there any good
documentation/examples
of this?

-Brian

Kyle Reese said:
You are close in your code. You need a statusing update to mimic the
"save
and submit" button on the my tasks page. Note that call below does this
for
all assignments if you need only select ones replace the null parameter
to
SubmitStatus with a array of update guids.

Samples.PSI.DevTimesheet.TimesheetDataSet tsDS =
timeSheet.ReadTimesheet(tsListDS.Timesheets.TS_UID);
Samples.PSI.DevStatusing.ImportTimesheetDataSet importDS =
statusing.ReadImportTimesheetData(tsDS.Headers[0].WPRD_UID);

statusing.ImportTimesheet(tsDS.Headers[0].WPRD_UID);
// A null value for updateAssignments array of GUIDs submits all changed
assignments.
statusing.SubmitStatus(null, "TimeSheet imported via Automated Process @"
+
DateTime.Now.ToLongDateString());

 
Joined
May 1, 2012
Messages
6
Reaction score
0
Hello Michael & Kyle,

Problem :

In the PWA browser application, I choose "My Tasks", then the "Import timesheet" button. A drop-down list of timesheets appears.

Is there any way to get the drop down list of timesheets to be imported to be a little more sensible?

The timesheets appear in no particular order, and include timesheets which have already been imported. This seems to mean that the list will keep growing, and it will be extremely difficult to locate timesheets which need to be imported. Is there a way of ensuring that the list by default appears in one or more of the following formats:
a) Sorted by date (preferably showing the latest first)
b) Showing only those which have not yet been imported.
c) As a less acceptable alternative to (b) above, showing only "recent" ones (say in the last 4-5 weeks)

Also, if I make a mistake and import a timesheet more than once, is any harm done?

Please let me know the solution for how the trigger works and to automates the import of
the timesheet data into the project tasks.

Please clarify the functionality and the stored procedures applicable for the same.

Also, I need the steps for how to register that trigger to accomplish the task and resolve the issue.

I am very pleased, if you can guide me to the resolution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top