Tuesday, August 16, 2011

Adding Chat To Your SharePoint Site

Background

In keeping with providing a team site with all of the tools for immediate communication, adding chat just seems like a logical choice. This solution requires Office Communicator 2007 and a little bit of VBScript code and SharePoint Designer.
You will be creating a page with a simple drop down box with the emails of members of your team and a single ‘Start Conversation’ button.  I am keeping this small so that it can fit into a small webpart.
Ultimately, the ‘page’ will look like this:

Specify your data source. I created a list of my team members by first creating them in Outlook and then syncing them with my SharePoint list.
a.       Click ‘View All Site Content’
b.      Click ‘Create’
c.       Click ‘Contact List’ under the ‘Communication’ list
d.      When the list is created click ‘ActionsàConnect to Outlook’
e.      Click ‘Yes’

f.        On the left side you will see the new contact list highlighted

g.       Select your ‘Contacts’ list

h.      Drag and drop your ‘Contacts’ to the newly created list
i.         It should look like this when you are done

j.        When you go back to SharePoint, the contacts will also be there
2.       Now that you have your list, make it your data source
a.       Select the list from the Data Source tab

b.      Select ‘Copy and Modify’
c.       Select ‘Insert Data Source Control’
3.       Select ‘DropDownList’ from the ASP.Net controls and drag it on to your form

4.       Just above the drop down list control type ‘Instant Message A Team Member’
5.       Select ‘Input…Button’ from the ‘Form Controls’ (an ASP.net button will not work here) and drag it on to your page under the drop down box.

6.       Change the button ‘Value’ attribute to ‘Start Conversation’
7.       Your page should look like this:

8.       Set the data source for your dropdown box as spdatasource

9.       Set the displayed value as ‘Full Name’ and the value as ‘Email’
10.   Click ‘OK’
11.   Select the ‘Start Conversation’ button

12.   Update the tag with ‘onclick=”comm()”
13.   Go to the <Head></Head> tag of your page
14.   Place the following code within <script></script> tags

Function comm()
                                Dim Communicator
                                Dim selMail
                                selMail = document.form1.DropDownList1.value
                                 Set Communicator = CreateObject("Communicator.UIAutomation")
                                Communicator.AutoSignin
                                 Communicator.InstantMessage(selMail)
End Function


15.   When you run the program you will see this:

16.   Select a name from the box



17.   Click the ‘Start Conversation’ button is clicked you will see the following:

Add Chat as a Web Part

1.       To add this as a web part, simply choose ‘Add A Web Part’ on any web part page



2.       Select ‘Page Viewer Web Part’

3.       When presented with the following screen, select ‘Open the tool pane’

4.       Enter the URL of the page into the ‘Link’ text box (the URL will be the page that is presented when you click page preview in SharePoint Designer)
5.       The chat should fit into the web part perfectly