Office Communicator Verify – User Status

Office Communicator display list of Friends added in it along with their availability status (whether they are available at their desk, away, Idle or away).

But to check this, they should be first added to Communicator. What if you want to do a Anonymous Monitoring?

Also Read: Login to Facebook, Twitter, Google+ in IE from Excel

User Status – Without Adding User to Office Communicator

If their Id is not in your Office communicator list & you want to know the status (provided they have login account), the steps explained below can be used with Excel VBA.

To get this we need their Communicator Login Id or Email ID.

  1. Create a New Excel Workbook.
  2. Press Alt + F11 to activate VB Editor.
  3. Go to Menu Tools -> Reference  and Add “Microsoft Office Communicator API Library“. To use this code, Office Communicator should be installed in the system and a valid user login is required.
  4. Copy paste the code and run the code by pressing F5 key.
  5. Message box will pop up to display the user status for the User id provided in “OCS_User_Mail_Id”.
Public Sub Office_Communicator_Verify_User_Status_OCS()
    Dim myOCS As New CommunicatorAPI.Messenger 'Office Communicator API Library
    Dim OCS_User_Mail_ID As String
    Dim curr_status As Integer
    Dim flag As Integer
    Dim stat As String

    stat = ""
    OCS_User_Mail_ID = "User@mail.com" 'Change the Mail ID to USER Mail.
    curr_status = myOCS.GetContact(OCS_User_Mail_ID, myOCS.MyServiceId).Status
    If curr_status = 34 Then stat = "Away"
    If curr_status = 10 Then stat = "Busy"
    If curr_status = 18 Then stat = "Idle"
    If curr_status = 1 Then stat = "Offline"
    If curr_status = 2 Then stat = "Online"
    If curr_status = 0 Then stat = "Unknown"

    MsgBox "User:" & OCS_User_Mail_ID & " OCS Status = " & stat
End Sub

If you have list of Mail IDs in an excel sheet, the above code can be customized to read the list in a loop and get status of each user. The same code can also be used for Friends already added to in Friends list.

Also Read: WhatsApp Multiple Login Sessions in Same Mobile

Related Topics:

  • With a Timer enabled along with this, the code can be made to run repeatedly and User’s available time at his desk or Office Communicator can be calculated. i.e., this code along with “Application.OnTime” functionality, can be used as a productivity calculator software. (Reference for adding Timer to Excel Macro)
  • When we have list of Email Ids in Excel and want to send mail though Office Outlook to that list, refer this topic

More Tips: Remove Duplicate Values From Excel Sheet

8 thoughts on “Microsoft Office – Communicator API – Verify Availability Status”

  1. Hi ..!! this is awesome stuff… thnks .. however i am getting the status for only those who are on my list.. 🙁 . Can u please guide me where i can be doing wrong?

  2. When I created a loop, even the person is online, it is showing it as Unknown. But in next iteration it is showing it as available. How to fix this please?

      1. I have googled. But couldnt find any useful info. I can’t use team viewer as i am using my office laptop :(. Could you please try it from your end? Thanks!

  3. Hello i tryied your code but ist still shows as value Unknown (curr_status=0) can you pls fix it or you can make a macro file and upload ??

Leave a Reply