I also tried to find the presence state of the User and come out with the below code to achieve this requirement.
string _transferUserURI="pass your sipaddress";
RemotePresenceView _RemotePresence;
RemotePresenceViewSettings settings = new RemotePresenceViewSettings();
settings.SubscriptionMode = RemotePresenceViewSubscriptionMode.Default;
settings.PollingInterval = new TimeSpan(0, 0, 10);
_RemotePresence = new RemotePresenceView(_appEndpoint, settings);
_RemotePresence.PresenceNotificationReceived += new EventHandler<RemotePresentitiesNotificationEventArgs>(_RemotePresence_PresenceNotificationReceived);
//_RemotePresence.SubscriptionStateChanged += new EventHandler<RemoteSubscriptionStateChangedEventArgs>(_RemotePresence_SubscriptionStateChanged);
RemotePresentitySubscriptionTarget target = new RemotePresentitySubscriptionTarget(_transferUserURI);
List<RemotePresentitySubscriptionTarget> targets = new List<RemotePresentitySubscriptionTarget>() { target };
_RemotePresence.StartSubscribingToPresentities(targets);
and _RemotePresence_PresenceNotificationReceived event
void _RemotePresence_PresenceNotificationReceived(object sender, RemotePresentitiesNotificationEventArgs e)
{
try
{
// Extract the RemotePresenceView that received the notification.
RemotePresenceView view = sender as RemotePresenceView;
// A RemotePresentityNotification will contain all the
// categories for one user; Notifications can contain notifications
// for multiple users.
foreach (RemotePresentityNotification notification in e.Notifications)
{
Console.WriteLine("\nView: " + view.ApplicationContext
+ " Received a Notification for user "
+ notification.PresentityUri + ".");
// If a category on notification is null, the category
// was not present in the notification. This means there were no
// changes in that category.
if (notification.AggregatedPresenceState != null)
{
Console.WriteLine("Aggregate State = " + notification.AggregatedPresenceState.Availability + ".");
string Availblity = notification.AggregatedPresenceState.Availability.ToString();
}
if (notification.PersonalNote != null)
{
Console.WriteLine("PersonalNote: " + notification.PersonalNote.Message + ".");
}
if (notification.ContactCard != null)
{
// A ContactCard contains many properties; only display
// some.
ContactCard contactCard = notification.ContactCard;
Console.WriteLine("ContactCard Company: " + contactCard.Company + ".");
Console.WriteLine("ContactCard DisplayName: " + contactCard.DisplayName + ".");
Console.WriteLine("ContactCard EmailAddress: " + contactCard.EmailAddress + ".");
}
}
}
catch
{
}
}
I hope this was the answer you are looking otherwise correct me if i was wrong.