It’s been a year and a half since I last posted and a while a lot has changed plenty still remains the same. I found myself thinking today of the old cliche adage “If I have seen further it is by standing on the shoulders of giants.” I greatly appreciate the work of those that came before me and shared their knowledge freely; be it in person, online, or via a blog posting. I have learned so much from others but I feel like I haven’t done much to give back lately to the wider community, so I’d like to change that. I’ve amassed a collection of scripts, utilities, and even just code snippets over the past couple years and I am working to get them cleaned up and published. All will be released under the Creative Commons license free for personal use with attribution.
To start with I have the following script / snippet which shows how to connect to a Lync Environment via UCWA and PowerShell. I would like to get further with this tool and actually implement full conversations via Instant Message. For now though it illustrates how to complete the Lync Discover process, authenticate via OAuth to receive an OAuth token and how to view a users contact list and their presence.
Microsoft does make information publicly available on building UCWA web applications, and I knew that PowerShell 3.0 added some additional functionality via the Invoke-WebRequest, ConvertTo-Json, and ConvertFrom-Json cmdlets. I figured that given all of this, I should be able to connect to Lync through UCWA and that it would just be a matter of figuring out what is required to get it all talking. I’ve spent about 10-15 hours so far playing around with this in my free time figuring what it needs to work and what the proper syntax structure and format are for the process.
So far I’ve implemented two functions that produce user specific data. Those are Get-UserContactList and Get-UserContactListPresence. While there are several other functions in the script they only handle the log in and authentication functionalities. Examples of the Contact List functions are shown in the screenshots below.
When running the script the first thing you will notice is a credential prompt, it is very important to note that the user name here should be the AD UPN and may or may not match the user SIP address.
This image shows the results of the Get-UserContactList function which will show all details for all contacts.
The script can be downloaded here: New-PsUCWASession
This work is licensed under a Creative Commons Attribution 4.0 International License.