Pages

Oct 12, 2010

Exchange (Outlook) distribution list (mailing group) not showing up in SharePoint

Scenario: There is a distribution list you can see and use in outlook, but when you search for the same list in SharePoint it doesn’t show up in the people picker. What gives?

Chances are that the distribution list is not security enabled. This would need to be done by your domain administrator. He would need to change the ‘Group Type’ of the list from ‘distribution’ to ‘security’. Once this is done your SharePoint administrator would need to run a profile import so SharePoint can pick up the change immediately (alternatively you can let SharePoint automatically pick it up during its scheduled AD crawl).

Oct 11, 2010

Adding Spell Checker to custom SharePoint Pages

If you have been doing SharePoint development for some time it is more than likely that you have developed your fair share of custom pages and custom controls/webparts for MOSS 2007. Where possible I try and leverage the existing SharePoint controls (such as the People Picker) to use on my pages as Microsoft has already done all the work developing these controls. One aspect I had never been able to get going until recently though was adding a spell checker control to my pages. I have just discovered that this is alot easier than I thought.

To add the out of the box spell checker all you need to do is:
1. Make sure you have the right page directive on the page you are adding the control to

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

2. To the head of your page, add the following controls, which will give you the javascript required for the spell checker to run:

<SharePoint:ScriptLink ID="ScriptLink1" Language="javascript" Name="core.js" runat="server" />
<SharePoint:ScriptLink ID="ScriptLink2" Language="javascript" Name="bform.js" runat="server"
/>
<SharePoint:ScriptLink ID="ScriptLink3" Language="javascript" Name="SpellCheckEntirePage.js" runat="server" />

3. Add the following block of javascript code to your page:

<script language="javascript" type="text/javascript">
function doSpellCheck() {
SpellCheckEntirePage('/_vti_bin/SpellCheck.asmx', '/_layouts/SpellChecker.aspx');
}script>

4. Now all you need to do is create a link or a button which starts the spell checker. to this you just need to add the onclick javascript method 'doSpellCheck()'

class="ms-toolbar" href="javascript:doSpellCheck()">Spelling...a>

As a result of using this on click event, SharePoint will invoke a popup control which will enable your users to run a spell check against any input control that is on your page. Of course there might be certain controls on your page that you do not want to spell check against (such as People Pickers!) so all you need to do is add the attribute excludeFromSpellCheck="true" to any control that should not be spell checked:

<asp:TextBox ID="txtDontSpellCheck" runat="server" CssClass="ms-long" excludeFromSpellCheck="true">asp:TextBox>

All in all, for a few lines of code, this really adds a heck of a lot of power and useability to your custom SharePoint pages!