Microsoft Lync and Skype for Business have a rich set of .NET APIs which make it easy to extend the platform and integrate it with other applications. This blog helps explain how to use those APIs.

What You Can and Can’t Do With Federation

Posted: November 18th, 2016 | Author: | Filed under: Uncategorized | No Comments »

With federation and hybrid deployments currently being the only way to get UCMA applications communicating¬†with Skype for Business Online tenants, federation is even more important than before. This post details what a UCMA application can and can’t do when communicating across a federation boundary. Continue reading “What You Can and Can’t Do With Federation” »

UCMA and Office 365: Updates

Posted: November 12th, 2016 | Author: | Filed under: Uncategorized | No Comments »

In an earlier post, I talked about how UCMA applications work with Office 365 users. Since some time has passed, I thought I’d post an update outlining what has changed and what hasn’t when it comes to UCMA compatibility with Office 365 and Skype for Business Online. Continue reading “UCMA and Office 365: Updates” »

Why so opaque?

Posted: December 21st, 2012 | Author: | Filed under: Lync Development, Uncategorized | Tags: , , , , | No Comments »

If you’ve done much sifting through Lync Server logs, you have probably noticed the SIP URIs that have an extra parameter tacked on the end named opaque. You may have wondered what all of this opaque stuff means, and what purpose it serves. This post will explain the opaque parameter, so that you can interpret it in Lync logs, use it in your applications, and impress your friends at parties (actually, maybe only at Lync user group meetings). Continue reading “Why so opaque?” »

XML serialization using generics

Posted: February 23rd, 2009 | Author: | Filed under: Uncategorized | No Comments »

Generics are one of my favorite bits of C# syntax. They regularly come in handy for making code more elegant and readable. For example, I love using them in applications that do a lot of deserializing, especially if there is anything else (logging, maybe) that I want to be sure of doing at the same time. The method I use looks something like this:

public T Deserialize(string xml) where T : class
    if (string.IsNullOrEmpty(xml))
        throw new ArgumentNullException("xml cannot be null or empty");
    XmlSerializer serializer = new XmlSerializer(typeof(T));
    T obj;
    using (StringReader reader = new StringReader(xml))
        obj = (T)serializer.Deserialize(reader);
    _logger.Log(string.Format("Deserialized {0}", obj));
    return obj;

The T in the angle brackets represents the type of the object that I am trying to deserialize. (It doesn’t have to be the letter T, actually; it can be any valid variable name.) You can restrict the possible types with the where keyword; here, the where T : class after the method declaration specifies that the type must be a class, so if someone tries to use Deserialize, they will get a compiler error. You can also use the T to set the return type, so that the return type of the method can vary. Last but not least, if you are in Boston you can use the T to get from South Station to Harvard Square.

The beauty of this approach is that everything remains strongly-typed. If I deserialize a GolgiApparatus object using Deserialize, the return value will be an GolgiApparatus. There’s no need to identify the object return value as a GolgiApparatus. I can write code like this:

GenericXmlSerializer xml = 
    new GenericXmlSerializer(new Logger());
GolgiApparatus ga = new GolgiApparatus();
Exception ex = new Exception("you can't do that");
string serializedGolgi = xml.Serialize(ga);
string serializedException = xml.Serialize(ex);
GolgiApparatus reconstitutedApparatus = 

In my experience,any time you need to cast a return value from object to some other type,you can clean it up using either a generic method or a generic class.

Incidentally, my Serialize method, which doesn’t need to use generics, usually looks something like this:

public string Serialize(object obj)
    if (obj == null)
        throw new ArgumentNullException("obj cannot be null");
    XmlSerializer serializer = new XmlSerializer(obj.GetType());
    string xml;
    using (StringWriter writer = new StringWriter())
        serializer.Serialize(writer, obj);
        xml = writer.ToString();
    _logger.Log(string.Format("Serialized {0}", obj.ToString()));
    return xml;