title: Is it possible to set call forwarding via the Lync SDK (2013 or other)?
body: <p>I work for an IS department in a large institution. The Lync servers that handle our telephones are handled by another department, and any solution that requires cooperation from them is not viable. This rules out any solutions that require extra privileges, running from the Lync servers, SEFAUtil, etc. </p>
  
  <p>My personal Lync 2013 client has some abominable GUI menu where I can forward my desk phone to another number. I know therefor that it is possible, in theory.</p>
  
  <p>I have powershell code that (with a ton of SDKs installed) will login with my own personal credentials. The blog I grabbed it from allowed the script to send some arbitrary IM message (not very useful to me). It looks like this:</p>
  
  <pre><code>if (-not (Get-Module -Name Microsoft.Lync.Model)) {     
      try {       
          Import-Module -Name (Join-Path -Path ${env:ProgramFiles} -ChildPath "Microsoft Office\Office15\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.dll")
  -ErrorAction Stop   
      }
      catch {
          Write-Warning "Microsoft.Lync.Model not available, download and install the Lync 2013 SDK http://www.microsoft.com/en-us/download/details.aspx?id=36824"        break   
      }
  }
  
  $client = [Microsoft.Lync.Model.LyncClient]::GetClient()
  
  if ($client.State -ne [Microsoft.Lync.Model.ClientState]::SignedIn) {
      $client.EndSignIn(
          $client.BeginSignIn("x@x.com", "domain\johno", "youllNeverGuess", $null, $null)) 
  }
  
  if ($Client.State -eq "SignedIn") {
      Write-Host "DEBUG: We managed to sign in!" }
  }
  </code></pre>
  
  <p>This seems to work, in that if I supply it the wrong password, it barfs.</p>
  
  <p>From within the SDK, is it possible to set callfowarding to a particular number? Microsoft's horrible documentation demonstrates how to forward an incoming call that the script caught through an event handler, meaning that it'd have to run in a polling loop... and that I couldn't just iterate through a list of accounts to forward. From the GUI client, if you set your phone to forward to a number, it sticks even if you power down the machine, so it's sending something to the server that is semi-permanent. Can Lync SDK accomplish the same?</p>
  
  <p>Though Lync 2010 is deprecated, I would be happy with a solution based upon that. Powershell is preferred, but if you have code in VB or C#, again that would be ok too. I don't need the whole thing served up on a silver platter, just a few clues to work with.</p>