The QueryCategory function fetches an item published in a specified enhanced presence container.


  Copy imageCopy Code
string QueryCategory(
  string or Uri Publisher,
  int ContainerNumber,
  string CategoryName,
  int Instance,
  bool PublisherIsPhone



The identity of the presence publisher. Can be a SIP URI, a user URI in the form user@host, or a telephone number.


The container identification number.


The name of the presence category.


The instance identification number.


Optional. The value is true if the publisher is a phone; otherwise, false.

Return Values

Returns the specified string.


Microsoft Lync Server 2010 provides the infrastructure to enable client applications to publish and subscribe to extended, or "enhanced," presence information. The enhanced presence infrastructure includes categories and containers. Categories are individual pieces of presence information, such as status, location, or calendar state. Containers are logical buckets into which clients publish instances of various categories of presence information.

Example Code

  Copy imageCopy Code
publication = QueryCategory("sip:someone@example.com", 1, "userStatus", 0);

Example Code

  Copy imageCopy Code
publication = QueryCategory("someone@example.com", 1, "userCalendarState", 0, false);

Example Code

  Copy imageCopy Code
publication = QueryCategory("+14255551234", 1, "userLocation", 0, true);