Handling Lync Exceptions (Lync 2010 SDK)
The exception classes that are defined by Microsoft Lync 2010 API are inherited from the System.Exception class but do not provide additional members beyond the Exception members. Use the specific Lync 2010 API exception to indicate the kind of error condition that generated an exception.
Exception Scenarios
The following exception scenarios are handled by specific exception classes. All Lync 2010 API exceptions are inherited from the Microsoft.Lync.Model.LyncClientException class.
Microsoft Lync 2010 client exceptions:
The Microsoft.Lync.Model.AlreadyInitializedException exception is raised when Lync 2010 has already been initialized. Normally, this exception is raised when a different process has initialized Lync 2010. You initialize Lync 2010 when the value of the LyncClient.InSuppressedMode property is true.
The Microsoft.Lync.Model.NotInitializedException exception is thrown when you try to access Lync 2010 API and Lync 2010 is not initialized. Initialization is required when the value of the LyncClient.InSuppressedMode property is true.
The Microsoft.Lync.Model.NotStartedByUserException exception is thrown when Lync 2010 is not available. Lync 2010 may not be running or running with user credentials while your custom application is running with administrator credentials.
Client State Exceptions:
The NotSignedInException exception applies when the user is not signed in to Lync 2010.
Collection Exceptions:
The Microsoft.Lync.Model.ItemAlreadyExistException exception is raised when you attempt to add a duplicate contact to a collection such as a Microsoft.Lync.Model.Group.ContactCollection.
The Microsoft.Lync.Model.ItemNotFoundException exception is raised when you attempt to retrieve an item from a collection when it does not exist. If an item is possibly not part of a collection, you can use the GroupCollection.TryGetGroup method to retrieve an item.
Operation Exceptions:
The Microsoft.Lync.Model.RequestCanceledException exception is raised when you attempt to cancel an operation that has already been canceled.
The Microsoft.Lync.Model.ResultOverflowException exception is raised when a search operation returns more than the maximum specified search results.
The Microsoft.Lync.Model.LyncClientException exception is raised when an operation such as a InstantMessageModality.BeginSendMessage method call cannot be completed due to a change in the state of a remote conversation participant. You catch the exception when it is raised by the InstantMessageModality.EndSendMessage method.