’ This sample code changes Personal Status
to "In a Meeting"
Private WithEvents oSession
As Session
Private Sub Command1_Click()
’ Session
and User
object variables
Dim oSession
As New Session
Dim oUser
As User
’ Variables
to hold the collection
of Personal Status objects
for user
Dim oPersonalStatusFolder
As Folder
Dim oPersonalStatus
As TeleVantage.PersonalStatus
’ Log
on to the TeleVantage Server.
’ “32402”
is a unique number used
to identify the application using this Session
object.
oSession.Logon "Server_Name", "Joe Smith", "****", 2, tvApplicationTypeClient, "32402", , False
’ Get the User
object
Set oUser = oSession.User
’ Get the Personal Status Folder
Set oPersonalStatusFolder = oSession.GetDefaultFolder(tvFolderPersonalStatus)
’ Look at each Personal status
object in the folder
until we find "*
In A Meeting"
’ Note that the
Name field
of statuses are prefixed
with "*"
For Each oPersonalStatus
In oPersonalStatusFolder.Items
If oPersonalStatus.
Name = "*
In A Meeting"
Then
’ Use the ApplyStatus method
with our "*
In A Meeting" Personal status
object
oUser.ApplyStatus oPersonalStatus
End If
Next
’ Destroy objects
and log off Server
Set oUser = Nothing
Set oPersonalStatusFolder = Nothing
Set oPersonalStatus = Nothing
oSession.LogOff
End SubCHAPTER 2. THE CLIENT
API 2-33
TELEVANTAGE DEVELO