Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

TimePeriods\TimeSheet\TimeSheetLine\TimeSheetActuals Creation through the PSI Help ...

$
0
0

Hi, my Third Party Product is uploading TimeSheets to Project Server 2010.  I thought I had my head around it but I don't think I do.

1.  First I check if a Time Period is already there and I get the Guid of the Period (adminClient.ReadPeriods(SvcAdmin.PeriodState.Open)) - [WPRD_UID]

2.1.   Then I read TimeSheets by Period\Resource to get the TS_UID (timesheetClient.ReadTimesheetByPeriod(impersonatedUserUid, PeriodUid, SvcTimeSheet.Navigation.Current)) - [TS_UID]

2.2.   I'll then create the TimeSheet (header) if it doesn't Exist:  timesheetClient.CreateTimesheet(timesheetDs, SvcTimeSheet.PreloadType.All)

3.1    Then I make sure a TimeSheetLine isn't already created by looping through the DataSet.Lines in Step 2.

Dim bolTimeSheetLineFound = False
For Each TSL_Row As SvcTimeSheet.TimesheetDataSet.LinesRow In timesheetDs.Lines
    If TSL_Row.TASK_UID = TaskUid And TSL_Row.PROJ_UID = ProjUid Then
        bolTimeSheetLineFound = True
        TimeSheetLineUid = TSL_Row.TS_LINE_UID
    End If
Next

I'll add the Line if it doesn't Exist: timesheetDs.Lines.AddLinesRow(line)

4. At this point I always create the Actuals: timesheetDs.Actuals.AddActualsRow(actuals_line)

5. Then I'll run this code:

timesheetClient.PrepareTimesheetLine(TimeSheetUid, timesheetDs, New Guid() {TimeSheetLineUid})
jobUid = Guid.NewGuid()
timesheetClient.QueueUpdateTimesheet(jobUid, TimeSheetUid, timesheetDs)
WaitForQueue(queuesystemClient, jobUid)

Please note I may be doing something wrong or missing steps above, can anyone see what i'm missing?

PROBLEMS:

1. So on the Line i'm setting the TASK_UID which is ok.  But when I set PROJ_UID, the PSI ignores my value and puts in some random Guid that I can't find in the database. Why?

2. So when I add multiple actuals it ignores what I just added if a record is already there.  What are the Rules with Lines and Actuals? I know when you try and add a Line already there you get this error:

ProjectServerError(s) LastError=GeneralObjectAlreadyExists Instructions: Pass this into PSClientError constructor to access all error information"

Any help would be appreciated or if anyone knows of a good PSI Book that I can get.


Todd Klost


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>