none
Issue with EnterpriseResourceGet - HELP ! RRS feed

  • Question

  • Microsoft Project Server API EnterpriseResourceGet(EUID, RUID) adds a single resource from the enterprise resource pool to the active project.But if many resources (Say 100) are to be added to an active project, the application window hangs.This API will be called 100 times which makes the application hang.

    My question will be if there is any alternate API to add many resources at a shot, so that the same problem will not occur.

    • Moved by Alexander.BurtonModerator Thursday, March 17, 2011 2:56 AM Moving to the programming forum where it is more likely to get answered. (From:Project Server General Questions and Answers)
    Thursday, March 17, 2011 12:28 AM

Answers

  • EnterpriseResourceGet is a VBA method in Project Pro, not a Project Server API. You can also use EnterpriseResourceGet in a VSTO add-in.

    So to answer your question, no -- there is no alternate API in Project Pro. However, the PSI in Project Server has the Project.QueueUpdateProjectTeam method, but that requires server-side programming, and you would not be able to update the project while it is open in Project Pro.

    Have you tried adding 100 enterprise resources to a project manually? If that works, then I would guess there is a race condition when you rapidly call EnterpriseResourceGet 100 times. Try putting a delay between calls. For example:

    Option Explicit
    
    #If Win64 Then
      Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongLong)
    #Else
      Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    #End If
    
    Sub SleepSome(time As Long)
    #If Win64 Then
      Dim millisec As LongLong
    #Else
      Dim millisec As Long
    #End If
      
      millisec = time
      Sleep (millisec)
    End Sub
    
    Sub TestSleep()
      Dim millisec As Long
      millisec = 5000 ' Five seconds
      
      Debug.Print "Sleeping..."
      SleepSome (millisec)
      Debug.Print "Slept " & millisec / 1000 & " seconds"
    End Sub
    
    
    
    Friday, March 18, 2011 4:30 AM