What I want to do is create a WCF service just to get the availability of a user. I have gone through the following quick-start example: Name: SubscribePresence http://msdn.microsoft.com/en-us/library/office/dn454835(v=office.15).aspx
I have managed to do this but i feel that its not the most efficient way to just get a users availability.
At the moment I create a end point subscribe to a users presence and wait for the response to come back and from that i get the users availability. (I'm simplifying this down).
What I would ideally like though is just to quickly get a users availability without subscribing to a users presence and close the connection as soon as i have retrieved the availability.
I was wondering if anyone knows of an example that i can have a look at or that they have implemented themselves
any advice would be appreciated
You can also do a one-time presence query. From MSDN:
See http://msdn.microsoft.com/en-us/library/office/hh383136%28v=office.14%29.aspx
Example
You can call the presence query like this. The
null
argument on 3rd position is the event handler which will fire when presence is recieved, it's not required since we process the results of theEndPresenceQuery
instead. You could also pass an eventhandler and not care about the results of theEndPresenceQuery
, thats up to you.However, when you run a WCF service for presence which will be queried multiple times, I would say it might be better to subscribe to presence than to do single queries every time. I build a similar system once with the following logic:
The main advantage here is that for multiple subsequent queries for the same user's presence, you do not query the Lync server each time. Your service responses will be a lot faster, and you get presence pushed rather than having to poll for it each time.