Loading...

Saturday, May 1, 2010

Building the Custom Activities for Workflow

Hello All,

                   This is how Custom activity  can be added for sharepoint designer workflow
step        1)Select Custom Workflow Library project


step 2) Set the required properties in Code behind which will act like parameters




step 3)Create .actions file as shown in following Images

step 4) Make its entry in web.config under authorized types


and Configure the workflow in sharepoint designer. For more info  watch the how to Custom Activity

Generating Solution Packages to Deploy at Production Server

Hello All,
here I will enlist the ways to generate the solution package

The smartest way
1)
•Right-click on your project in Visual Studio Solution Explorer and go to Properties
•Go to the Build Events tab
•Enter the following in the Post-Build event command line section
cd $(SolutionDir)makecab /f Solution.ddf

2)Using the WSP Builder which is available @http://www.CodePlex.com/WspBuilder

3)To Know whats going on behind the Scenes
Watch this how to Configuring and Deploying Workflows to SharePoint Server 2007 Using Solution Packages

Then Run Add Solution, Deploy solution, install feature and
activate feaure Commands to deploy the WSP to SP site

Sunday, April 11, 2010

Querying The List of SharePoint With ServerTemplate ID and Display the result in SPGridView

Create a webpart and initialize the SPGridView control


private SPGridView grid;

protected override void CreateChildControls() {
base.CreateChildControls();
// create and add the gridview control
this.grid = new SPGridView();
this.grid.AutoGenerateColumns = false;
this.Controls.Add(this.grid);
}


On PreRender Query list ServerTemplate ID
for contact list as follows

protected override void OnPreRender(EventArgs e) {
base.OnPreRender(e);
SPWeb site = SPContext.Current.Web;
SPSiteDataQuery query = new SPSiteDataQuery();

query.Lists = @"<lists servertemplate="105">"
      query.ViewFields = @"<fieldref name="ID">" + <br />
                          "<fieldref name="FirstName">" +
                          "<fieldref name="Title">";
     
      query.Webs = @"<webs scope="Recursive">";


DataTable dtResults = site.GetSiteData(query);
DataView dv = new DataView(dtResults);

// set up the field bindings
SPBoundField boundField = new SPBoundField();
boundField.HeaderText = "Last Name";
boundField.DataField = "Title";
this.grid.Columns.Add(boundField);

boundField = new SPBoundField();
boundField.HeaderText = "First Name";
boundField.DataField = "FirstName";
this.grid.Columns.Add(boundField);

this.grid.AutoGenerateColumns = false;
this.grid.DataSource = dv;
this.grid.DataBind();

this.grid.AllowSorting = true;
this.grid.HeaderStyle.Font.Bold = true;

}

Saturday, March 20, 2010

List of the .files in Sharepoint and its Use and reference

1).actions file --> to add the custom conditions in workflow
2)Element.xml and Feature.xml
Feature.xml will have the location of element.xml
element.xml will have the custom actions which will contain information about executable code

Sunday, January 10, 2010

Some things in SharePoint .. Should be Known Commonly..



We all know that whenever we add a list item or do some modification, we update the list. Here we have two options:
A)
1)List.Update() creates automatically new version of list
2)List.SystemUpdate()does not create automatically new version of list.


B)SPQuery

To Query for items inside the folder
SPQuery.ViewAttributes = "Scope='Recursive'";
or
SPQuery.ViewAttributes = "Scope='RecursiveAll'
";


C)Adding a Recurring Event to Lists on Multiple Sites


D) To impersonate user checking out a file.

SPSite site = new SPSite("SiteCollection_Url");
SPWeb web = site.OpenWeb();
SPUser user = web.AllUsers["User_Name"];
SPUserToken token = user.UserToken;
SPSite impersonatedSiteCollection = new SPSite("SiteCollection_Url", token);


E)Enabling the Send To Record option Enabled
SPAdministration wp=new SPAdministration();
Uri url=new Uri("//portal/records/_vti_bin/officialfile.asmx")
app.officialFileuri=url;
app.officialFilename="Record";
app.Update();

F)To send the email to site users when item is added to custom list
Write the event handler for ItemAdding event and write following
SPSite site = new SPSite("http://yoursite");
SPWeb web = site.OpenWeb();
SPList lst = web.Lists["Alert Test"];
SPAlert alert = web.Alerts.Add();
alert.AlertFrequency = SPAlertFrequency.Immediate;
alert.AlertType = SPAlertType.List;
alert.EventType = SPEventType.All;
alert.DynamicRecipient = "To";
alert.List = lst;
alert.Status = SPAlertStatus.On;
alert.Title = “Auto Email Alert”;
alert.Filter = "";
alert.Update();


G)A very Nice tool for Workflow aspx forms

H)
a)WSP Builder
b)Creating Custom fields using WSP Builder
c)
Overriding GetvalidateString Method of Custom field for validation


I)Creating site definition in sharepoint
Site definition have following files
ListTemplateID
a)WEBTEMP.XML
Path:- Local_drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\TEMPLATE\1033\XML
Description:- Specifies configurations of lists and modules for a site definition.


b)ONET.XML
Path :-Local_drive:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\TEMPLATE\1033\*\XML
Decription:-Defines navigation bars such as the top link bar and the quick launch, available lists, document templates, base types, configurations, modules

c)
SCHEMA.XML

Path :- Local_drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\TEMPLATE\1033\Custom_Site_Template\LISTS

Decription:-Defines the columns, views, and contents of a list