Cookie CSS

Saturday, October 3, 2015

Adding your own Plugin to Lync / Skype for Business

A while back I added a feature for customers using our Bridge LICC product that shows live Cisco UCM call status in the Lync/Skype4b client that would let them dial a Lync user on their Cisco desk phone.  To accomplish this I used a technology available from Microsoft to insert a custom menu into the Lync/Skype4b client.

Today's blog will focus on how do the same for your project.  What you will need first is;

1.  The path to your exe you want Lync to send the user sip uri too.

2.  The path to the graphic icon you want to show in the menu.

3.  A guid to identify your program.  Example 1C4781B0-E635-4A60-8B28-22B202B155BB






















Once you have those you write out a registry key like below.

string regKeytoWrite = @"SOFTWARE\\Microsoft\\Office\\15.0\\Lync\\SessionManager\\Apps\\{1C4781B0-E635-4A60-8B28-22B202B155BB}";

                RegistryKey ModRegKey = Registry.LocalMachine.CreateSubKey(regKeytoWrite);
                ModRegKey.SetValue("Name", "Call with Desk Phone");
                ModRegKey.SetValue("Path", mypath + " %contact-id% %user-id%");
                ModRegKey.SetValue("ApplicationInstallPath", mypath.Replace("\"",""));
                ModRegKey.SetValue("SmallIcon", picpath.Replace("\"",""));
                ModRegKey.SetValue("Tooltip", "Call with Desk Phone");
                ModRegKey.SetValue("ApplicationType", 0, RegistryValueKind.DWord);
                ModRegKey.SetValue("SessionType", 0, RegistryValueKind.DWord);
                ModRegKey.SetValue("ExtensibleMenu", "MainWindowActions;MainWindowRightClick;ConversationWindowRightClick;ContactCardMenu;ConversationWindowActions");
                ModRegKey.Close();

Note if you are using an old version of Lync the key may be

string regKeytoWrite = @"SOFTWARE\\Microsoft\\Communicator\\SessionManager\\Apps\\{1C4781B0-E635-4A60-8B28-22B202B155BB}";

Instead.  Also note you don't have to create the menu item in each location, I provided this list to show all the options.

ModRegKey.SetValue("ExtensibleMenu", "MainWindowActions;MainWindowRightClick;ConversationWindowRightClick;ContactCardMenu;ConversationWindowActions");

Now once we reboot the machine and restart Lync we see our menu item.  So now we need to deal with what happens when a user clicks on it.  2 parameters are going to be passed to us, and I will deal with them in a WPF window this way.

        string _contID = "";
        string _userID = "";

public Window1(string contID, string userID)
        {
            InitializeComponent();

            _contID = contID.Trim();
            _userID = userID.Trim();
        }

From here you should have the sip uri you need to do whatever you want with the user.

That will conclude this weeks blog post.  If you have any questions hit me up on twitter.

Doug Routledge, C# Lync, Skype for Business, SQL, Exchange, UC Developer  BridgeOC
Twitter - @droutledge @ndbridge



No comments:

Post a Comment

Any spam comments will be deleted and your user account will be disabled.