I found how to do it. One of my coworker tell me to look in the active
directory. So if others whant to know how to do it, here is the code.
Don't forget to change these values to your need :
'LDAP://DC=DomaineName,DC=com'
Dim oConnexion As New OleDbConnection("Provider=ADsDSOObject;")
oConnexion.Open()
Dim oCommand As New OleDbCommand("SELECT printerName, serverName FROM " & "
'LDAP://DC=DomaineName,DC=com' WHERE objectClass='printQueue'", oConnexion)
Dim oDataAdapter As New OleDbDataAdapter(oCommand)
Dim oDataSet As DataSet = New DataSet
oDataAdapter.Fill(oDataSet)
Dim oRow As DataRow
ListBox1.Items.Clear()
For Each oRow In oDataSet.Tables(0).Rows
ListBox1.Items.Add(oRow.Item(1).ToString + " on " + oRow.Item(0).ToString)
Next
--
Marc R.
E-mail
Dim strAddr As String =Convert.ToString(String.Format("{0}.{2}@{3}.{1}",
"mxrc", "cx", "robitxille", "xrs-solutions")).Replace("x", "a")
"Marc Robitaille" <in**********@pintendre.com> a écrit dans le message de
news:
eQ**************@TK2MSFTNGP12.phx.gbl...
Hello,
Is there a way of having the list of the printers install on a print
server
by code? I would like to build a list of these printers and to add this
list
in a drop-down list in my client application. I search on the web but I
did
not find anything.
Thank you for your help
--
Marc R.
E-mail
Dim strAddr As String =Convert.ToString(String.Format("{0}.{2}@{3}.{1}",
"mxrc", "cx", "robitxille", "xrs-solutions")).Replace("x", "a")