I am building a workflow to auto assign tasks. How to I find out who is online through Skype for business?

  • 28 March 2017
  • 3 replies
  • 3 views

Badge +1

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).


3 replies

Userlevel 7
Badge +17

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-with-security-credentials-requestdigest-fedauth-rtfa), 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

Regards,

Tomasz

Badge +1

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.

Userlevel 7
Badge +17

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-information-about-a-user-s-status-in-skype-for-business-online.

Frankly speaking I have no idea how to parse that value to a specific date/time in Nintex workflow. It's simple with JavaScript. For example, to get number of years since 1-1-1970 out of that example (Date(1358827096000)) you could use that algorythm:

    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(".")); ‍‍‍‍‍‍‍‍‍‍‍‍‍

By converting it into Ninex-actions you will get years, months and days since 1970-1-1 to the "lastActive" date. Probably if you could get the same values for current date/time and then substract one from the other (that would definitely require a lot of debugging, maybe try with JavaScript consoles for the start) you should be able to calculate the lastActive date. With time I guess there will be even more fun

Regards,

Tomasz

Reply