EWS

Join Lync Conference Using Lync 2013 SDK


This article explains how to prepare for and join online meetings using Microsoft Lync 2013 SDK, you can join a scheduled online meeting with colleagues and clients from down the hall or across the world without leaving your desk.

For online meetings with audio or video calls You can access your scheduled conference invite using Microsoft Lync 2013 SDK.

When a user schedules an Online meeting in Outlook 2007/2010 the meeting and Lync information associated with that meeting are stored in a number of MAPI properties on the Appointment Item.

You can use these information further to do many tasks i.e. to join a conference meeting, also you could use these information to put it in a calendar.

The following demonstrations run on different computers. These computers is used to start a conference by using Microsoft Lync 2013 SDK UI Automation mode or Microsoft Lync 2013 SDK UI Suppression mode.

Getting the Online Meeting URL

You could get the online meeting URLs by the Managed EWS API, Microsoft encourage Microsoft .NET Framework developers to use the EWS Managed API instead of auto-generated proxies to develop against Exchange Web Services. The EWS Managed API object model is significantly easier to use than auto-generated proxy object models.

You get more information how to use EWS in the previous post Get Lync Online Meetings’ Information using the EWS Managed API

Getting the Conference URI

The conversation properties that you use to form a complete conference URI are null at the time that the conversation is created.

To get the conference URI properties, you register for the Conversation.PropertyChanged event on the conversation to get the URI value

The following are examples of how to build a conference join URL using properties of the conversation.

UI Automation Mode

private void Conversation_PropertyChanged
    (object sender, ConversationPropertyChangedEventArgs e)
{
    //Getting meeting url
    if (e.Property == ConversationProperty.ConferencingUri)
    { 
        string ConferenceUri = "conf:" 
           + ((Conversation)sender).Properties[ConversationProperty.ConferencingUri]
           + "?" + ((Conversation)sender).Properties[ConversationProperty.Id];
    }
}

UI Suppression Mode

void ConversationManager_ConversationAdded
    (object sender, ConversationManagerEventArgs e)
{
    //Getting meeting url
    string url = string.Empty;
    string domain = string.Empty;
    string name = string.Empty;
    string id = string.Empty;

    url = ConferenceUrl.Replace("https://meet.","");
    url = url.Substring(0, url.Length);
    domain = url.Substring(0, url.IndexOf("/"));
    url = url.Replace(domain + "/", "");
    name = url.Substring(0, url.IndexOf("/"));
    id = url.Replace(name + "/", "");
    url = "conf:sip:" + name + "@" + domain + 
          ";gruu;opaque=app:conf:focus:id:" + id + "?" +
          _activeConversation.Properties[ConversationProperty.Id].ToString();
}

Joining the Conference

Once the conference URI is obtained by another user, use the BeginStartConversation method to join a conference in a Microsoft Lync 2010 SDK application. The string argument of the call is the conference URI.

UI Automation Mode

IAsyncResult ar = LyncClient.GetAutomation().BeginStartConversation(
    this.ConferenceUriObtainedFromEmail_string,
    this.Handle.ToInt32(),
    null,
    null);
_Automation.EndStartConversation(ar);

UI Suppression Mode

void ConversationManager_ConversationAdded
    (object sender, ConversationManagerEventArgs e)
{
    //Join the conference
    _activeConversation.ConversationManager.JoinConference(url);
}

Get Lync Online Meetings’ Information using the EWS Managed API


In this article we will learn how to be able to use Exchange Web Services (EWS) via the EWS Managed API to access an Exchange Mailbox calendar and view all information for the Online Lync meetings.

The examples are written to work with the Exchange Online and Lync Online from the Office365 suite and within a private cloud or on-premise deployment of Lync 2010 and Exchange 2007 or Exchange 2010.

When a user schedules an Online meeting in Outlook 2007/2010 the meeting and Lync information associated with that meeting are stored in a number of MAPI properties on the Appointment Item.

You can use these information further to do many tasks i.e. to join a conference meeting using the browser or in any other way like the Lync SDK, also you could use these information to put it in a calendar.

EWS Managed API

The Microsoft Exchange Web Services (EWS) Managed API provides an intuitive interface for developing client applications that use Exchange Web Services. The EWS Managed API provides unified access to Microsoft Exchange Server resources, while using Microsoft Outlook–compatible business logic. The EWS Managed API uses EWS SOAP messages to communicate with the Exchange Client Access server.

Microsoft encourage Microsoft .NET Framework developers to use the EWS Managed API instead of auto generated proxies to develop against Exchange Web Services. The EWS Managed API object model is significantly easier to use than autogenerated proxy object models.

Prerequisite

  • Microsoft Visual Studio
  • C# Language
  • EWS Managed API
  • Exchange Server with known credential

Sample Code

Add reference to the Microsoft.Exchange.WebServices

using Microsoft.Exchange.WebServices.Data;

Connect to Exchange Web Services as user1 at YourDomain.com and select the version of the exchange you are using

var service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
service.UseDefaultCredentials = true;
service.AutodiscoverUrl("user1@YourDomain.com");

Select the folder that you want to get its items. In this case should select the calendar to get the online meetings

var calendarFolder = new FolderId(WellKnownFolderName.Calendar);

Choose the appropriate period to get its meetings and the number of items you want to get

var calendarView = new CalendarView(DateTime.Now, DateTime.Now.AddMonths(1), 1000);
var UCOpenedConferenceID = 
    new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings,
                                  "UCOpenedConferenceID",
                                   MapiPropertyType.String);
var OnlineMeetingExternalLink =
    new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings,
                                  "OnlineMeetingExternalLink",
                                   MapiPropertyType.String);

Start getting the items of the folder

PropertySet iDPropertySet =
    new PropertySet(BasePropertySet.IdOnly) {UCOpenedConferenceID};
calendarView.PropertySet = iDPropertySet;
var lyncMeetings = new List();
var appoResult = service.FindAppointments(calendarFolder, calendarView);
foreach (var appointment in appoResult)
{
    object UCconfId = null;
    if(appointment.TryGetProperty(UCOpenedConferenceID, out UCconfId))
        lyncMeetings.Add(appointment);
}

Start getting the details of each item

var detailPropertySet =
new PropertySet(BasePropertySet.FirstClassProperties) { OnlineMeetingExternalLink };
service.LoadPropertiesForItems(lyncMeetings, detailPropertySet);
foreach (Appointment appointment in lyncMeetings)
{
    object lyncMeetingUrl = null;
    appointment.TryGetProperty(OnlineMeetingExternalLink, out lyncMeetingUrl);
}

Download EWS API