Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3851184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:07:25+00:00 2026-05-19T17:07:25+00:00

I am trying to get a user’s SIP address so I can use a

  • 0

I am trying to get a user’s SIP address so I can use a JavaScript object to check their presence in Office Communicator. Here is a script I found that is similar to what I am looking to do.

Option Explicit
DIM objConnection, objCommand
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection 

Dim objOU, objUser, strUPN, strSIP, SIPLine
' Bind to the OU object.
Set objOU = GetObject("LDAP://chkenergy.net/DC=chkenergy,DC=net")

' Enumerate all users in the OU.
objOU.Filter = Array("user")
For Each objUser In objOU
' Skip computer objects.
 If (objUser.Class = "user") Then
  strUPN = objUser.userPrincipalName
  strSIP = objUser.get("msRTCSIP-PrimaryUserAddress")

  wscript.echo strSIP

End If

Next

Basically, I can get their username from AD, and I would like to pass that in and get their SIP address (strSIP) back. Is there a way to fix this code to do that task specifically?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:07:25+00:00Added an answer on May 19, 2026 at 5:07 pm

    The problems of your posted vbscript are

    1. It enumerates the user on the client side, which will take a lot of time to find the correct user. Similarly, instead of pulling all the records from the database and do the comparison on your client side, you would run a SQL query. Right?
    2. The enumeration is done at one single level only. You have to fix your code to do recursive enumeration. However, if you fix it to do recursive enumeration, it’s going to take even longer time and even more resources to do your job.

    Before I answer your question, here are some basic background knowlege on Active Directory.

    • User objects on Active Directory contains a number of attributes.
    • In particular, samAccountName is your pre-Windows 2000 name.
    • userPrincipalName is in the format of user@domain.name

    You can actully execute a query using an ADO connection object. Since you are binded to an Active Directory, you can execute a LDAP query. The LDAP query string contains four parts.

    • Root path, where we start the search.
    • LDAP filter
    • Returned attributes
    • Search scope

    The LDAP query string that you should use should be something like

    <LDAP://chkenergy.net/DC=chkenergy,DC=net>;(&(objectClass=user)(samAccountName=yourusername));msRTCSIP-PrimaryUserAddress;subtree
    
    • The root path in the above example is <LDAP://chkenergy.net/DC=chkenergy,DC=net>.
    • The LDAP filter is (&(objectClass=user)(samAccountName=yourusername)). Of course, you need to replace yourusername to something else inside your code. I am assuming you can pass in a samAccountName. If that’s not the case, you need to modify the filter yourself.
    • Returned attributes is msRTCSIP-PrimaryUserAddress. I think that’s what you need. Right?
    • I am assuming you are trying to search for all user objects under the same domain. So, your search scope should be subtree

    Here is a complete sample that I guess it should do your job

    userName = "harvey"
    ldapStr = "<LDAP://chkenergy.net/DC=chkenergy,DC=net>;(&(objectClass=user)(samAccountName=" & userName & "));msRTCSIP-PrimaryUserAddress;subtree"
    
    Set conn = CreateObject("ADODB.Connection")
    conn.Provider = "ADSDSOObject"
    conn.Open "ADs Provider"
    Set rs = conn.Execute(ldapStr)
    
    While Not rs.EOF
       wscript.echo rs.Fields("msRTCSIP-PrimaryUserAddress")
       rs.MoveNext
    Wend
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a user control working asynchronously, yet no matter what I
I'm trying to get all the direct reports of a User through Active Directory,
I'm trying to get the following code working: string url = String.Format(@SOMEURL); string user
I am trying to find a way to get the source code for (user
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
Trying to get my css / C# functions to look like this: body {
Trying to get an ASP application deployed; it worked for a while but then
Trying to get this example working from http://www.munna.shatkotha.com/blog/post/2008/10/26/Light-box-effect-with-WPF.aspx However, I can't seem to get
Whilst trying to get our app working in Firefox (I'm a big proponent of
Im trying to get into some basic JavaFX game development and I'm getting confused

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.