With the Lync 2013 C# SDK interfacing with 2015 Skype For Business, occasionally when I initiate a video call my application gets into a state where Lync is repeatedly throwing an UnauthorizedAccessException. Similar to this question, I'm running Skype for Business (15.0.4569.1506) in UISuppression mode and the issue happens when I set the owner of the video window.
System.Windows.Threading.DispatcherUnhandledExceptionEventArgs — System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at Microsoft.Office.Uc.VideoWindowClass.set_Owner(Int32 Owner)
at Microsoft.Lync.Model.Conversation.AudioVideo.VideoWindow.set_Owner(Int32 value)
Closing the application and restarting it resolves the issue temporarily, but it reoccurs again. Reproducing the issue is unpredictable.
What would cause this to happen seemingly at random, and then at other times to work perfectly?
We were finally able to consistently reproduce this issue. We saw the UnauthorizedAccessException whenever we ran our application as an administrator.
Fortunately our application does not require elevated privileges. Our solution was to stop our application from launching with elevated privileges.
We were also considering looking into launching the Skype client without elevated privileges, but the first approach solved our problem.