Wednesday, June 8, 2011

System.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


This resolves the following exception.
System.ServiceModel.ProtocolException was unhandled by user code Message=The remote server returned an unexpected response: (405) Method Not Allowed.

Source=mscorlib
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at

Wednesday, March 9, 2011

Windows PowerShell and SharePoint Commands

go to Windows Powershell located at

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
you can also reach here from Accessories>WindowsPowershell

Type following command
add-pssnapin microsoft.sharepoint.powershell

you can verify by typing following command
get-command -noun sp*

this should return you thousands of commands available.

Monday, February 28, 2011

WebPart to Upload to sharePoint Document Lib using SharePoint Object Model

//Following code using SharePoint Object Model and Fileupload class.
//It uploads a docuent to 'Shared Documents' document library.


using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace DocLibActivities.DocLibActivities
{
[ToolboxItemAttribute(false)]
public class DocLibActivities : WebPart
{

FileUpload oFileUploader;
protected override void CreateChildControls()
{
oFileUploader = new FileUpload();
this.Controls.Add(oFileUploader);



}
void btnUpload_Click(object sender, EventArgs e)
{

string strFilename = oFileUploader.FileName;
using (SPWeb objThisWeb = SPContext.Current.Web)
{
SPFolder objTargetFolder = objThisWeb.Lists["Shared Documents"].RootFolder;
foreach (SPFile objFile in objTargetFolder.Files)
{
if (Context.Request.InputStream.Length != null)
{

System.IO.Stream oIOStream = Context.Request.InputStream;
byte[] fbytes = new byte[oIOStream.Length];
oIOStream.Read(fbytes, 0, (int)oIOStream.Length);
oIOStream.Close();
SPFile oSPNewFile = objTargetFolder.Files.Add(strFilename, fbytes, true);
oSPNewFile.CheckOut();

}
this.Page.Response.Redirect(objThisWeb.Url + "/" + objTargetFolder.Url);
}
}

}


}
}

Iterating through SharePoint Document library and get File info

SPWeb oSpWeb = SPContext.Current.Web;
SPFolder oSPF = oSpWeb.Lists["Shared Documents"].RootFolder;

