tag:blogger.com,1999:blog-31179437422019442192024-02-20T00:50:48.920-08:00SharePointPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.comBlogger37125tag:blogger.com,1999:blog-3117943742201944219.post-45746802070315926342011-06-08T11:48:00.000-07:002011-06-08T11:49:34.308-07:00System.ServiceModel.ProtocolException was unhandled by user code Message=The remote server returned an unexpected response: (405) Method Not Allowed.Go to control panel : Programs and Feature : Turn windows features on/off [found on the left side navigation bar] :Microsoft .Net Framework 3.0 : Turn on WCF HTTP Activation Checkbox<br />
<br />
<br />
This resolves the following exception.<br />
System.ServiceModel.ProtocolException was unhandled by user code Message=The remote server returned an unexpected response: (405) Method Not Allowed.<br />
<br />
Source=mscorlib<br />
StackTrace:<br />
Server stack trace: <br />
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)<br />
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)<br />
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)<br />
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)<br />
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)<br />
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)<br />
atPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-78876143950310376992011-03-09T07:46:00.000-08:002011-03-09T07:46:46.688-08:00Windows PowerShell and SharePoint Commandsgo to Windows Powershell located at<br />
<br />
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe<br />
you can also reach here from Accessories>WindowsPowershell<br />
<br />
Type following command<br />
add-pssnapin microsoft.sharepoint.powershell<br />
<br />
you can verify by typing following command<br />
get-command -noun sp*<br />
<br />
this should return you thousands of commands available.Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com1tag:blogger.com,1999:blog-3117943742201944219.post-81311092878586053102011-02-28T07:49:00.000-08:002011-02-28T07:49:50.445-08:00WebPart to Upload to sharePoint Document Lib using SharePoint Object Model//Following code using SharePoint Object Model and Fileupload class.<br />
//It uploads a docuent to 'Shared Documents' document library.<br />
<br />
<br />
using System;<br />
using System.ComponentModel;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using Microsoft.SharePoint;<br />
using Microsoft.SharePoint.WebControls;<br />
<br />
namespace DocLibActivities.DocLibActivities<br />
{<br />
[ToolboxItemAttribute(false)]<br />
public class DocLibActivities : WebPart<br />
{<br />
<br />
FileUpload oFileUploader; <br />
protected override void CreateChildControls()<br />
{<br />
oFileUploader = new FileUpload();<br />
this.Controls.Add(oFileUploader);<br />
<br />
<br />
<br />
}<br />
void btnUpload_Click(object sender, EventArgs e)<br />
{<br />
<br />
string strFilename = oFileUploader.FileName;<br />
using (SPWeb objThisWeb = SPContext.Current.Web)<br />
{<br />
SPFolder objTargetFolder = objThisWeb.Lists["Shared Documents"].RootFolder;<br />
foreach (SPFile objFile in objTargetFolder.Files)<br />
{<br />
if (Context.Request.InputStream.Length != null)<br />
{<br />
<br />
System.IO.Stream oIOStream = Context.Request.InputStream;<br />
byte[] fbytes = new byte[oIOStream.Length];<br />
oIOStream.Read(fbytes, 0, (int)oIOStream.Length);<br />
oIOStream.Close();<br />
SPFile oSPNewFile = objTargetFolder.Files.Add(strFilename, fbytes, true);<br />
oSPNewFile.CheckOut();<br />
<br />
}<br />
this.Page.Response.Redirect(objThisWeb.Url + "/" + objTargetFolder.Url);<br />
}<br />
}<br />
<br />
}<br />
<br />
<br />
}<br />
}Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-86133337571551026662011-02-28T06:33:00.000-08:002011-02-28T06:33:01.146-08:00Iterating through SharePoint Document library and get File infoSPWeb oSpWeb = SPContext.Current.Web;<br />
SPFolder oSPF = oSpWeb.Lists["Shared Documents"].RootFolder;<br />
<br />
foreach (SPFile oSPfile in oSPF.Files)<br />
{<br />
if (oSPfile.CheckOutType == SPFile.SPCheckOutType.None)<br />
{ <br />
LiteralControl ltc= new LiteralControl(string.Format("<br/>File {0} : {1} : {2}", oSPfile.Name,"Not Checked Out", oSPfile.CheckInComment));<br />
this.Controls.Add(ltc);<br />
<br />
}<br />
else<br />
{<br />
LiteralControl ltc= new LiteralControl(string.Format("<br/>File {0} : {1} : {2}", oSPfile.Name,"Checked Out", oSPfile.CheckInComment));<br />
this.Controls.Add(ltc);<br />
}<br />
<br />
}Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-39410200570895741402011-02-27T15:42:00.000-08:002011-02-27T15:42:02.973-08:00SharePoint 2010 Visual Webpart and List and SPGridView PopulationSharepoint list name: VSProducts<br />
This has three fields ID,Manufacturer, Name<br />
Following grid view get populated using the following code.<br />
<br />
.ascx<br />
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %><br />
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <br />
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <br />
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><br />
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %><br />
<%@ Import Namespace="Microsoft.SharePoint" %> <br />
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><br />
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RenderingData.ascx.cs" Inherits="RenderingData.VisualWebPart1.VisualWebPart1UserControl" %><br />
<SharePoint:SPGridView runat="server" ID="SPGView" AutoGenerateColumns ="false" ></SharePoint:SPGridView><br />
<br />
<br />
code behind<br />
<br />
<br />
using System;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using Microsoft.SharePoint;<br />
using Microsoft.SharePoint.WebControls;<br />
using System.Data;<br />
<br />
namespace RenderingData.VisualWebPart1<br />
{<br />
public partial class VisualWebPart1UserControl : UserControl<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<br />
if (!Page.IsPostBack)<br />
{<br />
populateSPGrid();<br />
}<br />
<br />
<br />
}<br />
protected void populateSPGrid()<br />
{<br />
using (SPSite oSPSite = new SPSite(SPContext.Current.Web.Url))<br />
{<br />
using (SPWeb oSPWeb = oSPSite.OpenWeb())<br />
{<br />
<br />
SPList oList = oSPWeb.Lists["VSProducts"];<br />
SPListItemCollection oListCollection = oList.Items;<br />
DataTable table = new DataTable();<br />
<br />
table.Columns.Add("ID", typeof(string));<br />
table.Columns.Add("Manufacturer", typeof(string));<br />
table.Columns.Add("Name", typeof(string));<br />
<br />
// Create rows for each splistitem<br />
<br />
DataRow row;<br />
<br />
foreach (SPListItem oSPListItem in oListCollection)<br />
{<br />
<br />
row = table.Rows.Add();<br />
<br />
row["ID"] = oSPListItem["ID"].ToString();<br />
<br />
row["Manufacturer"] = oSPListItem["Manufacturer"].ToString();<br />
<br />
row["Name"] = oSPListItem["Name"].ToString();<br />
<br />
}<br />
<br />
// create the bound fields<br />
<br />
SPBoundField boundField;<br />
<br />
boundField = new SPBoundField();<br />
<br />
boundField.HeaderText = "ID";<br />
<br />
boundField.DataField = "ID";<br />
<br />
boundField.ItemStyle.HorizontalAlign = HorizontalAlign.Center;<br />
<br />
boundField.ItemStyle.Wrap = false;<br />
<br />
SPGView.Columns.Add(boundField);<br />
<br />
<br />
<br />
<br />
<br />
boundField = new SPBoundField();<br />
<br />
boundField.HeaderText = "Manufacturer";<br />
<br />
boundField.DataField = "Manufacturer";<br />
<br />
SPGView.Columns.Add(boundField);<br />
<br />
<br />
<br />
boundField = new SPBoundField();<br />
<br />
boundField.HeaderText = "Name";<br />
<br />
boundField.DataField = "Name";<br />
<br />
SPGView.AutoGenerateColumns = false;<br />
<br />
SPGView.Columns.Add(boundField);<br />
<br />
<br />
<br />
<br />
<br />
SPGView.DataSource = table.DefaultView;<br />
<br />
SPGView.DataBind();<br />
<br />
}<br />
<br />
}<br />
<br />
}<br />
<br />
}<br />
}Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-49775395118648277762011-02-17T11:53:00.000-08:002011-02-17T11:53:40.356-08:00Iterating through SPweb, SPlist and populating TreeviewFollowing code makes a tree view for a site (web) and its child sites, their lists.<br />
It also displays the number of items each of that list has.<br />
<br />
It’s a small Administration utility and very helpful for understanding how to iterate through spsite, spweb and lists.<br />
<br />
I used Visual studio 2010. Its great tool to work with SharePoint 2010.<br />
This really a great relied in terms of developing a webpart, packaging and deploying.<br />
<br />
I have a user control there I added a tree view, name 'tviewSiteStructure'.<br />
<br />
using System;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using Microsoft.SharePoint;<br />
<br />
namespace SiteStructure.SiteStructureWebPart<br />
{<br />
public partial class SiteStructureWebPartUserControl : UserControl<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<br />
using (SPSite mySite = new SPSite("http://MyMOSS2010/CP"))<br />
{<br />
using (SPWeb myWeb = mySite.OpenWeb())<br />
{<br />
<br />
TreeNode mynode = new TreeNode(myWeb.Title, null, null, myWeb.Url, "_self");<br />
TreeNode parentNode = mynode;<br />
tviewSiteStructure.Nodes.Add(mynode);<br />
<br />
<br />
foreach (SPList myList in myWeb.Lists)<br />
{<br />
string listLink = "<a href='" + myList.DefaultViewUrl + "'>" + myList.Title + "</a>(<b>" + myList.Items.Count.ToString() + "</b>)<br>";<br />
<br />
mynode = new TreeNode(listLink, null, null, myList.DefaultViewUrl, "_self");<br />
<br />
parentNode.ChildNodes.Add(mynode);<br />
<br />
}<br />
<br />
foreach (SPWeb childweb in myWeb.Webs)<br />
{<br />
Iterateotherwebs(childweb, parentNode);<br />
}<br />
tviewSiteStructure.CollapseAll();<br />
}<br />
}<br />
<br />
}<br />
void Iterateotherwebs(SPWeb web, TreeNode ParentNode)<br />
{<br />
TreeNode mynode = new TreeNode(web.Title, null, null, web.Url, "_self");<br />
TreeNode parentNode = mynode;<br />
tviewSiteStructure.Nodes.Add(mynode);<br />
<br />
foreach (SPList myList in web.Lists)<br />
{<br />
string listLink = "<a href='" + myList.DefaultViewUrl + "'>" + myList.Title + "</a>(<b>"+myList.Items.Count.ToString()+"</b>)<br>";<br />
<br />
mynode = new TreeNode(listLink, null, null, myList.DefaultViewUrl, "_self");<br />
parentNode.ChildNodes.Add(mynode);<br />
<br />
}<br />
<br />
foreach (SPWeb childweb in web.Webs)<br />
{<br />
Iterateotherwebs(childweb, parentNode);<br />
}<br />
<br />
}<br />
}<br />
<br />
}Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-71674734172226447472011-02-01T11:58:00.000-08:002011-02-01T12:19:38.652-08:00SharePoint Object Model<div class="separator" style="clear: both; text-align: center;"><br />
<a href="http://3.bp.blogspot.com/_8ukX79apDvQ/TUhqMfI0DlI/AAAAAAAAAQo/sO6kxO1LuMw/s1600/SharePointObjectModel.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TUhqMfI0DlI/AAAAAAAAAQo/sO6kxO1LuMw/s320/SharePointObjectModel.jpg" width="260" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/_8ukX79apDvQ/TUhlZd5qGhI/AAAAAAAAAQg/sgUrTOKbEpY/s1600/SharePointObjectModel.jpg" imageanchor="1"><br />
</a></div>Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-41567981485805716752011-01-19T13:03:00.000-08:002011-01-19T13:06:06.862-08:00Error while accessing ListData.svc : ADO.NET Data ServicesCould not load type 'System.Data.Services.Providers.IDataServiceUpdateProvider' from assembly 'System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.<br />
<br />
#1<br />
As error suggests, please ensure that you have System.Data.Services entry in the Global Assembly Cache (GAC)<br />
<br />
#2 download and install<br />
<a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a71060eb-454e-4475-81a6-e9552b1034fc&displaylang=en">http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a71060eb-454e-4475-81a6-e9552b1034fc&displaylang=en</a><br />
<br />
<br />
<br />
#3 downloand and install the ADO.NET Data Services Update for .NET 3.5 SP1. <br />
<br />
<a href="http://www.microsoft.com/downloads/en/details.aspx?familyid=4B710B89-8576-46CF-A4BF-331A9306D555&displaylang=en">http://www.microsoft.com/downloads/en/details.aspx?familyid=4B710B89-8576-46CF-A4BF-331A9306D555&displaylang=en</a><br />
<br />
<br />
#4 Do not forget to reset the IIS.Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-88658728466055297752011-01-12T10:57:00.000-08:002011-01-12T10:57:17.932-08:00error occurred in deployment step 'Retract Solution': The language-neutral solution package was not found#1<br />
Run Powershell<br />
<br />
#2<br />
Ensure you have Sharepoint Powershell commands enabled<br />
For that run following command<br />
<br />
Add-PSSnapin Microsoft.SharePoint.Powershell<br />
<br />
#3<br />
run following command (Replace mysolution.wsp with your solution name)<br />
(get-spsolution mysolution.wsp).Delete()<br />
<br />
this helped to me.<br />
If still not<br />
then open your solution folder and delete files from bin,pkg and obj folders and do the above mentioned again.Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com4tag:blogger.com,1999:blog-3117943742201944219.post-74795722447983852762011-01-12T07:43:00.000-08:002011-01-12T07:44:35.553-08:00debugging Sharepoint App using Visual Studio 2010 : No symbols have been loadedRight click on solution --> Click on Properties<br />
Click on 'Multiple startup projects' radio button <br />
select the project you need to debug<br />
Select Start from the action drop down for that project.Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-75266442123938728892011-01-09T08:36:00.000-08:002011-01-09T08:36:53.337-08:00SharePoint 2010 build error Warning 1 The Reference...Warning 1 The referenced assembly “Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL” could not be resolved because it has a dependency on “System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which is not in the currently targeted framework “.NETFramework,Version=v4.0,Profile=Client”. Please remove references to assemblies not in the targeted framework or consider retargeting your project.<br />
<br />
<br />
You may need to do the following to resolve the issue<br />
<br />
SharePoint 2010 is built on top of .Net Framework 3.5. So make sure you have it as your targeted framework in VS. Go to project properties and change the target framework to “.Net Framework 3.5″.Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-57535135856949754082010-12-16T06:10:00.000-08:002010-12-16T06:10:48.605-08:00Reading .iso filesReading ISO file without burning it to disc. <br />
<br />
7-Zip is a great tool to do that.<br />
you can download that from http://www.7zip.org/<br />
<br />
From File Mangaer, select the file and click on extract.<br />
<br />
Good for Windows Vista 64 bit as well.Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com1tag:blogger.com,1999:blog-3117943742201944219.post-50839087169562145512010-12-03T14:18:00.000-08:002010-12-03T14:26:12.677-08:00Eclipse Android and JVM issueAs you know you need java to develop android related apps.<br />
<br />
Eclipse is very userful IDE for this.<br />
<br />
While seting up the environment on my<br />
Windows Vista 64 bit AMD machine, i spent several hours struggeling with 64bit vs 32 bit.<br />
<br />
#1 <br />
After clicking eclipse.exe i initially got 'jvm path error'<br />
<br />
If you see JVM path error, you may need to make the following change in the eclipse.ini file.<br />
Basically you need to give the correct path where javaw.exe file exists.<br />
Add following two lines before –vmargs<br />
-vm<br />
C:\Program Files\Java\jre1.6.0_04\bin\javaw.exe<br />
<br />
#2<br />
Java was started but returned exit code 13<br />
<br />
This may be due to the jvm version and eclipse compatibility.<br />
Ensure if you running eclipse in 64 bit machine, you should have jvm 64 bit version.<br />
It took almost 2 hours to me to find the correct version url for jvm 64 bit, following url helped.<br />
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter<br />
Best way to check if JVM is 32 bit or 64<br />
Check if java folder is in program files x 86 folder, if yes then its 32 bit.<br />
<br />
<br />
f stillnot working try deleting configurationfolder and <br />
Install from command line<br />
e.g.<br />
<br />
eclipse -clean<br />
<br />
<br />
<br />
<br />
Related<br />
http://developer.android.com/index.htmlPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-60474876635826022902010-11-08T08:48:00.000-08:002010-11-08T08:48:39.806-08:00Type mismatch Error Trying To SET the Property: Enable32BitAppOnWin64Following command will help to enable the IIS 6 for 32 bit applications.<br />
<br />
Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory.<br />
<br />
Type the following command:<br />
<br />
cscript adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 True<br />
<br />
you can also use following<br />
<br />
cscript adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 1<br />
<br />
<br />
to revert<br />
<br />
cscript adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 0Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com2tag:blogger.com,1999:blog-3117943742201944219.post-71613432702923987442010-11-05T06:29:00.000-07:002010-11-05T08:14:56.674-07:00Sharepoint 2007 - Attaching Event Receiver to specific List that updates SQL Server TableIn the following post , i am trying to explain how can we can develop and attach a event receiver to a specific sharepoint custom list.This event receiver is updating a SQL server table.<br /><br /><br />SharePoint Lists & Libraries Overview:<br />A list is a collection of information that we can share with team members.<br />A SharePoint list is a collection of similar items. A list contains columns or fields that define the item data or metadata schema. Each item stored in a list shares the same schema. Technically lists also include libraries, but libraries are often seen as separate from lists or at least specialized forms of lists. In lists items are defined by metadata or the columns of a list with documents being attached to that metadata. In a library a document is the item with library metadata supporting the document.<br />Lists in SharePoint resemble database tables in structure and behavior. Lists support various field or data types, and can have triggers that react to list events such as creating, updating or deleting items. In addition lists can be configured to filter, sort or group items based on item data or properties. <br />SharePoint lists also support various methods of visualization, both in the display of data and in the editing or entry of item data.<br />Lists in SharePoint are based on list templates, such as document libraries, calendars, contact lists, picture libraries, and others, that define the schema for new lists. We can create multiple lists based on a single list template.<br />We can also attach workflows to lists, allowing more complex behavior of lists and libraries.<br />MOSS offered developers the ability to catch certain user actions in code about SharePoint Lists & Libraries and react programmatically. These user actions triggered a set of asynchronous events which happened after the user had completed the action.<br />We can categorize SharePoint events in two different categories: by the “level” which fires the event (site, list, item), and by the type of the event (synchronous and asynchronous).<br /><br />• Synchronous: happens 'before' the actual event, we have the HttpContext and we can show an error message in the browser and cancel the event. <br />• Asynchronous: happens 'after' the actual event, there's no HttpContext and we cannot directly show an error message or cancel the event – we can handle what happens after the event is fired. <br />As an example of synchronous and asynchronous events we can take item-level events “ItemAdding” and “ItemAdded” – by handling of “ItemAdding” we can take a look what that item is, and, if necessary, cancel the adding and display the error message in the SharePoint page to the user. When handling “ItemAdded”, we know that the item is already in the SharePoint list, but we can start some post-add actions with that item.<br /><br /><br />Creating Custom Lists:<br /><br />Following steps are for creating custom list using sharepoint outofbox features.<br />You can create the same using feature and CAML.<br /><br />Step 1: To create a new Custom List first go to Site Settings page and select Site libraries and lists under Site Administration.<br /><br /> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQMPmU1VyI/AAAAAAAAAHw/7zdGxUI9-hQ/s1600/1.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 196px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQMPmU1VyI/AAAAAAAAAHw/7zdGxUI9-hQ/s400/1.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536063304070682402" /></a><br /><br /><br />Step 2: Choose create a new Content option from Site Libraries and Lists page.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQQdYFdkmI/AAAAAAAAAM4/lNUE-PW00gs/s1600/2.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 97px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQQdYFdkmI/AAAAAAAAAM4/lNUE-PW00gs/s320/2.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067938812793442" /></a><br /><br />Step 3: Choose Custom List option under Custom Lists to create a new Custom List/Library from Site Settings.<br /> <br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQMwkwLC4I/AAAAAAAAAH4/2bxPpxMMJ3I/s1600/3.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 129px;" src="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQMwkwLC4I/AAAAAAAAAH4/2bxPpxMMJ3I/s400/3.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536063870584163202" /></a><br /><br />Step 4: This Screen is for New List Creation by providing List Name and Description fields and after that Select Create button.<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQM-lPqSpI/AAAAAAAAAII/JGKsi9nqnGc/s1600/4.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 130px;" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQM-lPqSpI/AAAAAAAAAII/JGKsi9nqnGc/s400/4.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536064111234402962" /></a><br /><br />Step 5: The new List is created with MyList name which displays in Quick Launch bar and in Navigation bar also.<br /> <br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQNSKNThAI/AAAAAAAAAIY/jV_Ig5fakf8/s1600/5.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 186px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQNSKNThAI/AAAAAAAAAIY/jV_Ig5fakf8/s400/5.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536064447574148098" /></a><br /><br /><br />Step 6: We have to create columns to MyList list by selecting Create Column field from list Settings.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQNVoiwdDI/AAAAAAAAAIg/gINdQIpi2lM/s1600/6.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 196px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQNVoiwdDI/AAAAAAAAAIg/gINdQIpi2lM/s400/6.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536064507256796210" /></a><br /><br />Step 7: The below screen displays the Column Name and Column Description fields including the type of column information. We have the option of Maximum Number of Options of that column and Default value also. After providing the Column Name and Column Description click on Ok button.<br /> In the same way we can add multiple columns to the List.<br /> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQN5w3_x6I/AAAAAAAAAI4/p9XNGZkhl9I/s1600/7.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 227px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQN5w3_x6I/AAAAAAAAAI4/p9XNGZkhl9I/s400/7.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065127968655266" /></a><br /><br />Step 8: After adding columns to List we can enter the values to specific fields. For that we need to select NewItem to add a NewItem to List.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQN-E4QuCI/AAAAAAAAAJA/itho-1n92P0/s1600/8.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 113px;" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQN-E4QuCI/AAAAAAAAAJA/itho-1n92P0/s400/8.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065202057951266" /></a><br /><br /><br />Step 9: The below screen displays all the columns list and this Item will be added to List by clicking OK button after entering all field values.<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQOExJQTSI/AAAAAAAAAJI/IlOwPS4mnbM/s1600/9.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 160px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQOExJQTSI/AAAAAAAAAJI/IlOwPS4mnbM/s400/9.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065317019602210" /></a><br /><br />Step 10: The below image displays all the Items of that List<br /> <br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQOLDrwW0I/AAAAAAAAAJQ/L5kT-Y8z8tw/s1600/10.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 132px;" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQOLDrwW0I/AAAAAAAAAJQ/L5kT-Y8z8tw/s400/10.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065425075362626" /></a><br /><br /><br /><br />Creation of Event Receiver:<br /><br />We will be creating Event receiver forr the list we just created above.<br />We want whenever anything gets added/updated/deleted, at the same time one of the SQL table be updated accordingly.<br />We would be creating two features <br />1) for Event Receiver <br />2) for Activiating and Attaching the event receiver to this specicific list. <br />The second feature is also important, in absense of this you would end up attaching this event receiver to all the lists.<br /><br />Step 1: Create a New Visual Studio Project to implement an Event Receiver. Choose File >> New Project to create a New Project.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQOPQk9IBI/AAAAAAAAAJY/X6SMwxy8OeQ/s1600/11.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 184px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQOPQk9IBI/AAAAAAAAAJY/X6SMwxy8OeQ/s400/11.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065497255976978" /></a><br /><br />Step 2: Select WSPBuilder Project option from Visual Studio Project Templates list and select OK button.<br />Note: You just have WSPBuilder installed in your environment.That is the great tool to work with Sharepoint.You can download that from http://wspbuilder.codeplex.com/<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQOTuPW7vI/AAAAAAAAAJg/S8Tt9vKtyw4/s1600/12.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 198px;" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQOTuPW7vI/AAAAAAAAAJg/S8Tt9vKtyw4/s400/12.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065573937934066" /></a><br />When you've created the project, you'll see a structure like this one in your solution explorer:<br />The WSPBuilder will create the 12-folder. It will also add the file “solutionid.txt” which contains a GUID to be used on the .wsp package, for easy reference. We will also get a strong-key generated.<br /> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQOX7iDRiI/AAAAAAAAAJo/zz954tbaNR0/s1600/13.JPG"><img style="cursor:pointer; cursor:hand;width: 398px; height: 244px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQOX7iDRiI/AAAAAAAAAJo/zz954tbaNR0/s400/13.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065646225475106" /></a><br />Step 3: Right click on the project and choose Add – New Item<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQOc1yaVOI/AAAAAAAAAJw/15l95JiJbGc/s1600/14.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 301px;" src="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQOc1yaVOI/AAAAAAAAAJw/15l95JiJbGc/s400/14.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065730582828258" /></a><br /><br />Step 4: Choose WSPBuilder node from Categories list and select Event Handler from Templates list and enter a Proper Name in Name text field. Select Add button to proceed.<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQOgokLOYI/AAAAAAAAAJ4/myAZrTvgCN4/s1600/15.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 247px;" src="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQOgokLOYI/AAAAAAAAAJ4/myAZrTvgCN4/s400/15.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065795752933762" /></a><br /><br /><br />Step 5: With WSPBuilder, when we create a new item based on a template, we'll get a dialog asking for some variables - and since this is a feature, it's going to need a Title, Description and Scope: <br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQOopRJjpI/AAAAAAAAAKA/wUI__Cer7Ow/s1600/16.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 222px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQOopRJjpI/AAAAAAAAAKA/wUI__Cer7Ow/s400/16.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536065933380521618" /></a><br /><br /><br />Step 6: The solution tree will be populated with a few new things, in this case the MyList that we chose to create. Implement the functionality of overriding all the required events like ItemAdded, ItemAdding, ItemUpdated, ItemUpdating, ItemDeleted, and ItemDeleting etc in MyList.cs file.<br /><br />Add a Config file to the project if we want to maintain any key elements like DB Connection strings or file paths etc. <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQOssLPcBI/AAAAAAAAAKI/jW6Gau1vyUg/s1600/17.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 335px;" src="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQOssLPcBI/AAAAAAAAAKI/jW6Gau1vyUg/s400/17.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066002880524306" /></a><br /><br /><br />Following screens are the mylist.cs code sample<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQX46rKG_I/AAAAAAAAANI/0jAde4ziogs/s1600/39.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 106px;" src="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQX46rKG_I/AAAAAAAAANI/0jAde4ziogs/s320/39.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536076108535569394" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQX1Q8MJpI/AAAAAAAAANA/2eB3eS7d-Wg/s1600/38.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 94px;" src="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQX1Q8MJpI/AAAAAAAAANA/2eB3eS7d-Wg/s320/38.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536076045793109650" /></a><br /><br />Note: Insertdb, updatedb,deletedb are the seperate methods that will accept the parameter and perform the db operations.<br /><br />Class/Functions in EventHandler: (MyList.cs)<br />• MyList: This is an EventHandler Class which needs to implement SPItemEventReceiver class comes from Microsoft.SharePoint namespace.<br />• ItemAdded: This is one of the methods belongs to SPItemEventReceiver base class to override. This event is being handled after the action occurs. We must override this method and this method uses ListItem property to return an object that represents the new list item, and then modifies the body text of the item. This event uses InsertDB function which is implemented in DBFunctions class to implement the records insertion into database.<br />• ItemDeleting: This indicates that the event is being handled before the action occurs. In this event we created one DBFunctions class object and access DeleteDB function which is implemented to delete an item based on.<br />• ItemUpdated: suffix “-ed” indicates that this event is being handled after the action occurs. So this event is being handled once the updation occurs. This event uses SPListItem class which represents an item, or a row in List. We accessed UpdateDB function which is implemented in DBFunctions class belongs to MyList namespace to update all the items based on ID.<br /><br /><br /><br />Class/Functions in DBFunctions: (DBFunctions.cs)<br /><br />• DBFunctions (): This is a constructor which invokes immediately when an object is instantiated for DBFunctions class. Collected all the key elements from web.Config file like connection string, and xml file path.<br />• InsertDB: This function accepts Id, Title, Contact, PhoneNo input parameters and inserts all these into tbl_MyList table. For this, we used SqlCommand ADO.Net object to add all parameters and execute the insert query.<br />• UpdateDB: This function accepts Id, Title, Contact, PhoneNo input parameters and updates all these parameters into tbl_MyList table based on ID. We used SqlCommand object to execute the Update query.<br />• DeleteDB: This function accepts only Id as input parameter to delete the record from tbl_MyList based on Id. <br /><br /><br /><br /><br /><br /><br />Step 7: Add a New Project for Event Handler by right clicking on the Solution Explorer and selecting Add >> New Project.<br /> <br /><br /><br />Step 8: When we create the project, we'll see a structure like this one in the solution explorer:<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQO_h01wEI/AAAAAAAAAKY/azZSkgTHmZM/s1600/18.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 229px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQO_h01wEI/AAAAAAAAAKY/azZSkgTHmZM/s400/18.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066326519726146" /></a><br /><br />Step 9:Right click on the project and choose Add – New Item.<br /><br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQPJLFOINI/AAAAAAAAAKg/opIIzwy9G3c/s1600/19.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 264px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQPJLFOINI/AAAAAAAAAKg/opIIzwy9G3c/s400/19.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066492213108946" /></a> <br /><br /><br />Step 10: Choose WSPBuilder node from Categories list and select Feature with Receiver from Templates list and enter a Proper Name in Name text field. Select Add button to proceed.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQPMsQ1xDI/AAAAAAAAAKo/VCEdz6-O9FA/s1600/20.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 377px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQPMsQ1xDI/AAAAAAAAAKo/VCEdz6-O9FA/s400/20.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066552659821618" /></a><br /><br /><br /><br />Screen 11: When we create a new item based on a template, we'll get a dialog asking for some variables - and since this is a feature, it's going to need a Title, Description and Scope:<br /> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQPP7Rw_4I/AAAAAAAAAKw/6iHpa-31JcA/s1600/21.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 237px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQPP7Rw_4I/AAAAAAAAAKw/6iHpa-31JcA/s400/21.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066608229842818" /></a><br /><br /><br />After creation of this project for Event Handler, we can override different events related to Feature such as FeatureActivated, FeatureDeactivating, FeatureInstalled, and FeatureUninstalling.<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQZG3WQUsI/AAAAAAAAANQ/qI3mBelUzyw/s1600/40.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 143px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQZG3WQUsI/AAAAAAAAANQ/qI3mBelUzyw/s320/40.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536077447672386242" /></a><br /><br />Class/Functions in Feature with Receiver: (MyListReceiver.cs)<br /><br />• MyListReceiver: This is the class which overrides all Feature events such as FeatureActivated, FeatureDeactivating, FeatureInstalled, FeatureUninstalling. This class extends the SPFeatureReceiver class from Microsoft.SharePoint namespace.<br />• FeatureActivated: This event fires when the feature is activated. In this method we accessed the List and adding all the Event Receivers to that list which are implemented in EventHandler MyList.cs file.<br /><br />Note: When activated this feature, this will enable the eventreceiver events for the mylist only.<br /><br />After building these two projects and wsp as well, we need to deploy these two wsp files in server. We can deploy these wsp files using batch files in server. Once after deploying the wsp files, we can check the wsp in Central Administration whether the wsp is deployed into site or not.<br /><br />Step 12: This is all the Deployed/Not Deployed wsp files list in Central Administration.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQPTGqNPbI/AAAAAAAAAK4/_Z4deU2zCBk/s1600/22.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 215px;" src="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQPTGqNPbI/AAAAAAAAAK4/_Z4deU2zCBk/s400/22.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066662824754610" /></a><br /><br /><br /><br />Step 13: After deploying MyList Event Handler wsp, the below image shows that as Not Deployed. <br /> <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQPXfNOKFI/AAAAAAAAALA/G0gu3fEwqMU/s1600/23.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 171px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQPXfNOKFI/AAAAAAAAALA/G0gu3fEwqMU/s400/23.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066738133542994" /></a><br /><br />Step 14: We can manually Deploy the wsp by selecting it and it goes to Solutions Properties page. By selecting Deploy Solution option we can deploy it.<br /> <br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQPbNZlg5I/AAAAAAAAALI/asEq1rJUJck/s1600/24.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 219px;" src="http://4.bp.blogspot.com/_8ukX79apDvQ/TNQPbNZlg5I/AAAAAAAAALI/asEq1rJUJck/s400/24.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066802073043858" /></a><br /><br /><br /><br /><br />Step 15: Once after selecting Deploy Solution option it displays the Solution information in Deploy Solution page and some options to choose when to deploy the solution. After choosing these options, we can select OK button to deploy the wsp.<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQPdyk5pFI/AAAAAAAAALQ/UuK08l8AlKI/s1600/25.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 195px;" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQPdyk5pFI/AAAAAAAAALQ/UuK08l8AlKI/s400/25.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066846412350546" /></a><br /><br /><br /><br />Step 16: We can see the Deployed wsp (mylist.wsp) from below diagram after Deployment process is over.<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQPhyrpl4I/AAAAAAAAALY/QA6O-vgFy5Y/s1600/26.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 214px;" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQPhyrpl4I/AAAAAAAAALY/QA6O-vgFy5Y/s400/26.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066915160135554" /></a><br /><br />Step 17: After this process we need to Activate the Feature from Site Settings by selecting Site features under Site Administration.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQPl_XjhMI/AAAAAAAAALg/zeE7rK7AKxU/s1600/27.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 259px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQPl_XjhMI/AAAAAAAAALg/zeE7rK7AKxU/s400/27.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536066987284989122" /></a><br /><br />Step 18: Once we select Site feature option all the Activated/Deactivated features will be displayed in Site Features page like the below image. So by selecting Activate button we need to activate the feature.<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQPpkCs8TI/AAAAAAAAALo/5cuLivVkkNc/s1600/28.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 218px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQPpkCs8TI/AAAAAAAAALo/5cuLivVkkNc/s400/28.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067048669245746" /></a><br /><br /><br /><br /><br />Step 19: The below image is after Activating the Feature, the Activate button turns to Deactivate.<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQPs0V8arI/AAAAAAAAALw/ghpTGnLE0hA/s1600/29.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 189px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQPs0V8arI/AAAAAAAAALw/ghpTGnLE0hA/s400/29.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067104584526514" /></a><br /><br />We need to deploy the Receiver wsp also using batch file after activating the Event Handler feature. Once it is deployed into website, we need to Activate that feature also same as above screens.<br /><br />Step 20: Once everything is done, we can test the list by Adding new Item into MyList list.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQPwg-cRVI/AAAAAAAAAL4/E0CfMiTnKx0/s1600/30.JPG"><img style="cursor:pointer; cursor:hand;width: 400px; height: 157px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQPwg-cRVI/AAAAAAAAAL4/E0CfMiTnKx0/s400/30.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067168105153874" /></a><br /><br /><br /><br />Step 21: We can find all the entered values related to that list in the table after clicking the OK button.<br /> <br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQP0RzCFQI/AAAAAAAAAMA/gR0IQXyathY/s1600/31.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 45px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQP0RzCFQI/AAAAAAAAAMA/gR0IQXyathY/s320/31.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067232750245122" /></a><br /><br /><br />Step 22: We can edit the list item by right clicking on the Item and selecting EditItem option.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQP32TYb1I/AAAAAAAAAMI/n96SMjoSK3w/s1600/32.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 178px;" src="http://2.bp.blogspot.com/_8ukX79apDvQ/TNQP32TYb1I/AAAAAAAAAMI/n96SMjoSK3w/s320/32.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067294089211730" /></a><br /><br /><br /><br />Step 23: We can change the values after editing the Item.<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQP7Gr6ZXI/AAAAAAAAAMQ/q4nIZ3g9QTA/s1600/33.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 127px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQP7Gr6ZXI/AAAAAAAAAMQ/q4nIZ3g9QTA/s320/33.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067350026675570" /></a><br /><br /><br /><br />Step 24: We can find all the updated values in the table also.<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQP-b0jAjI/AAAAAAAAAMY/fCdY5QHnYu8/s1600/34.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 38px;" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQP-b0jAjI/AAAAAAAAAMY/fCdY5QHnYu8/s320/34.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067407239643698" /></a><br /><br />Step 25: We can Delete the Record by right clicking on the item and by selecting DeleteItem option.<br /> <br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQQBZxhhHI/AAAAAAAAAMg/bzO1oZ365XE/s1600/35.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 165px;" src="http://1.bp.blogspot.com/_8ukX79apDvQ/TNQQBZxhhHI/AAAAAAAAAMg/bzO1oZ365XE/s320/35.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067458229699698" /></a><br /><br /><br /><br />Step 26: Before deleting the item it displays one Confirm window.<br /> <br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQQEqHyP-I/AAAAAAAAAMo/EpbTuf8pbnU/s1600/36.JPG"><img style="cursor:pointer; cursor:hand;width: 320px; height: 112px;" src="http://3.bp.blogspot.com/_8ukX79apDvQ/TNQQEqHyP-I/AAAAAAAAAMo/EpbTuf8pbnU/s320/36.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5536067514157645794" /></a><br /><br /><br /><br /><br />Class/Function used and their purpose and Input and expected output<br /><br /><br />Deployment Process: <br />Collect all wsp and dll files from MyList EvntHandler and MyListReceiver Event Receiver to deploy into server.<br /><br />Create a batch files (file with .bat as an extention) for first wsp file with the below commands.<br /><br />@set PATH=C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN;%PATH%<br /><br /> stsadm -o retractsolution -name MyList.wsp -immediate -allcontenturls<br /> stsadm -o execadmsvcjobs<br /> stsadm -o deletesolution -name MyList.wsp -override<br /> stsadm -o execadmsvcjobs<br />stsadm -o addsolution -filename MyList.wsp <br />stsadm -o execadmsvcjobs<br />stsadm -o deploysolution -name MyList.wsp -immediate -allowGacDeployment -local<br />stsadm -o execadmsvcjobs<br /> <br />Create another batch file (file with .bat as an extention) for receiver wsp file with the below commands.<br /><br />@set PATH=C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN;%PATH%<br /><br /> stsadm -o retractsolution -name MyListReceiver.wsp -immediate -allcontenturls<br /> stsadm -o execadmsvcjobs<br /> stsadm -o deletesolution -name MyListReceiver.wsp -override<br /> stsadm -o execadmsvcjobs<br /> stsadm -o addsolution -filename MyListReceiver.wsp <br /> stsadm -o execadmsvcjobs<br /> stsadm -o deploysolution -name MyListReceiver.wsp -immediate -allowGacDeployment -local<br /> stsadm -o execadmsvcjobs<br /><br /><br />DataBase:<br />Tables Used<br />1 Tbl_MyList<br /><br />File(s) Need to deploy:<br />1. MyList.wsp<br />2. MyListReceiver.wspPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-56934545845033862962010-02-16T04:55:00.000-08:002010-02-16T05:01:44.518-08:00Retrieving the COM class factory for component with CLSID {BDEADEE2-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa.Resetting IIS helped.<br />But i am still not sure what caused this error.<br />An no idea what to do when if this again comes up.<br />There were few other solutions found while googling<br />#1 Sharepoint Server Account password: Revert if somebody changed the passoword<br />#2You can try to copy OWSSVR.DLL file from another WFE server to the production server. (Backup the OWSSVR.DLL before copying)<br /><br />Location of the OWSSVR.DLL: c:\program files\common files\MicrosoftShared\Web server Extensions\12\ISAPI\ and looked for owssvr.dllPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-68483728411946766852009-08-14T04:34:00.000-07:002009-09-23T02:55:34.708-07:00Stored Procedure Returning and ReceivingIf the stored procedure is returning a single value you could define one of the parameters on the stored procedure to be an OUTPUT variable, and then the stored procedure would set the value of the parameter<br /><br />CREATE PROCEDURE dbo.sp_myoutName @In INT, @Out VARCHAR(100) OUTPUT<br />AS<br />BEGIN SELECT @Out = 'Test'<br />END<br />GO<br /><br /><br />And then, you get the output value as follows<br /><br />DECLARE @OUT VARCHAR(100)<br />EXEC sp_myoutname 1, @Out OUTPUT<br />PRINT @OutPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-41503360451563877842009-05-26T04:23:00.000-07:002009-05-26T04:24:39.192-07:00Check Index Details in DatabaseFollowing query helps to find the index details within a database.<br />This will list down all the tables and their index details that are indexed in a database.<br />SELECT<br />t.[name],<br />i.[name] as IndexName<br />FROM<br />SYS.INDEXES AS i WITH (NOLOCK)<br />INNER JOIN<br />SYS.TABLES AS t WITH (NOLOCK)<br />ON<br />i.[object_id] = t.[object_id]<br />INNER JOIN<br />SYS.INDEX_COLUMNS AS ic WITH (NOLOCK)<br />ON<br />i.[object_id] = ic.[object_id]<br />AND i.index_id = ic.index_id<br />WHERE<br />t.[type] = 'U'<br />AND t.Is_MS_Shipped = 0<br />AND i.Is_Hypothetical = 0Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-69934132190684671022009-05-18T07:38:00.000-07:002009-05-18T07:44:25.394-07:00Sharepoint Stsadm commandcd \Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN<br /><br /><strong>Adding a solution</strong><br />stsadm -o addsolution -filename <wsp>stsadm -o<br /><br />ex: stsadm -o addsolution -filename c:\mysolutions\emprecord.wsp<br /><br /><strong>Deploying a Solution</strong><br /><br />stsadm -o deploysolution -name <solution>.wsp<br /><br />stsadm -o deploysolution -name emprecord.wsp<br /><br /><strong></strong><br /><strong>Delete Solution</strong><br /><strong></strong><br />stsadm -o deletesolution -name <solution>.wsp<br />stsadm -o deletesolution -name emprecord.wsp<br /><br /><strong>Upgrade Solution<br /></strong> stsadm -o upgradesolution -name <existing> -filename WSP file name with the physical path where that is located> -allowGacDeployment –immediate<br /><br />stsadm -o execadmsvcjobs<br /><br />EX:<br />stsadm -o upgradesolution -name emprecord.wsp -filename c:\mysolutions\emprecord.wsp -allowGacDeployment –immediate<br /><br />stsadm -o execadmsvcjobsPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-7190434314168957562009-03-27T14:07:00.000-07:002009-03-27T14:25:07.528-07:00Copy Assembly from GAC,<div><br /><br /><div>Getting a copy of a DLL that's only in the GAC </div><br /><br /><div></div><br /><br /><div>Go to Command window</div><br /><br /><div></div><br /><br /><div>Find the Assembly directory</div><br /><br /><div>C:\Windows\Assembly</div><br /><br /><div></div><br /><br /><div>C:\Windows\Assembly\dir</div><br /><br /><div></div><br /><br /><div>This will display the different GAC folders</div><br /><img id="BLOGGER_PHOTO_ID_5317980898228840434" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 164px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_8ukX79apDvQ/Sc1Dc3k-J_I/AAAAAAAAADM/CxlMuAxzs1U/s400/GAC.jpg" border="0" /><br /><div></div><br /><br /><div>You need to find where exactly your dll is stored.</div><br /><br /><div></div><br /><br /><div>It would be GAC_<processor><processor><processor></div><br /><br /><div></div><br /><br /><div>where <processor> <processor><processor>can have MSIL, 64, 32. you can see the processor architecure from from the windows exproer view of the Assembly.</div><br /><br /><div></div><img id="BLOGGER_PHOTO_ID_5317980138808193874" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 68px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_8ukX79apDvQ/Sc1Cwqg-s1I/AAAAAAAAADE/HxifMd-5-sQ/s400/win.jpg" border="0" /><br /><br /><div></div><br /><br /><div>Suppose your dll processor Architecure is MSIL then your assembly would be there in GAC_MSIL</div><div></div><br /><br /><div></div><br /><br /><div>Then Go to</div><br /><br /><div>C:\Windows\Assembly\GAC_MSIL\<assembly><version>__<public></div><div> </div><div>Remember __ (Are two underscore)<dll><version><publictokenkey></div><br /><br /><div>type command to copy the dll to the directory where you want that.</div><br /><br /><div></div><br /><div>EX: dll name : mydll</div><br /><br /><div>Processor Architecure: MSIL</div><br /><br /><div>version: 1.0.0.0</div><br /><br /><div>publc key: 9f4da00116c38ec5</div><br /><br /><div></div><br /><br /><div>The dir to copy: Mybackup</div><br /><br /><div></div><br /><br /><div>then command</div><br /><br /><div>Copy C:\windows\Assembly\mydll\1.0.0.0__9f4da00116c38ec5\mydll.dll c:\Mybackup</div><div> </div></div>Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-74649481412455010422009-03-04T06:55:00.000-08:002009-03-04T07:04:24.713-08:00Success“Take up one idea. Make that one idea your life - think of it, dream of it, live on that idea. Let the brain, muscles, nerves, every part of your body, be full of that idea, and just leave every other idea alone. This is the way to success, that is way great spiritual giants are produced.”<br /><br />Swami VivekaNand<br /><br />Satisfaction does not come with achievement, but with effort. Full effort is full victory.<br /><br />Mahatma GandhiPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-39157450751054487612009-01-20T18:41:00.000-08:002009-01-20T18:50:25.366-08:00Installation and Setup – Preparing your Server EnvironmentFor SharePoint Installation, i don't think any other article on the web could be better then this.<br /><a href="http://mindsharpblogs.com/bill/archive/2006/06/27/1153.aspx">http://mindsharpblogs.com/bill/archive/2006/06/27/1153.aspx</a><br /><br />The thing that is missing on most of the articles are regarding the principal acocunts and permissions.<br /><br />Proper planning is crucial to the successful implementation of any MOSS 2007 Farm. <br /><br />Below is guide to preparing your server environment by creating the proper accounts and simplifying permissions by making of use of Active Directory groups.<br /><br /><br />Step 1 – Create Accounts and Admin Group in Active Directory<br /><br />The following user accounts should be created:<br /><br />SAMPLE USER ACCOUNTS:<br /><br />Server Farm Account = Domain\SP-ServerFarm<br />Setup User Account = Domain\SP-SetupUser<br />SQL Service Account = Domain\SP-SQLService<br /><br />SAMPLE DOMAIN GLOBAL GROUP:<br /><br />AD Global Group = Domain\SharePointAccounts<br /><br />Step 2 – Add Accounts to Administrative Group<br /><br />Add the three setup accounts created in Step 1 to the Active Directory Global Group created in Step 2.<br /><br />Step 3 – Add Domain Group to Local Administrators Group on SharePoint Servers<br /><br />Add the Active Directory Global Group (Domain\SharePointAccounts) to the Local Administrators Group of every Web Front End or Application Server within your SharePoint Farm.<br /><br />Note: You may also use Active Directory Group Policies to accomplish this.<br /><br />Step 4 – Add Account to the SQL Server Local Admin Group<br /><br />Add the SQL Service Account (Domain\SP-SQLService) to the Local Administrator Group of your SQL Server.<br /><br />Step 5 - Assign SQL Server Roles<br /><br />Create the following Logins and assign the defined Roles on the SQL Instance to be used for the installation of MOSS 2007:<br /><br />Logins Roles<br />Domain\SP-ServerFarm dbcreator, securityadmin<br />Domain\SP-SetupUser dbcreator, securityadmin<br />Domain\SP-SQLService dbcreator, securityadmin, sysadmin<br />========= ===== === ==== = ================= =============<br /><br /><br /><strong>Domain-level SharePoint User Accounts (Farm Deployment Only)<br /></strong><br />Setup User Account<br /><br />SQL Server Service Account<br /><br />SharePoint Farm Account<br /><br />Shared Services Provider (SSP) Account<br /><br />SSP Service Account (Timer Service)<br /><br />My Sites Application Pool Account<br /><br />Search Service Account<br /><br />Content Access Account<br /><br />User Profiles Access Account<br /><br />Excel Services Account<br /><br />Application Pool Identity AccountPankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-36609918045411741532009-01-20T18:34:00.001-08:002009-01-20T18:34:56.800-08:00STSADM command to update the solutionstsadm -o upgradesolution -name <existing> -filename C:\join0120\<solution> -allowGacDeployment -immediatePankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-38990111738502427272009-01-19T13:01:00.000-08:002009-01-19T13:05:24.903-08:00The trial period for this product has expired<a href="http://4.bp.blogspot.com/_8ukX79apDvQ/SXTqaleHfWI/AAAAAAAAAA0/syDbyD-aXAs/s1600-h/sharepointerror.jpg"><img id="BLOGGER_PHOTO_ID_5293113204523105634" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 173px; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_8ukX79apDvQ/SXTqaleHfWI/AAAAAAAAAA0/syDbyD-aXAs/s320/sharepointerror.jpg" border="0" /></a><br />you may get this error sometime while working with a website that is developed using Sharepoint.With this error message do not think that the trial period of your shrepoint has got expired.Rather this error comes due to a DCOM permissions bug.<br />To fix please add your MOSS web application's IIS Application Pool domain account to the local BUILTIN\Administrators user group and then it works fine.Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com0tag:blogger.com,1999:blog-3117943742201944219.post-61207536223388502392009-01-19T12:55:00.000-08:002009-01-19T12:58:01.912-08:00SharePoint Designer Server error: This item cannot be deleted because it is still referenced by other pages<div>Server error: This item cannot be deleted because it is still referenced by other pages<br /><br />You might get this error when you try to delete a master page from the _catalogs directory.<br /><br />Following solution worked for me.<br /><br />Open the Master gallery in Explorer view<br />Create a Directory named "Delete"<br />Cut all the un-wanted Master Pages and paste it inside the "Delete" directoty<br />Delete the "Delete" Directory </div>Pankaj Sharmahttp://www.blogger.com/profile/03990218377265440828noreply@blogger.com1