LCS lync logo JPG Lync Custom Status 2014 BETA

Here it is!

The very first public BETA release of my latest project.. I decided to build this application to add a little ‘Je ne sais quoin’ to the Microsoft Lync client status selection. I am a big fan of the Microsoft Lync product, and unified communications.. However, as those close to me will know – I am a big fan of automation. Which is when the idea for this app was born..

So.. What does it do.. Well, check out the details below! Please remember this is an extremely early public release BETA. It’s in its early stages, and I still have BIG plans for this app.

Continue reading “Lync Custom Status 2014 BETA” »

Tagged with:  

Today I was asked if it would be possible to ‘Automate’ the repeated dialling of a SIP contact, this was in order to try and replicate and resolve an issue with a headset and lync.

So I cam up with this, and thought I should share it in case others find it useful.

The code below commences dialling after the command button is pushed, and each time the other party hangs up the App starts dialling again. Simple but effective.

If you use the code, or figure out a better way of doing it drop me a message using the comments section below.

Tagged with:  

da57591e 7377 46d3 959c 005816e755c4 150x150 Handle Lync Audio/Video ModalityStateChanged with VB.netSo todays challenge was around handling the ModalityState change on the Lync 2013 client. The ModalityState change event happens during certain stages of Lync calls, and client actions. The ModalityState is part of the Microsoft.Lync.Model.Conversation namespace. We are using it to configure certain custom Lync Status’ dependant of the current state of the client.

To capture and handle these events, you need to create and event handler for the conversation manager namespace and for ModalityStateChangedEventArgs. The code below is written in VB.Net but could easily be transferred to C# etc.

In my example, I am only interested in the AudioVideo modality state changes.

  Imports Microsoft.Lync.Model  Imports Microsoft.Lync.Model.Conversation  Imports Lync = Microsoft.Lync.Model.Conversation    Public Class frmMain      Private _LyncClient As LyncClient      Public WithEvents _ConversationMgr As Microsoft.Lync.Model.Conversation.ConversationManager      Public WithEvents _conv As Conversation        Private Sub MainWindow_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load          Try              _LyncClient = LyncClient.GetClient()              _ConversationMgr = _LyncClient.ConversationManager              DisplayCurrentState()          Catch generatedExceptionName As ClientNotFoundException              MessageBox.Show("client is not running")          End Try      End Sub        Private Sub _ConversationMgr_ConversationAdded(ByVal sender As Object, ByVal e As Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs) Handles _ConversationMgr.ConversationAdded          AddHandler e.Conversation.Modalities(ModalityTypes.AudioVideo).ModalityStateChanged, AddressOf AVModalityStateChanged      End Sub        Private Sub AVModalityStateChanged(ByVal sender As Object, ByVal e As ModalityStateChangedEventArgs)          Select Case e.NewState              Case ModalityState.ConnectingToCaller                  'Insert your code here              Case ModalityState.Connecting                  'Insert your code here              Case ModalityState.Joining                  'Insert your code here              Case ModalityState.Transferring                  'Insert your code here              Case ModalityState.Disconnected                  'Insert your code here              Case ModalityState.Disconnecting                  'Insert your code here              Case ModalityState.Forwarding                  'Insert your code here              Case ModalityState.OnHold                  'Insert your code here              Case ModalityState.Suspended                  'Insert your code here          End Select      End Sub  

So as you can see, it’s quite a simple concept – which holds lots of potential!

Tagged with:  

20130510 124333 Fix: Constant credential prompts in Outlook 07 using 365

Today I have mostly been fighting with Microsoft Office Outlook 2007 and our Office 365 setup, as we are still in the early stages of deployment we have not yet implemented our ADFS servers. Which means we have are experiencing some pretty frustrating issues with Office and authentication.

One machine in particular decided to really test my patience and blankly refused to authenticate, presenting the user with a constant reoccurrence of the “Welcome back to Outlook.Office365″ login box.

As it happened the machine had seemed to avoid the installation of several service packs, including Office 2007 Service Pack 3, and also what turned out to be some pretty important KB hot fixes. Leaving me scratching my head for what seemed like a lifetime… That was until today! When I finally managed to find the relevant KB hot fixes and install them manually..

