I have a custom Lync application for changing a user's status/presence. For the app, Lync runs on suppressed UI on some machines and not on others. I want it to prompt the user "Would you like to change your status to 'Out'?" if they are doing a system shutdown or logout and their status is set to 'In'. Then it will change their status if they want and log them out/shutdown. The problem is that when they do a logout/shutdown it kills the Lync process and then I need to fire it back up again before I can change their status.

有帮助吗?

解决方案

If you are mapping your in/out statuses to standard Lync statuses, then you shouldn't need to explicitly publish the status on logoff/shutdown. When the user logs out of the machine, Lync should automatically set the status to Offline - so provided that status is mapped to "Out", the user should be set to your "Out" status automatically

Unless I'm misunderstanding something...

Edit - ok, I see why you need to trap the shutdown event now - to prompt the user to set the note as they sign out. I don't think there's anything you can do with the Lync API to get round this. As you said, the problem is that your app gets notified it's shutting down, but by that time it's too late as Lync itself has also been told to shut down, so there are no guarantees you can ask it to change the users note status.

I think the best you can do is use the Win32 ShutdownBlockReasonCreate function - there is an example of using it from managed code here. Unfortunately it's only supported in Vista or above.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top