Raghu's SharePoint Corner: Ajax Integration With Microsoft Office Sharepoint Server

My blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://www.sharepointcolumn.com
and update your bookmarks.

May 20, 2008

Ajax Integration With Microsoft Office Sharepoint Server

ü MOSS 2007 (installed with site collection created on port: 80)
ü Visual Studio 2005
ü
SharePoint 2007 Extensions for Visual Studio 2005
ü
ASP.NET 2.0 AJAX 1.0
ü
Ajax Control Toolkit

Configuring Web.config file for the site which you have created.
1.Edit your SharePoint web.config file on which you are going to deploy Ajax based web parts, typically in a directory like C:\inetpub\wwwroot\wss\virtualdirectories\80

2.Add the following Section Group tag under the <-configSections>
<-configSections>
<-sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<-sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<-section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> <-sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<-section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
<-section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<-section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />



3. Add a <-controls> section as a child of the <-system.web>/<-pages> tag.
<-pages>
<-controls>
<-add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>


4. Add the following tag to the tag, within :
<-assemblies>
<-add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>


5. Add some new registrations to the end of the <-httpHandlers> section:
<-httpHandlers>
<-add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<-add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<-add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>

6. Add a new registration to the HttpModules section, beneath any existing registrations.
<-httpModules>
<-add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

7. Add a SafeControl entry for the System.Web.UI namespace from Microsoft Ajax Extensions, within the <-SharePoint>/<-SafeControls>section:
<-SafeControls>
<-SafeControl Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TypeName="*" Safe="True" />


8. Finally, add the following configuration tags at the bottom of web.config, near the bottom before the end <-configuration> tag.
<-system.web.extensions>
<-scripting>
<-webServices>
<-!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<-!-- <-authenticationService enabled="true" requireSSL = "truefalse"/>
-->
<-!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and writeAccessProperties attributes. -->
<-!-- <-profileService enabled="true" readAccessProperties="propertyname1,propertyname2" writeAccessProperties="propertyname1,propertyname2" />
-->

<-!-- <-scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
<-/scripting>
<-/system.web.extensions>
<-system.webServer>
<-validation validateIntegratedModeConfiguration="false"/>
<-modules>
<-add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<-handlers>
<-remove name="WebServiceHandlerFactory-Integrated" />
<-add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<-add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<-add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<-/handlers>
<-/system.webServer>


Add The Script Manager To Master Page Of The Site
This is done in order to avoid multiple script managers on the same page

1. Open the master page from the SharePoint Designer under _catalogs folder
Ex:
http:machinename:8888/_catalogs/masterpage/default.master
2. Add the following tag (preferably below <-WebPartPages:SPWebPartManager id="m" runat="Server" />)
<-asp:ScriptManager runat="server" ID="ScriptManager1">

No comments: