The AddWatcherEx method adds a new watcher rule object (access control entity). The state of the newly added watcher can be allowed, blocked, prompt, or deny. If watcher roaming is enabled by passing the RTCRET_WATCHER_ROAMING flag to the IRTCClientProvisioning::EnableProfileEx method, the newly created watcher is persisted on the server.

HRESULT AddWatcherEx(BSTRbstrPresentityURI,


  • bstrPresentityURI
    [in] String value that contains the SIP URI of the new watcher. The "sip:" prefix is optional when providing the URI.

  • bstrUserName
    [in] String value that contains the display name of the new watcher.

  • bsatrData
    [in] Optional string value used as a private data blob.

  • enState
    [in] RTC_WATCHER_STATE enumeration value used to describe the initial watcher state.

  • fPersistent
    [in] Boolean value that indicates whether or not the watcher should be persisted after shutdown.

    Value Meaning
    VARIANT_TRUE The watcher should be saved in persistent storage.
    VARIANT_FALSE The watcher is volatile and will be lost when the RTC Client process terminates.
  • enScope
    [in] RTC_ACE_SCOPE enumeration value used to describe the specific scope of the new watcher's ACE.

  • pProfile
    [in] Pointer to an IRTCProfile interface that specifies a provisioning profile to associate with this watcher. If IRTCClientPresence2::EnablePresenceEx has been used to enable a presence profile, this parameter should be set to NULL.

  • lFlags
    [in] Reserved. This value should be set to zero.

  • ppWatcher
    [out] Pointer to an IRTCWatcher2 interface on the newly created Watcher object. This parameter may be NULL, indicating that the method should not return an interface. This call adds a reference to the watcher object, which the caller is responsible for releasing.

Return Values

RTC methods may return an RTC_E_ constant.

Value Meaning
RTC_E_CLIENT_NOT_INITIALIZED The client object has not been initialized.
E_INVALIDARG The bstrPresentityURI is NULL, or the enscope enumeration value is not valid.
E_POINTER One of the pointers in the parameter list is not valid.


Redistributable: Requires Rtcdll.dll on Windows 2000, Windows XP, and Windows Server 2003.
Header: Declared in Rtccore.h.
Library: Included as a resource in Rtcdll.dll.
GUID: IID_IRTCClientPresence2 is defined as AD1809E8-62F7-4783-909A-29C9D2CB1D34.

See Also

IRTCClientPresence2, IRTCClientPresence, IRTCClientPresence::AddWatcher, IRTCClientPresence::AddBuddy, Presence Access Control