Friday, February 5, 2010

Deploying a User Control in MOSS 2007 with Feature

To deploy our user control, Follow below given steps,
 Copy the user controls ascx and cs into directory
~\12\template\controltemplates
Need to create two file Feature.xml and Control.xml


Feature.xml
—————–
#?xml version="1.0″ encoding="utf-8″ ?#
#Feature Id="Generate New GUID"
Title="UserControlTest"
Scope="Farm"
Description="UserControlTest"
Version="1.0.0.0"
xmlns="http://schemas.microsoft.com/sharepoint/"
Hidden="FALSE"#
#ElementManifests#
#ElementManifest Location="control.xml" /#
#/ElementManifests#
#/Feature#

You can define you feature scope in xml attribute 'Scope'.Here we are using farm level for this feature.

control.xml
—————–
#?xml version="1.0″ encoding="utf-8″ ?#
#Elements xmlns=”http://schemas.microsoft.com/sharepoint/"#
#Control Id="UserControlTest"
Controlsrc="~/_controltemplates/ UserControlTest.ascx" Sequence="90″#
#/Control#
#/Elements#

Create a folder to keep these xml files
~\12\TEMPLATE\FEATURES\#Folder Name#

Copy the both files feature and control in the above location
~\12\TEMPLATE\FEATURES\#Folder Name#\Feature.xml
~\12\TEMPLATE\FEATURES\#Folder Name#\control.xml

Now use stsadm to register feature
stsadm -o installfeature -filename CustomQuickLaunch\Feature.xml

Now Open the aspx page on which you want to deploy the control in SharePoint designer add this where you want to deploy the control

#SharePoint:DelegateControl ControlId="UserControlTest" runat="server"##/SharePoint:DelegateControl#

Custom Workflow in SharePoint (Sharepoint Designer Vs Visual Studio)



Using SharePoint Designer


Using Visual Studio




Can write only sequential workflows.


Can write both sequential and state machine workflows.


Automatic deployment against the specific list or library against which workflow is being designed.


Can be deployed as a feature.


Logic is defined declaratively using Steps which comprises of Conditions and Actions


Logic could be defined through custom code written using C# or VB.NET.


Workflows could be associated to a specific list or library.


Workflow can be authored as Template which once deployed could be associated with any list or library.


Workflow modifications not possible.


Workflow modifications are possible using Modification forms built using ASP.NET or InfoPath form.


Workflow markup, rules all are stored as a document library on the site.


Workflows are compiled as an .NET assembly.


Can’t be debugged.


Debugging is possible using Visual Studio.