OFFICE VERSION NOTES
Latest version of Office System requirements for Office 2013 and Office 365 ProPlus
Office 2010 with Service Pack 1 Automatic updates:

  • Customers who sign up for Office 365 after February 27, 2013, must apply all automatic updates that were released before December 2012.
  • Customers who signed up for Office 365 before February 27, 2013, must complete the following:
    • By July 1, 2013, apply KB2553248.
    • By April 8, 2014, apply all automatic updates for Office 2010 that were released prior to December 2012.
Office 2007 with Service Pack 3 Automatic updates:

  • Customers who sign up for Office 365 after February 27, 2013, must apply all automatic updates that were released before December 2012.
  • Customers who signed up for Office 365 before February 27, 2013, must complete the following:
    • By October 1, 2013, apply KB2596598.
    • By April 8, 2014, apply all automatic updates for Office 2010 that were released before December 2012.
Office 2003 only through POP and IMAP For more information, see Office 365 will now support POP and IMAP connections to Outlook 2003.
Office for Mac 2011 with Service Pack 3 Mac OS X 10.6 or later is required.
Office 2008 for Mac 12.2.9 Support ends April 9, 2013.

The journey to 365 has been a long and winding one… This particular highlights the importance of ensuring all machines connecting to 365 are bang up to date with Windows and Office updates and service packs… Lesson learnt.

Tagged with:  

Microsoft Lync logo How I built an Ms Lync Bot formally known as D.A.V.E.Microsoft Lync is Microsoft’s latest offering of a unified communications system. Sporting features you’d expect to find in a SIP/Unified Comms client, Lync is a pretty powerful piece of kit.

What’s more, Microsoft offer an SDK to enable easy development of tools and add-ons using Lync technologies. Most of the tutorials and blog posts seem to focus on either C# or Silverlight, which is fine – however, as I am primarily a VB.Net developer I decided to publish my own guide on how to intercept and respond to received Lync messages.

Firstly, I need to point out that I have only had access to Lync for a couple of months now and only downloaded the SDK earlier this month.. So although the code below is functional, I am constantly learning and may find a better way of doing things as my learning continues. To make things easier, make sure you subscribe to the post and you’ll get an update each time I adjust the code.

You will need to download and install the Microsoft Lync SDK then fire up your copy of Visual Studio, create a new windows form project. Obviously you could use any type of project here, however I have plans for a GUI in the future so I am using a windows form project.

Now, open the code view of your new form and import the following:

Imports Microsoft.Lync.Model  Imports Microsoft.Lync.Model.Conversation

Now, under your “Public Class Form1″ but before your “Private Sub Form1_Load()” enter the following lines of code:

Public WithEvents _Client As LyncClient  Public WithEvents _ConversationMgr As Microsoft.Lync.Model.Conversation.ConversationManager  Private WithEvents _LocalIMModality As InstantMessageModality  Public _LycConversation As Microsoft.Lync.Model.Conversation.Conversation

That’s all there is to it for the declarations, as you can see I have used ‘WithEvents’ to expose the ‘methods’ in the GUI and make things a little easier developing with them.

Next in the “Form_Load()” event, paste in the following code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load          Try              _Client = LyncClient.GetClient()              _ConversationMgr = _Client.ConversationManager              Select Case _Client.State                  Case ClientState.Uninitialized                      _Client.BeginInitialize(AddressOf InitializeCallback, Nothing)                  Case ClientState.SignedIn                    Case ClientState.SignedOut                      _Client.EndSignIn(_Client.BeginSignIn(Nothing, Nothing, Nothing, Nothing, Nothing))              End Select          Catch ex As AlreadyInitializedException              MessageBox.Show("Another process has initialized Lync")          Catch ex As Exception            End Try        End Sub        Private Sub InitializeCallback(ByVal ar As IAsyncResult)          _Client.EndInitialize(ar)          _InitializeFlag = True          _Client.EndSignIn(_Client.BeginSignIn(Nothing, Nothing, Nothing, Nothing, Nothing))      End Sub

This essentially ties your code to the Lync client running on your machine, then using ‘automation’ it confirms the client is signed in, if not it signs in for you.

Now, your app is hooked into the Lync client, you will need to ‘capture’ the message received event and handle it appropriately.

Private Sub _ConversationMgr_ConversationAdded(ByVal sender As Object, ByVal e As Microsoft.Lync.Model.Conversation.ConversationManagerEventArgs) Handles _ConversationMgr.ConversationAdded  _LocalIMModality = TryCast(e.conversation.Participants(1).Modalities(ModalityTypes.InstantMessage), InstantMessageModality)        End Sub        Private Sub _LocalIMModality_InstantMessageReceived(ByVal sender As Object, ByVal e As Microsoft.Lync.Model.Conversation.MessageSentEventArgs) Handles _LocalIMModality.InstantMessageReceived  Dim strRec As String       strRec = e.Text.Replace(vbCr, "").Replace(vbLf, "").Replace("'", "''")  End Sub

