http://stackoverflow.com/questions/11399881/lync-sdk-automation-dial-number
http://msdn.microsoft.com/en-us/library/lync/jj933180.aspx
http://msdn.microsoft.com/en-US/lync
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Lync.Model; using Microsoft.Lync.Model.Extensibility; using Microsoft.Lync.Model.Device; using Microsoft.Lync.Model.Conversation; using Microsoft.Lync.Controls; using Microsoft.Lync.Utilities; namespace TLync { class Program { static void Main(string[] args) { a(); return; Microsoft.Lync.Model.LyncClient lc=null; try { lc = Microsoft.Lync.Model.LyncClient.GetClient(); } catch { Log("can not getclient"); } lc.BeginSignIn("test3@abc.local","abc\\test3", "abcdefg", result => { if (result.IsCompleted) { lc.EndSignIn(result); Log("login complete."); } else { Log("Login err"); } }, "str" as object); Console.ReadLine(); } static LyncClient lyncClient = null; static void a() { lyncClient = LyncClient.GetClient(); //if (lyncClient.State == ClientState.Uninitialized) //{ // lyncClient.BeginInitialize((ar)=> // { // lyncClient.EndInitialize(ar); // lyncClient.StateChanged += lyncClient_StateChanged; // },null); //} //if (lyncClient.State == ClientState.SignedOut) //{ // lyncClient.BeginSignIn( // null, // null, // null, // (ar) => // { lyncClient.EndSignIn(ar); }, // null); //} //lyncClient.BeginSignIn("test3@abc.local", "abc\\test3", "abcdefg", result => //{ // if (result.IsCompleted) // { // lyncClient.EndSignIn(result); // Log("login complete."); // } // else // { // Log("Login err"); // } //}, "str" as object); var automation=LyncClient.GetAutomation(); var conversationSettings = new Dictionary<AutomationModalitySettings, object>(); List<string> participants = new List<string>(); var contact = lyncClient.ContactManager.GetContactByUri("0186111111111"); //var contact2 = lyncClient.ContactManager.GetContactByUri("013611111111"); var contact2 = lyncClient.ContactManager.GetContactByUri("013611111111"); participants.Add(contact.Uri); // participants.Add(contact2.Uri); automation.BeginStartConversation(AutomationModalities.Audio, participants, null, result => { Log(result.ToString()); }, automation); } static void lyncClient_StateChanged(object sender, ClientStateChangedEventArgs e) { if (e.NewState == ClientState.SignedOut) { if (lyncClient.InSuppressedMode == true) { } } } static void Log(string str) { Console.WriteLine(str); } } }