We help IT Professionals succeed at work.

Programatic publishing of task resource assignment & enterprise resource calendar updation

Medium Priority
Last Modified: 2013-11-15

I am using Project Server 2003 and I am facing some problem when I am doing following 2 set of operations programatically ..

Set 1 -
1. Task creation - PDS is available
2. Task assignment to a resource - PDS is available
3. Publishing task resource assignment - PDS is available (same as above with autopublish option set to 1) but it is not working.
4. Filling Timesheet - PDS is available

Set 2 -
1. Enterprise resource calendar updation - PDS is not available.

Please help with
Set 1 - 3. Publishing task resource assignment
Set 2 - 1. Enterprise resource calendar updation

Thanks in advance

Watch Question

1) When the autopublish  do not work - open incident on Premier Support  -in case that this is  MS Project bug incident will be refunded.

2) You probably don't know how to use Administrative Projects :)  

What now, i didn't ansvered your question but i belive that I solved your problem.

I think you may do that using XML and interfacing with PDS.

About the calendars i've done a program to publish the resources calendar and set the non-working days.


Can you please share with me your program. It is one of our urgent requirement for which we don't have answer.

I can't share my program because it belongs to the company. However i can show you the major steps and by this you can implement your own program, ok?

First I have web based application where I collect all the resources non-working days (e.g vacances) and i store them in a SQL Server table.

Next i build an application to execute an publish that non-working days to the resources calendar. This application have been made in VB 6.0 Standard EXE.

First I check if there is an open WINPROJ.exe process, if it exists, I abort my application, else I open my new instance of ProjectServer and keep its handler (check startMSProject function bellow, i really don't remenber but i think that this function was based in some code provided in Microsoft's website) .

MAIN : part of application

'Get the handler of Microsoft Project's Application
    StartMSProject 'Function created to start Microsoft Project
    Set prj = GetObject(, "Msproject.Application")
    prj.FileClose pjDoNotSave

    'if Microsoft Project started without problems...
    If Not prj Is Nothing Then
       maxprojid='get the max proj_id in msp_projects table
       VacationMaps= 'get all the vacations maps that are already approved (business rule ;) )
        Do While Not VacationMaps.EOF
            'now from this resources that have their map approved, check the ones that already have non working day in
            'project server and delete those days
            'Open the actual user pool
            prj.EnterpriseResourcesOpen RSTarefas("utl_cod")
            ssql = "select * from msp_view_res_tp_by_day where ResourceUniqueID=" & VacationMaps("UTL_COD") & " and year(ResourceTimeStart)=" & VacationMaps("MAPA_ANO") & " and ResourceTimeWorkAvailability is null"
            NewRecordSet.Open ssql, conProj
            Set NewRecordSet2= New ADODB.Recordset
            Do While Not NewRecordSet.EOF
                If Weekday(NewRecordSet("ResourceTimeStart")) <> 1 And NewRecordSet(RSProject("ResourceTimeStart")) <> 7 Then
                    'if it isn't weekend ...
                    'check if its holliday
                    ssql = "select cd_from_date from dbo.MSP_CALENDAR_DATA where cal_uid=3 and cd_working=0 and cd_day_or_exception=0 and year(cd_from_date)=" & Year(NewRecordSet("ResourceTimeStart")) & " and month(cd_from_date)=" & Month(NewRecordSet("ResourceTimeStart")) & " and day(cd_from_date)=" & Day(NewRecordSet("ResourceTimeStart")) & " and proj_id=" & maxprojid
                    RSProject2.Open ssql, conProj
                    If RSProject2.EOF Then
                        'if isn't a holliday, then delete that day from the resource nonworking day
                        prj.ResourceCalendarEditDays "Checked-out Enterprise Resources", RTrim(VacationMaps("utl_nome")), NewRecordSet("ResourceTimeStart"), NewRecordSet("ResourceTimeFinish"), , , True
                    End If
                End If

            'Now i will add all the nonworking days to project server
             RSVacations2 = 'Get from database all the vacations days that are approved
             If Not RSVacations2 .EOF Then
                      Do While Not RSVacations2 .EOF
                              prj.ResourceCalendarEditDays "Checked-out Enterprise Resources", RTrim(RSVacations("utl_nome")), RSVacations2("DIA_DATA"), RSVacations2("DIA_DATA"), , False, False
             End If
             Set RSVacations2= Nothing
             'save the application Resource Pool

