October 25, 2016
Hot Topics:

Modifying Spell Check for SharePoint Server 2007

  • September 5, 2008
  • By Gustavo Velez
  • Send Email »
  • More Articles »

In the code, create a StringBuilder that contains the SOAP call to the WebService. The SOAP envelope is directly added by using the following syntax:

static string EnvelopeSoap = @"<soap:Envelope


Then, immediately before closing the envelope, add the XML query with the following syntax:

static string MyQuery = @"<SpellCheck xmlns=
   <string>This rou</string>
   <string> has an error </string>

There are two strings in the query that need to be adjusted, namely "This rou" and "has an error", the Language Identifier is declared (1033) and the MOSS Language Identifier must be blocked with the code; useLead=false. As stated earlier, at this point you need to define the spell check Language Identifier if you are using a language other than English.

After the creation of the envelope and the query in a string, they are converted to a XmlDocument that can be used in the service call. The object "myQueryWeb" (of the "HttpWebRequest" type) is created using as input parameter the URL of the spell check WebService:

static string UrlChequerWS =

The object receives the default credentials of the user, the content type, the type of the method to be used, and finally, the form to send the envelope. The SOAP action type is added to the header in the following manner:

static string AccionSoap =

With this action, the envelope is assigned to the WebService call and using the interface, IAsyncResult, the anticipated result is asynchronous; this avoids a delay in the functioning of SharePoint while awaiting the response.

Finally, the call to the WebService is executed and the results come back in the form of a "WebResponse" object that is converted to a "StreamReader" that needs to be interpreted; the final result is a XML string, "ResponseSoap". The response of the example is in the form:

<?xml version="1.0" encoding="utf-8" ?>
   - <soap:Envelope xmlns:soap= "http://schemas.xmlsoap.org/soap/
      - <soap:Body>
         - <SpellCheckResponse
            - <SpellCheckResult>
               - <spellingErrors>
                  - <SpellingErrors>
                     - <flaggedWords>
                        - <FlaggedWord>
                           - <spellingSuggestions>
                              - <SpellingSuggestions>
                                 - <sug>

In the SOAP response, note that the corrector—in the first string (chunkIndex=0)—has identified an unknown word (FlaggedWord-word=rou), that probably has an error in the third character (offset=3). The suggestions section indicates that the unidentified word has six possible corrections in the dictionary. The second string is not found in the response, signifying it is accepted by the corrector.

The remaining code implementation is elemental and can be used in each SharePoint component (WebParts, WebControls, Web pages, and so forth). The last task is to extract the relevant information from the XML response and present it to the user in the desired way.

Page 2 of 4

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel