I am attempting to query against Skype for business as part of my nintex workflow. I only want to assign a task to the user if they have been online within the last 4 hours (this should avoid people being on vacation being assigned tasks).
I don't know about any OOTB way to achieve that. I guess you should use ucwa (Unified Communications Web API) and try to execute some web request actions. But it will take a lot of work to get what you need even though it looks to be so easy
This is what I think you should investigate: https://msdn.microsoft.com/en-us/skype/ucwa/getpresencedataofacontact (from step no. 4). Maybe, but just maybe you can replace Bearer cookie in Authorization header with Cookies (rtFa and FedAuth: https://community.nintex.com/community/build-your-own/nintex-for-office-365/blog/2017/02/09/working-...), but I haven't tested it thus I have really no idea whether this is feasible, however this should be the starting point for you.
What can also be a problem is the fact, that the lastActive property ( ex. Date(1358827096000) ) specifies a time period that is represented in milliseconds, from January 1, 1970 UTC.. I don't know if there is an easy way to parse it to something more useful. I don't know either if there is a way to make the UCWA to return this date in other format OR if in case you will try to assign this value to a "Date/Time" variable this would work.
Give it a try though and share your results please. I'm curious if this approach will work
Lastactive was a useful route to take my only issue now is that I need to be able to compare it against the current date time and I'm having a hard time getting nintex to convert it.
Yeah... I thought it's not going to be easy. I don't know if feasible though
Moreover, this lastactive property can be often disabled in the environment or brings inaccurate information when I read about it more: https://support.microsoft.com/en-us/help/3056287/lastactive-attribute-provides-inaccurate-informatio....
var minutes = 1000 * 60;
var hours = minutes * 60;
var days = hours * 24;
var months = days * 30.44;
var years = days * 365.24;
var t= YOUR MILISECONDS OBTAINED USING REGEX: [^0-9 +];
var y = t / years + "";
y = y.substring(0, y.indexOf("."));
var x = t / months + "";
x = x.substring(0, x.indexOf("."));
var z = t / days + "";
z = z.substring(0, z.indexOf("."));