Function StartMSProject()
Set p = GetObject(, "MSProject.Application")
' Determine whether Project is already running.
If Not p Is Nothing Then
   b = True
End If

'If Project is running, shut down Project.
If b Then
   StartMSProject = Null
   Exit Function
End If

'logon parameters for Project Server
sServer = "http://#Your Server Address#/projectserver"
sServerUser = "#Administrator Login#"
sServerPass = "#Administrator Password#"
sServerString = "winproj.exe /s """ & sServer & """ /u """ & sServerUser & """ /p """ & sServerPass & """"

'Start Project. If you want to start with a Windows logon, remove the /u and /p parameters
'from the ServerString
Shell sServerString

'At this point, fail to an error handler if the application object cannot be created.
'This behavior occurs because the Shell function does not "wait" for the application to start; the code continues
'to execute. Because Project may be busy logging on, the following Set statement may fail. This
'artificial 'loop' gives Project time to finish the logon process.
t = Timer + 60 ' get the current time + 60 seconds
Sleep 60000 'Wait 60 seconds to give Project to finish the logon process.

'get object to project for automation
Set p = GetObject(, "Msproject.Application")
If p Is Nothing Then
   'An Error as Occured... Terminate this function
   Exit Function
End If

End Function

Sorry but this is the best I can do!! I hope it solves your problem! Tell me later if it works!

Set 2 - 1. Enterprise resource calendar updation
It's nice code but you are performing those tasks fromProject Proffesional - and it's problem.

I take ower many MS Project implementationw when competitors failed :)  I noticed that when the there is request to modify resource  calendars customer  approach is ussualy wrong.
90% the customers need  to modify enteprise resource calendard because the people are on vacancy, sick etc.  and  they dont know haw to use  Administrative projects!!

Create te new administrative project create same basic tasks vacancy, sick leave, training ect. and assign all resources from enterprise or same department  to each task.  Information about administrative projects are in documentation.

Set 1 - 3. Publishing task resource assignment

This task can be performed only from Project Proffesional  - It's really difficult to work with Projet Pro on server. You can do it in same night job.
or add event handler to the Enterprice global which publish all resource assignment when the user save project.

GROSSO:Why did you wrote that code? it was same special case which can't be solved by ADM template ?
winzig: It was a special case I need a special workflow to approve the non-working days. I also have tried the Administrative Projects to manage the non-working but there was a some problems about the assignments to the projects, the project plans wasn’t affected… By this way all the resources that are assigned to projects, have their tasks changed according with their non-working time. (Have I done something wrong?)

I'm developing an intranet application that already has several years, for project management and allows users to report several activities that aren't related with PServer. This web application have its own database and when are created projects, users, etc, it communicates with PServer by PDS. This application allows having several templates for the project plans based in the project type. Basically we only use the functionalities of Project Professional and Project Server to create and manage the project plans.

Now I’m preparing specifications for a new intranet in J2EE that is independent of the EPM (e.g. RPM, PS2007, PS2003) that the organization uses and will be based on SOA. I’m expecting a lot of difficulties, but I think that will be just perfect!

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
cgrosso:The task isn't affected but you will see that  resource is overloaded.

it sound like nice implementation: Our ussual mps implementation is project centric for PMO.  But this year have 2 implementations s where  the projects was created from NAVISION, and MPS  sending requests to material resources to NAVI, and Navi  sending back informations about availability.(when the material isn't awailable in time task is  higlighted and PM can resolve this problem in project plan). ......  

The Projects managerss will be happy when you told them that MPS will be replaced by J2EE Intranet based on SOA  :)
, but normal people(resources) don't care about EPM and they will be  happy when you give them same cool  collaboration application  like Worksite from Interwoven. Where they can share all informations about business case even when they are offline.
Irwin SantosComputer Integration Specialist

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:

Split - winzig, cgrosso

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.