As you can see from the post above, I am using the built in replace functionality of the string. This is because the Lync client passes line feeds after its message, which makes handling the received message quite complicated.

So, from the code above – each time an instant message is received by your Lync client the variable strRec will contain the received message.

Now, upon receipt of a message you may want to send a response – which is where my next code snippet comes in. The following Sub send’s an instant message to the participants of the conversation:

Public Sub SendIM(ByVal strMessage As String)          Dim modal = DirectCast(LycConversation.Modalities(Lyc.ModalityTypes.InstantMessage), InstantMessageModality)          modal.BeginSendMessage(strMessage, AddressOf SendMessageCallback, Nothing)      End Sub        Private Sub SendMessageCallback(ByVal r As IAsyncResult)        End Sub

From the code above, you should see the sub requires a string to be passed to it. This is what will be relayed to the client who sent the original message.

So there you have it, a fairly simple way of receiving and sending back a Lync ‘IM’.

Obviously, you may want to improve this slightly by trimming the received message and handling it depending on the users request. So, for example – you may want to ‘serve’ a simple weather forecast based on the users request. To do this all you need to do is enhance the ‘_LocalIMModality_InstantMessageReceived’ sub to include code something like this:

If InStr(strRec.ToUpper, "Weather", CompareMethod.Text) Then              GetWeatherReport(Mid(strRec.ToUpper, 9).ToString)              Exit Sub          End If

Now, create another sub which makes use of Yahoo’s weather forecasting, to reply to the Lync user with details of the local forecast:

Sub GetWeatherReport(ByVal locationId As String)          On Error GoTo ErrHand  1:      Dim YahooCode As Integer  2:      Select Case locationId              Case "ABERDEEN"  3:              YahooCode = 10243  4:          Case "LINLITHGOW"  5:              YahooCode = 26318  6:          Case "GLASGOW"  7:              YahooCode = 21125  8:          Case "IRVINE"  9:              YahooCode = 24544  10:         Case "BELLSHILL"  11:             YahooCode = 12318  12:         Case "CARLISLE"  13:             YahooCode = 15178  14:         Case "BLAYDON"  15:             YahooCode = 13018  16:         Case "HULL"  17:             YahooCode = 25211  18:         Case Else  19:             SendIM("Im not able to find the weather for the town you specified (" & locationId & ")")  20:             Exit Sub  21:             End Select    22:     Dim doc As New XPathDocument("http://weather.yahooapis.com/forecastrss?w=" & YahooCode & "&u=c")  23:     Dim nav As XPathNavigator = doc.CreateNavigator()    24:     Dim ns As New XmlNamespaceManager(nav.NameTable)  25:     ns.AddNamespace("yweather", "http://xml.weather.yahoo.com/ns/rss/1.0")  26:     Dim nodes As XPathNodeIterator = nav.[Select]("/rss/channel/item/yweather:condition", ns)    27:     While (nodes.MoveNext())  28:         Dim node As XPathNavigator = nodes.Current    29:         SendIM("The weather forecast for " & locationId & " is: " & node.GetAttribute("text", ns.DefaultNamespace).ToString() & ", with a temperature of " & node.GetAttribute("temp", ns.DefaultNamespace).ToString() & "°C")  30:     End While          Exit Sub  ErrHand:          SendIM("I can't seem to fetch the weather forecast right now " & Err.Description & " - " & Err.Number & " - " & Erl())      End Sub

As you can see from the code above, I have also built in the functionality for the Lync user to request weather for a couple of locations around the UK. This could be increased to as many as you want, or removed to only send details of one particular place.

Some other things you might want to consider would be for your ‘Bot’ to query a SQL table and pass back the results, or perhaps perform other functionality such as PING a device and send the reply details in an IM.

In a future blog post I will show you how to connect your new ‘BOT’ into a AI handler to provide an AI Bot capable of holding a ‘conversation’ of sorts.

As per my opening paragraph, I am very much in the early days of my Lync development – so if you have any suggestions on how I could improve the code above, please get in touch.

Tagged with:  
Page 1 of 41234

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!