foreach (SPFile oSPfile in oSPF.Files)
{
if (oSPfile.CheckOutType == SPFile.SPCheckOutType.None)
{
LiteralControl ltc= new LiteralControl(string.Format("
File {0} : {1} : {2}", oSPfile.Name,"Not Checked Out", oSPfile.CheckInComment));
this.Controls.Add(ltc);

}
else
{
LiteralControl ltc= new LiteralControl(string.Format("
File {0} : {1} : {2}", oSPfile.Name,"Checked Out", oSPfile.CheckInComment));
this.Controls.Add(ltc);
}

}

Sunday, February 27, 2011

SharePoint 2010 Visual Webpart and List and SPGridView Population

Sharepoint list name: VSProducts
This has three fields ID,Manufacturer, Name
Following grid view get populated using the following code.

.ascx
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RenderingData.ascx.cs" Inherits="RenderingData.VisualWebPart1.VisualWebPart1UserControl" %>



code behind


using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Data;

namespace RenderingData.VisualWebPart1
{
public partial class VisualWebPart1UserControl : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{

if (!Page.IsPostBack)
{
populateSPGrid();
}


}
protected void populateSPGrid()
{
using (SPSite oSPSite = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb oSPWeb = oSPSite.OpenWeb())
{

SPList oList = oSPWeb.Lists["VSProducts"];
SPListItemCollection oListCollection = oList.Items;
DataTable table = new DataTable();

table.Columns.Add("ID", typeof(string));
table.Columns.Add("Manufacturer", typeof(string));
table.Columns.Add("Name", typeof(string));

// Create rows for each splistitem

DataRow row;

foreach (SPListItem oSPListItem in oListCollection)
{

row = table.Rows.Add();

row["ID"] = oSPListItem["ID"].ToString();

row["Manufacturer"] = oSPListItem["Manufacturer"].ToString();

row["Name"] = oSPListItem["Name"].ToString();

}

// create the bound fields

SPBoundField boundField;

boundField = new SPBoundField();

boundField.HeaderText = "ID";

boundField.DataField = "ID";

boundField.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

boundField.ItemStyle.Wrap = false;

SPGView.Columns.Add(boundField);





boundField = new SPBoundField();

boundField.HeaderText = "Manufacturer";

boundField.DataField = "Manufacturer";

SPGView.Columns.Add(boundField);



boundField = new SPBoundField();

boundField.HeaderText = "Name";

boundField.DataField = "Name";

SPGView.AutoGenerateColumns = false;

SPGView.Columns.Add(boundField);





SPGView.DataSource = table.DefaultView;

SPGView.DataBind();

}

}

}

}
}

Thursday, February 17, 2011

Iterating through SPweb, SPlist and populating Treeview

Following code makes a tree view for a site (web) and its child sites, their lists.
It also displays the number of items each of that list has.

It’s a small Administration utility and very helpful for understanding how to iterate through spsite, spweb and lists.

I used Visual studio 2010. Its great tool to work with SharePoint 2010.
This really a great relied in terms of developing a webpart, packaging and deploying.

I have a user control there I added a tree view, name 'tviewSiteStructure'.

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

namespace SiteStructure.SiteStructureWebPart
{
public partial class SiteStructureWebPartUserControl : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{

using (SPSite mySite = new SPSite("http://MyMOSS2010/CP"))
{
using (SPWeb myWeb = mySite.OpenWeb())
{

TreeNode mynode = new TreeNode(myWeb.Title, null, null, myWeb.Url, "_self");
TreeNode parentNode = mynode;
tviewSiteStructure.Nodes.Add(mynode);


foreach (SPList myList in myWeb.Lists)
{
string listLink = "" + myList.Title + "(" + myList.Items.Count.ToString() + ")
";

mynode = new TreeNode(listLink, null, null, myList.DefaultViewUrl, "_self");

parentNode.ChildNodes.Add(mynode);

}

foreach (SPWeb childweb in myWeb.Webs)
{
Iterateotherwebs(childweb, parentNode);
}
tviewSiteStructure.CollapseAll();
}
}

}
void Iterateotherwebs(SPWeb web, TreeNode ParentNode)
{
TreeNode mynode = new TreeNode(web.Title, null, null, web.Url, "_self");
TreeNode parentNode = mynode;
tviewSiteStructure.Nodes.Add(mynode);

foreach (SPList myList in web.Lists)
{
string listLink = "" + myList.Title + "("+myList.Items.Count.ToString()+")
";

mynode = new TreeNode(listLink, null, null, myList.DefaultViewUrl, "_self");
parentNode.ChildNodes.Add(mynode);

}

foreach (SPWeb childweb in web.Webs)
{
Iterateotherwebs(childweb, parentNode);
}

}
}

}

Wednesday, January 19, 2011

Error while accessing ListData.svc : ADO.NET Data Services

Could not load type 'System.Data.Services.Providers.IDataServiceUpdateProvider' from assembly 'System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

#1
As error suggests, please ensure that you have System.Data.Services entry in the Global Assembly Cache (GAC)

#2 download and install
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a71060eb-454e-4475-81a6-e9552b1034fc&displaylang=en



#3 downloand and install the ADO.NET Data Services Update for .NET 3.5 SP1.

http://www.microsoft.com/downloads/en/details.aspx?familyid=4B710B89-8576-46CF-A4BF-331A9306D555&displaylang=en


#4 Do not forget to reset the IIS.

Wednesday, January 12, 2011

error occurred in deployment step 'Retract Solution': The language-neutral solution package was not found

#1
Run Powershell

#2
Ensure you have Sharepoint Powershell commands enabled
For that run following command

Add-PSSnapin Microsoft.SharePoint.Powershell

#3
run following command (Replace mysolution.wsp with your solution name)
(get-spsolution mysolution.wsp).Delete()

this helped to me.
If still not
then open your solution folder and delete files from bin,pkg and obj folders and do the above mentioned again.

debugging Sharepoint App using Visual Studio 2010 : No symbols have been loaded

Right click on solution --> Click on Properties
Click on 'Multiple startup projects' radio button
select the project you need to debug
Select Start from the action drop down for that project.

Sunday, January 9, 2011

SharePoint 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.


You may need to do the following to resolve the issue

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″.

Thursday, December 16, 2010

Reading .iso files

Reading ISO file without burning it to disc.

7-Zip is a great tool to do that.
you can download that from http://www.7zip.org/

From File Mangaer, select the file and click on extract.

Good for Windows Vista 64 bit as well.

Friday, December 3, 2010

Eclipse Android and JVM issue

As you know you need java to develop android related apps.

Eclipse is very userful IDE for this.

While seting up the environment on my
Windows Vista 64 bit AMD machine, i spent several hours struggeling with 64bit vs 32 bit.

#1
After clicking eclipse.exe i initially got 'jvm path error'

If you see JVM path error, you may need to make the following change in the eclipse.ini file.
Basically you need to give the correct path where javaw.exe file exists.
Add following two lines before –vmargs
-vm
C:\Program Files\Java\jre1.6.0_04\bin\javaw.exe

#2
Java was started but returned exit code 13

This may be due to the jvm version and eclipse compatibility.
Ensure if you running eclipse in 64 bit machine, you should have jvm 64 bit version.
It took almost 2 hours to me to find the correct version url for jvm 64 bit, following url helped.
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter
Best way to check if JVM is 32 bit or 64
Check if java folder is in program files x 86 folder, if yes then its 32 bit.


f stillnot working try deleting configurationfolder and
Install from command line
e.g.

eclipse -clean




Related
http://developer.android.com/index.html

Monday, November 8, 2010

Type mismatch Error Trying To SET the Property: Enable32BitAppOnWin64

Following command will help to enable the IIS 6 for 32 bit applications.

Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory.

Type the following command:

cscript adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 True

you can also use following

cscript adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 1


to revert

cscript adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 0

Friday, November 5, 2010

Sharepoint 2007 - Attaching Event Receiver to specific List that updates SQL Server Table

In 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.


SharePoint Lists & Libraries Overview:
A list is a collection of information that we can share with team members.
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.
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.
SharePoint lists also support various methods of visualization, both in the display of data and in the editing or entry of item data.
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.
We can also attach workflows to lists, allowing more complex behavior of lists and libraries.
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.
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).

