Share via


Update your Lync Note with a Quote of the Day – API Powershell

 

Following on playing with the API this script is just for fun. I have created a scheduled task that runs daily and updates the quote of the day for my Lync note…. have fun!

p.s it requires internet access!

Here is the sample code

image

and here is my updated Lync Client

 

image

 

here is the code so copy and paste

#Load Assembly
$assemblyPath = “C:\Program Files (x86)\Microsoft Office 2013\LyncSDK\Assemblies\Desktop\Microsoft.Lync.Model.DLL”
Import-Module $assemblyPath
$client = [Microsoft.Lync.Model.LyncClient]::GetClient()

#Get Qoute of the Day
$url = "https://feeds.feedburner.com/brainyquote/QUOTEBR"
$data = Invoke-RestMethod -Uri $url
$qotd = $data[0].description

#Publish QoTD to Note
$instanceSelf = $Client.Self
$noteInfo = New-Object 'System.Collections.Generic.Dictionary[Microsoft.Lync.Model.PublishableContactInformationType, object]'
$noteInfo.Add([Microsoft.Lync.Model.PublishableContactInformationType]::PersonalNote, $qotd)
$Publishnote = $instanceSelf.BeginPublishContactInformation($noteInfo, $null, $null)
$instanceself.EndPublishContactInformation($Publishnote)

Comments

  • Anonymous
    February 17, 2014
    cool stuff thanks
  • Anonymous
    May 19, 2014
    Where do i put this code in? Do I save it somewhere? thanks for sharing!!
  • Anonymous
    August 05, 2014
    The comment has been removed
  • Anonymous
    November 10, 2014
    Can I do the same with Lync 2010? If yes, please advice, the files Microsoft.Lync.Model.DLL is in a Zip file :'(
  • Anonymous
    May 27, 2015
    The comment has been removed
  • Anonymous
    June 25, 2015
    The comment has been removed