Programatically access Project server data

G

Gérard Ducouret

Hello Jeremy,

Yes you can : look at the begining of the VBA procedure below.

Hope this helps,

Gérard Ducouret


Jeremy Chapman said:
How can I programatically generate a list of projects in project server?

Dim cn As Object
Dim rst As Object
Dim rst_Task As Object
Dim Cmd As Object

Const DSN = "LocalServer"
Const STR_USER_IDENT = "Administrateur"
Const STR_PASSWORD_IDENT = ""

Sub Lecture()
Dim sQuery As String
Dim sPathFile As String, i As Integer

' Ouverture de connection à SQL Server par l'intermédiaire d'un DSN
système
Set cn = CreateObject("ADODB.Connection")
cn.Mode = adModeRead 'adModeReadWrite (Lecture seule!)
cn.ConnectionString = "DSN=" & DSN & ";UID=" & STR_USER_IDENT & " ;PWD="
& STR_PASSWORD_IDENT & ";"
cn.Open

'1ere Requête :
' Récupération des enregistrements de la table des projets de la base de
données pointé par le DSN
sQuery = "SELECT * FROM MSP_PROJECTS"
Set rst = CreateObject("ADODB.Recordset")
Set rst = cn.Execute(sQuery, , adCmdText)

sPathFile = "c:\InfoProj.txt"
Open sPathFile For Output As #1
Print #1, ""

With rst
While Not .EOF
i = i + 1
Print #1, "********************"
Print #1, "Nom du projet : " & ![PROJ_NAME]
 
J

Jeremy Chapman

Thanks. Good solution, I was hoping to reference some kind of API though,
just incase MS ever changes the implementation for any reason.


Gérard Ducouret said:
Hello Jeremy,

Yes you can : look at the begining of the VBA procedure below.

Hope this helps,

Gérard Ducouret


Jeremy Chapman said:
How can I programatically generate a list of projects in project server?

Dim cn As Object
Dim rst As Object
Dim rst_Task As Object
Dim Cmd As Object

Const DSN = "LocalServer"
Const STR_USER_IDENT = "Administrateur"
Const STR_PASSWORD_IDENT = ""

Sub Lecture()
Dim sQuery As String
Dim sPathFile As String, i As Integer

' Ouverture de connection à SQL Server par l'intermédiaire d'un DSN
système
Set cn = CreateObject("ADODB.Connection")
cn.Mode = adModeRead 'adModeReadWrite (Lecture seule!)
cn.ConnectionString = "DSN=" & DSN & ";UID=" & STR_USER_IDENT & " ;PWD="
& STR_PASSWORD_IDENT & ";"
cn.Open

'1ere Requête :
' Récupération des enregistrements de la table des projets de la base de
données pointé par le DSN
sQuery = "SELECT * FROM MSP_PROJECTS"
Set rst = CreateObject("ADODB.Recordset")
Set rst = cn.Execute(sQuery, , adCmdText)

sPathFile = "c:\InfoProj.txt"
Open sPathFile For Output As #1
Print #1, ""

With rst
While Not .EOF
i = i + 1
Print #1, "********************"
Print #1, "Nom du projet : " & ![PROJ_NAME]
 
Top