• Synchronous: happens 'before' the actual event, we have the HttpContext and we can show an error message in the browser and cancel the event.
• 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.
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.


Creating Custom Lists:

Following steps are for creating custom list using sharepoint outofbox features.
You can create the same using feature and CAML.

Step 1: To create a new Custom List first go to Site Settings page and select Site libraries and lists under Site Administration.




Step 2: Choose create a new Content option from Site Libraries and Lists page.



Step 3: Choose Custom List option under Custom Lists to create a new Custom List/Library from Site Settings.





Step 4: This Screen is for New List Creation by providing List Name and Description fields and after that Select Create button.




Step 5: The new List is created with MyList name which displays in Quick Launch bar and in Navigation bar also.






Step 6: We have to create columns to MyList list by selecting Create Column field from list Settings.



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.
In the same way we can add multiple columns to the List.


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.




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.




Step 10: The below image displays all the Items of that List







Creation of Event Receiver:

We will be creating Event receiver forr the list we just created above.
We want whenever anything gets added/updated/deleted, at the same time one of the SQL table be updated accordingly.
We would be creating two features
1) for Event Receiver
2) for Activiating and Attaching the event receiver to this specicific list.
The second feature is also important, in absense of this you would end up attaching this event receiver to all the lists.

Step 1: Create a New Visual Studio Project to implement an Event Receiver. Choose File >> New Project to create a New Project.



Step 2: Select WSPBuilder Project option from Visual Studio Project Templates list and select OK button.
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/


When you've created the project, you'll see a structure like this one in your solution explorer:
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.

Step 3: Right click on the project and choose Add – New Item



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.





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:





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.

Add a Config file to the project if we want to maintain any key elements like DB Connection strings or file paths etc.




Following screens are the mylist.cs code sample



Note: Insertdb, updatedb,deletedb are the seperate methods that will accept the parameter and perform the db operations.

Class/Functions in EventHandler: (MyList.cs)
• MyList: This is an EventHandler Class which needs to implement SPItemEventReceiver class comes from Microsoft.SharePoint namespace.
• 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.
• 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.
• 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.



Class/Functions in DBFunctions: (DBFunctions.cs)

• 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.
• 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.
• 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.
• DeleteDB: This function accepts only Id as input parameter to delete the record from tbl_MyList based on Id.






Step 7: Add a New Project for Event Handler by right clicking on the Solution Explorer and selecting Add >> New Project.



Step 8: When we create the project, we'll see a structure like this one in the solution explorer:




Step 9:Right click on the project and choose Add – New Item.






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.





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:



After creation of this project for Event Handler, we can override different events related to Feature such as FeatureActivated, FeatureDeactivating, FeatureInstalled, and FeatureUninstalling.



Class/Functions in Feature with Receiver: (MyListReceiver.cs)

• 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.
• 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.

Note: When activated this feature, this will enable the eventreceiver events for the mylist only.

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.

Step 12: This is all the Deployed/Not Deployed wsp files list in Central Administration.





Step 13: After deploying MyList Event Handler wsp, the below image shows that as Not Deployed.


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.








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.






Step 16: We can see the Deployed wsp (mylist.wsp) from below diagram after Deployment process is over.




Step 17: After this process we need to Activate the Feature from Site Settings by selecting Site features under Site Administration.



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.







Step 19: The below image is after Activating the Feature, the Activate button turns to Deactivate.




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.

Step 20: Once everything is done, we can test the list by Adding new Item into MyList list.





Step 21: We can find all the entered values related to that list in the table after clicking the OK button.






Step 22: We can edit the list item by right clicking on the Item and selecting EditItem option.





Step 23: We can change the values after editing the Item.






Step 24: We can find all the updated values in the table also.




Step 25: We can Delete the Record by right clicking on the item and by selecting DeleteItem option.






Step 26: Before deleting the item it displays one Confirm window.








Class/Function used and their purpose and Input and expected output


