none
Client Object Model Project Server RRS feed

  • Question

  • Hi,

    Can anyone suggest how to access project server's projects list/grid through the Client Object Model?. Thanks.

    Thursday, April 21, 2011 11:09 PM

All replies

  • Hi,

    By Client Object Model I assume you mean thru project VBA? If so, the only way to read data from Proejct Server is from teh Reporting Database unless you write PSI code. Much quicker and easier to read from teh RDB. The project SDK has the full schema in it. My book shows and explains how, but teh following code will get you started:

    Sub ReadAllProjects()
    Dim Conn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim Projects() As String
    Dim index As Integer
        On Error Resume Next
        Conn.Open "Provider=SQLNCLI;Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;"
        If Err.Number <> 0 Then
            MsgBox "Error connecting to SQL Server: " & Err.Description
        Else
            rs.Open "Select ProjectName FROM dbo.MSP_EpmProject_UserView " _
                & "ORDER BY ProjectName", Conn, adOpenForwardOnly, adLockReadOnly
            If Err.Number <> 0 Then
                MsgBox "Error reading Project Names: " & Err.Description, vbCritical + vbOKOnly
            Else
                Do Until rs.EOF
                    Debug.Print rs!ProjectName
                    rs.MoveNext
                Loop
                rs.Close
                Conn.Close
                Set Conn = Nothing
                Set rs = Nothing
            End If
        End If
    End Sub

    The Views ending with _Userview in their name automatically have all relevant Enterprise Custom Fields appended to them.


    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management
    Thursday, April 21, 2011 11:58 PM
    Moderator
  • Hi Gill,

    Thanks for your reply. I am looking for something like javascript. Please let me know if there is any way to connect to the grid via javascript. Again thanks for your reply.


    Friday, April 22, 2011 1:53 PM
  • Is this through Project Professional (Client Object Model) or Project Server (Project Server Interface)? The two are totally different and have different capabilities.  Java script can work with both, but VB or VBA is much quicker and easier to write to the object model. C# is most commonly used for the PSI option.

     


    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management
    Saturday, April 23, 2011 2:53 AM
    Moderator
  • Hi Gill,

    Thanks again for your reply.

    I took the following sample and used same code.

    http://social.technet.microsoft.com/Forums/en-US/project2010custprog/thread/dc2640df-5311-49ab-bfd6-048dc1528caf

    I am getting all record keys in array and need to find out the row and cell data. I am not using any c# code for this. So is there any way to get it with out c# (I mean ..can we do it in Javascript itself?).

     

    Sunday, April 24, 2011 1:23 AM
  • Ok, you will not be using the client object model (that's for Project Professional), you will use Project Server's PSI. Download teh Project SDK from MSDN for sample code. It will mostly be in C# so you will have to translate to Javascript yourself.

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management
    Monday, April 25, 2011 9:56 AM
    Moderator
  • The grid control is shipped with SharePoint and customization topics are included in the SharePoint SDK:

    http://msdn.microsoft.com/en-us/library/ee535898%28office.14%29.aspx

    Chris Boyd
    Program Manager
    Microsoft Project Team

     

    Friday, May 13, 2011 4:01 AM
    Moderator
  • For a Project-specific example, see Walkthrough: Customizing the PWA Ribbon and Accessing the JS Grid. It gets and displays data from the grid on the Project Center page.
    Jim Corbin [MSFT]
    Friday, May 13, 2011 2:52 PM