Retrieving assignments' detailed segments in Project Server 2007

A

AVfromItaly

Hi.
In Project Server 2007, is there a way to retrieve (via PSI web services or
with other techniques) the actual content of the "segments" for a specific
task assignment?
I need to retrieve exactly the work hours entered by a user (=resource) in
the grid of the PWA2007 "MyTasks" page, in order to propagate them to other
external systems.
I saw how the PrjTool SDK sample retrieves assignments from the Published
database, but it just accesses to the "total" work for each assignment, not
the detailed day-by-day splits of the work hours.
It seems these splits (or "segments") are stored (in a binary form) in the
ASSN_CONTOUR_DATA of the MSP_ASSIGNMENTS_SAVED in the ProjectServer_Published
database; but I wasn't able to find a way to retrieve them in a "clear" way,
through an "elegant" interface, instead of accessing directly to the database
(where I anyway should need an algorithm to interpret them).
An alternative path I'm trying to walk is to hook (with a custom event
handler) the Statusing/StatusUpdated event, but of course this way I can
obtain (in the ChangeXML eventarg) only the work hours just modified by the
user; in other words, I'm retrieving just a "delta" of work hours, containing
only the modified segments of the edited assignments, while I'd like to
retrieve all the segments for a given assignment.

Thank you in advance for your valuable help.
AV
 
A

AVfromItaly

Further investigation, made me discover that ASSN_CONTOUR_DATA field is
retrieved by the Statusing PSI web service.
So, my question becomes: is there a way to interpret the byte array returned
by this ASSN_CONTOUR_DATA field in order to understand the work segments in a
specific assignment?
AV
 
S

Stephen Sanderlin

I've been unable to find a way to do this without using reflection to
invoke some internal classes present in the
Microsoft.Office.Project.SvrDataEdit namespace in the
Microsoft.Office.Project.Server.dll assembly.

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com
 
A

AVfromItaly

Stephen,

I also tried to understand the internals of those assembly using Reflector,
and I found the useful GetActualWorkContour method in the
Microsoft.Office.Project.DataEdit.Util.ByteArrayConvert class: I used it to
create a VB.NET function able to interpret the binary content of
ASSN_CONTOUR_DATA field, using code like this:

Imports System
Imports Microsoft.Office.Project
Imports Microsoft.Office.Project.Library

Public Function GetActualWorkContour(ByVal bytes As ByteArray) As String
Dim Segments As String = ""
Dim NumeroSegmenti As UInt16 = bytes.GetUInt16FromOffset(0)
Dim OffsetIniziale As UInt16 = bytes.GetUInt16FromOffset(4)
If (NumeroSegmenti <> 0) Then
Dim offset As Integer = OffsetIniziale
Dim offsetShift As Integer = 20
Dim DurationACCprec As UInt32 = 0
Dim WorkHoursACCprec As Double = 0

Dim i As Integer
For i = 0 To NumeroSegmenti - 1
Dim WorkHoursACC As Double = bytes.GetDoubleFromOffset(offset)
Dim DurationACC As UInt32 = bytes.GetUInt32FromOffset((offset + 16))
Dim WorkHours As Double = (WorkHoursACC - WorkHoursACCprec)
Dim Duration As UInt32 = (DurationACC - DurationACCprec)

Segments &= DurationACCprec & " - Segment: " & (Duration / 8) & ", "
& (WorkHours / 60000) & "h" & vbCrLf
WorkHoursACCprec = WorkHoursACC
DurationACCprec = DurationACC
offset = offset + offsetShift
Next i
End If
Return Segments
End Function

In this way, I understood the way hte various "segments" of work hours in
consecutive days are stored, but still I can't interpret the way overtime
work (or weekends?) are managed.
Told that I hate to use reverse-engineering methods to overcome the lack of
documentation, I'm getting quite sad because the solution is still far.

Maybe the classes you found are on a better path to the solution.
Do you have some more specific indication, or could you drop some lines of
code?

Thank you in advance.
AV
 
S

Stephen Sanderlin

I would very strongly advise against implementing your own classes using
insights gained using Reflector. If anything, you should use the native
objects that exist through Reflection, but even this is a very gray
area.



If you sign up for the EPMFAQ Forums and send me a PM (my name is
ssanderlin), I'll be happy to discuss it with you further.

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com
 
A

AVfromItaly

I strongly agree with you about your opinion on using Reflector to understand
things and consequently develop code. In fact I'm trying to follow the
alternative path (suggested by lots of people I heard) of implementing the
TimeSheet feature to load and compute worked hours. My only fear is about the
risk of adding complexity for the final user (need to create TimeSheets, need
to import them on tasks, and so on)...
It would be so easier to act directly on tasks! I see in this area a big
lack of vision from who designed the Project Server 2007 behavior.
The funny thing is that in PWA2003 the data model on assignments and work
hours was more and more understandable and usable! In this area, 2007 is a
step backward for me.

Anyway, thank you very much for this exchange of opinions and informations.
Best regards, AV
 
S

Stephen Sanderlin

Yeah. TimeSheets are fine, assuming that they exist and are correct. It
would be best, in some cases, to be able to get the Task Update info.
I'm in the same boat as you on this :eek:)



However, with the combination of the IU and the PseudoTiedMode CodePlex
solution, you may have another option.

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com
 

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