Wednesday, August 24, 2011

Delegate control in SharePoint

SharePoint offers a fine way to override it's built-in functionality. With the help of delegate control you do not required to modify the existing master page to modify existing features.

First, create a empty SharePoint project, and specify the target web url. Next select 'Farm Solution' a deployment option. Now add one User Control in the SharePoint mapped folder 'Control Templates'. Add functionality to this user control based on the requirements.
Now, create one element file, and add the following xml.
< ?xml version="1.0" encoding="utf-8"? >
< Elements xmlns="http://schemas.microsoft.com/sharepoint/" >
  < Control Id="GlobalNavigation"
           Sequence="10"
           ControlSrc="~/_ControlTemplates/SampleTestNavigation/TestNavigation.ascx"/ >
< /Elements >


Here, GlobalNavigation control defined in the master page will be overridden by this custom control. The Sequence value should be less than 100. 


Deploy the solution. And the output will be look like this:

Sunday, August 21, 2011

Creating UDC in InfoPath forms

During development there is common requirement is to create InfoPath forms, those can be deployed into multiple servers. Once you completed the development in local DEV, the forms need to deploy in Stage and Prod. Here an issue arises, the connection. Since the path of different servers are different one need to create 'Universal Data Connection' (UDC) 


1) Create a connection for submit data, and follow the wizard

2) Create a Connection Library, then click on the 'Convert' button, this will generate one XML file. Specify a name of the connection with extension UDCX

3) After creating the UDCX file, on the InfoPath form, add a new connection and browse all the connections on the server.

4) Important, for each server, Staging, Prod etc you have to create data connection file with the same name. In this example submit.udcx. The forms will pick dynamically the connection based the respective servers.