Deployment Process:
Collect all wsp and dll files from MyList EvntHandler and MyListReceiver Event Receiver to deploy into server.

Create a batch files (file with .bat as an extention) for first wsp file with the below commands.

@set PATH=C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN;%PATH%

stsadm -o retractsolution -name MyList.wsp -immediate -allcontenturls
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name MyList.wsp -override
stsadm -o execadmsvcjobs
stsadm -o addsolution -filename MyList.wsp
stsadm -o execadmsvcjobs
stsadm -o deploysolution -name MyList.wsp -immediate -allowGacDeployment -local
stsadm -o execadmsvcjobs

Create another batch file (file with .bat as an extention) for receiver wsp file with the below commands.

@set PATH=C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN;%PATH%

stsadm -o retractsolution -name MyListReceiver.wsp -immediate -allcontenturls
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name MyListReceiver.wsp -override
stsadm -o execadmsvcjobs
stsadm -o addsolution -filename MyListReceiver.wsp
stsadm -o execadmsvcjobs
stsadm -o deploysolution -name MyListReceiver.wsp -immediate -allowGacDeployment -local
stsadm -o execadmsvcjobs


DataBase:
Tables Used
1 Tbl_MyList

File(s) Need to deploy:
1. MyList.wsp
2. MyListReceiver.wsp

Tuesday, February 16, 2010

Retrieving the COM class factory for component with CLSID {BDEADEE2-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa.

Resetting IIS helped.
But i am still not sure what caused this error.
An no idea what to do when if this again comes up.
There were few other solutions found while googling
#1 Sharepoint Server Account password: Revert if somebody changed the passoword
#2You can try to copy OWSSVR.DLL file from another WFE server to the production server. (Backup the OWSSVR.DLL before copying)

Location of the OWSSVR.DLL: c:\program files\common files\MicrosoftShared\Web server Extensions\12\ISAPI\ and looked for owssvr.dll

Friday, August 14, 2009

Stored Procedure Returning and Receiving

If 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

CREATE PROCEDURE dbo.sp_myoutName @In INT, @Out VARCHAR(100) OUTPUT
AS
BEGIN SELECT @Out = 'Test'
END
GO


And then, you get the output value as follows

DECLARE @OUT VARCHAR(100)
EXEC sp_myoutname 1, @Out OUTPUT
PRINT @Out

Tuesday, May 26, 2009

Check Index Details in Database

Following query helps to find the index details within a database.
This will list down all the tables and their index details that are indexed in a database.
SELECT
t.[name],
i.[name] as IndexName
FROM
SYS.INDEXES AS i WITH (NOLOCK)
INNER JOIN
SYS.TABLES AS t WITH (NOLOCK)
ON
i.[object_id] = t.[object_id]
INNER JOIN
SYS.INDEX_COLUMNS AS ic WITH (NOLOCK)
ON
i.[object_id] = ic.[object_id]
AND i.index_id = ic.index_id
WHERE
t.[type] = 'U'
AND t.Is_MS_Shipped = 0
AND i.Is_Hypothetical = 0

Monday, May 18, 2009

Sharepoint Stsadm command

cd \Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

Adding a solution
stsadm -o addsolution -filename stsadm -o

ex: stsadm -o addsolution -filename c:\mysolutions\emprecord.wsp

Deploying a Solution

stsadm -o deploysolution -name .wsp

stsadm -o deploysolution -name emprecord.wsp


Delete Solution

stsadm -o deletesolution -name .wsp
stsadm -o deletesolution -name emprecord.wsp

Upgrade Solution
stsadm -o upgradesolution -name -filename WSP file name with the physical path where that is located> -allowGacDeployment –immediate

stsadm -o execadmsvcjobs

EX:
stsadm -o upgradesolution -name emprecord.wsp -filename c:\mysolutions\emprecord.wsp -allowGacDeployment –immediate

stsadm -o execadmsvcjobs

Friday, March 27, 2009

Copy Assembly from GAC,



Getting a copy of a DLL that's only in the GAC




Go to Command window




Find the Assembly directory


C:\Windows\Assembly




C:\Windows\Assembly\dir




This will display the different GAC folders




You need to find where exactly your dll is stored.




It would be GAC_




where can have MSIL, 64, 32. you can see the processor architecure from from the windows exproer view of the Assembly.






Suppose your dll processor Architecure is MSIL then your assembly would be there in GAC_MSIL




Then Go to


C:\Windows\Assembly\GAC_MSIL\__
Remember __ (Are two underscore)


type command to copy the dll to the directory where you want that.



EX: dll name : mydll


Processor Architecure: MSIL


version: 1.0.0.0


publc key: 9f4da00116c38ec5




The dir to copy: Mybackup




then command


Copy C:\windows\Assembly\mydll\1.0.0.0__9f4da00116c38ec5\mydll.dll c:\Mybackup