Migrating Users in Skype For Business

I recently had to migrate a ton of users from one Skype For Business Pool to a new one.

Step 1: Get the Users

To get started we wanted to to see what we were working with so I wrote the following Powershell script that output a CSV file with all of our users that we wanted to migrate in it.

$dayStart = get-date
$dayEnd = $dayStart.AddDays(-300)
get-aduser -Filter ‘Enabled -eq $true -and lastlogondate -gt $dayEnd -and  UserPrincipalName -notlike “system-*” -and mail -ne “$null”‘ -properties *  | Select-Object DisplayName, SAMAccountName, Department, SipAddress, Enabled, LastLogonDate, msRTCSIP-UserEnabled, msRTCSIP-PrimaryUserAddress | Export-CSV c:\Existing_Lync_Users.csv

You can add as many parameters as you want to the filter and there is some interesting information here on how to structure your WHERE clauses.  For me I wanted to make sure the user was enabled, had logged in at least once in the past 300 days and the account was not an admin type account (note the above ‘system-‘ filter is made up and not the real one).

From there, this exported all the information into a handy, dandy CSV file that I could filter as I saw fit.

Step 2: Move the Users

Import-Csv c:\Existing_Lync_Users.csv | ForEach-Object {Move-CsUser -Identity $_.UserPrincipalName -Target “new-pool-name” -Confirm:$False}

If I was using the outputted CSV file at face value, I could run the following to migrate all our users, but you can take your original CSV and filter by department or some other value to minimize the resultset.  For each row that was found, I executed the Move-CsUser comand to the new target pool and disabled the confirmation so it would not prompt me for each user.

 

 

UCMA Toast Messages and Conversation Subjects

When sending an Instant Message through UCMA you have a few options available to you that simplify the setting of a conversation’s subject.  This can be useful for a user who might have a myriad of ongoing conversations and needs to know the content of what is incoming and what is ongoing.

Enter the Toast Message and the Conversation Subject.

The Toast MessageThe Toast Message is the alert you receive in the bottom right corner of your screen that alerts you to an incoming IM.  This message is fully customizable but is only instantiated when the call is established.  In this example, I have a variable called _conversationSubject which I pass into my BeginEstablish method that sets the value of the ToastMessage for the conversation.

Toast Message

_instantMessagingCall.BeginEstablish(DestinationUri, new ToastMessage(_conversationSubject), null, CallEstablishCompleted, _instantMessagingCall);

After the IM has been opened, the ToastMessage subject is no longer applied to the conversation and the conversation defaults to the SFB default subject (name of the person you are chatting with).

Conversation Settings

The Conversation settings are different in nature as they are set BEFORE the InstantMessagingCall is created (i.e., before a Toast Message is established).  The implementation is again very simple where I instantiate the ConversationSettings object, add in my subject and then proceed to initialize the call.

ConversationSettings convSettings = new ConversationSettings(); 
convSettings.Id = Guid.NewGuid().ToString(); 
convSettings.Subject = _conversationSubject; 
Conversation conversation = new Conversation(transferee, convSettings); _instantMessagingCall = new InstantMessagingCall(conversation);

Leveraging both the ConversationSettings and ToastMessage classes, give you the power and flexibility to ensure that you are either delivering a consistent user implementation and/or a more targeted experience based on the severity of call that is coming in.

Although this might seem unnecessary for a User to User Instant Message Conversation, where it really starts to shine is when an agent is handling multiple IM conversations that interact with the same Application Endpoint.

UCMA – I’m Writing a Message

I was working on a UCMA (Unified Communications Managed API) issue the other day and wanted to integrate the “Is Writing a message” functionality that is oh so important in any chat conversation today.  My application is pretty simple, a chat bot is listening to incoming requests and directing them to their intended recipient.

You can see this in some of the built in examples, but if you haven’t looked there yet, this functionality is quite easy to implement.

In your MessageReceived event from your Message Flow, simply add the following line into the event before you send back your reply and this will trigger an event to fire when this occurs.

MessageFlow.LocalComposingState = ComposingState.Composing;

And that’s it, now you can know when the receiving user start to type a response, even when they take a pause only to have it fire again.