Is there a Lync API for creating add-ons that run as soon as the user signs into Lync?

StackOverflow https://stackoverflow.com/questions/16726306

  •  30-05-2022
  •  | 
  •  

I can see custom menu items and custom conversation windows and events inside them but nothing referring to how you'd execute code once a user signs into Lync. Does such an API exist?

I guess my alternative would be creating a Lync Automation object/my own client using the Suppressed ui and building whatever features I want into one of those?

有帮助吗?

解决方案

There's nothing you can build into the Lync application, but you could run a separate application which can subscribe to the SignIn state of the user. That way, you'd know when a user signs-in, and could take appropriate action. You wouldn't need to create a SuppressedUI application for that, just something that ran in the background, or taskbar or something.

Here's a bare bones example:

namespace ThoughtStuff
{
    class Program
    {
        static void Main(string[] args)
        {

            var client = LyncClient.GetClient();
            client.StateChanged += client_StateChanged;
        }

        static void client_StateChanged(object sender, ClientStateChangedEventArgs e)
        {
            if (e.NewState == ClientState.SignedIn)
            {
                //do something on sign in
            }
        }
    }
}

You might get errors if you try and attach to Lync in the SDK code using LyncClient.GetClient() if the Lync exe isn't running...but if you know that's likely to be a problem (such as if your application might be running before the user starts Lync), then you can gracefully handle it and retry in code.

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