SharePoint Solutions Manager or The WSP Manager

Tool Description
Here is a nifty tool which can be used to deploy, redeploy, upgrade and retract/delete the solutions in the SharePoint environment. It handles all these jobs using the object model. This tool will be definitely handy for developers for quick deployment while debugging.

The best way to get anything or any component into SharePoint environment is by creating a WSP aka Solution file. Many tools exists to create the WSP like WSPBuilder, STSDEV and Andrew Connell’s way of doing it. Having done that the next step would be deploying the same into SharePoint environment. WSPBuilder supports deploying directly though Visual Studio but some times it could get messy. It also limits to the project you set up using WSPBuilder. This tool is built in a generic way which can be used to manage already deployed solutions and also for deploying new solutions. So given a WSP file this tool can help you get that into SharePoint environment.

I agree there is another tool SharePoint Solution Installer on codeplex but I never was happy with that as it didn’t serve the purpose many a times for me. Moreover that tools was closed to administrators.

ShareTools Solution Manager does many things which can be done with stsadm command line tool. Below are a salient list of those:

  • View existing solutions in our server environment
  • Add new solutions
  • Upgrade existing solutions either immediately or at a given time
  • Redeploy an existing solution if you have a latest WSP of the same solution
  • Retract and Delete the existing solution
  • Deploy a new solution with all the parameters used in stsadm command line tool
  • Execute the administrative timer job definitions i.e stsadm.exe -o execadmsvcjobs with a single click of the button

Currently you can take action on a single item at a time.

You can download it from:


Unauthorized exception even after using SPSecurity.RunWithElevatedPrivileges

In various cases while developing custom web parts or controls for SharePoint we have to use the SPSecurity.RunWithElevatedPrivileges construct to execute some part of the code which needs elevated permissions or which cannot be run with the current user permissions. For example, updating a SPWeb object or SPList object needs elevated permissions.

If you are getting an unauhtorized access exception even after using this block then the reason could be as follows:

While using this construct: You cannot use the objects available through the Microsoft.SharePoint.SPContext.Current property. That is because those objects were created in the security context of the current user.

So the best practice for using the SPSecurity.RunWithElevatedPrivileges is to get the SPSite/SPWeb objects using the SPContext.Current and then create the SPSite and SPWeb objects seperately. See the code below:


SPSite siteColl = SPContext.Current.Site;
SPWeb site = SPContext.Current.Web;
SPSecurity.RunWithElevatedPrivileges(delegate() {
  using (SPSite ElevatedsiteColl = new SPSite(siteColl.ID)) {
    using (SPWeb ElevatedSite = ElevatedsiteColl.OpenWeb(site.ID)) {
        //Code to execute

The following code is wrong:

SPSecurity.RunWithElevatedPrivileges(delegate() {
    SPSite siteColl =    SPContext.Current.Site;
    SPWeb site = SPContext.Current.Web;
 //Code to execute


InfoPath Managed Form Templates Deployment Tool for SharePoint

This tool is an effort towards helping all those who are working on InfoPath Forms with SharePoint. It helps to upload/install, re-install, upgrade a form template with just a click of the button. The tool also can help in generating a script/batch file so that you can run it manually later on. Also, the tool has ‘Feature Management’ addon, using which you can see a list of activated and deactivated features using a filter if needed. It also provides the ability to activate, deactivate and uninstall a feature.
You can get the tool and read more about it at
Please let me know of the bugs and enhancements if anyone uses it.
Below is the screen shot of the tool:

InfoPath Form Template Deployer

InfoPath Form Template Deployer

Rapid access to 12 Hive and stsadm.exe

Every SharePoint developer needs to have quick access to the 12 Hive, 12Hive/Bin for the stsadm for various purposes in our daily development work. But, I have seen many of them never try to make this process easier. Even though this is a trivial issue, sometimes its pretty annoying. So here are a few ways to avoid those annoying moments.
(*12 Hive = C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\)

1. Add a shortcut link to the 12 Hive folder in the task bar.Just open the windows explorer and navigate to 12 Hive. Drag the left top corner icon and drop it on the task bar in the right corner. The end result is as follows:

2. Create a shortcut to the command prompt and set the default directory to the 12 Hive’s BIN directory. Add that shortcut to the quick launch bar so that it would be one click away. Even better, you can set shortcut key to open up the command prompt. Set the Target, Start in properties as following:
Shortcut to 12 Hive/BIN

3. Add the 12 Hive to your “Favorites” in the explorer window.

4. To have access to stsadm.exe command irrespective of the folder you are in. Update the “Path” environment variable to add the path to the 12 Hive/BIN folder. (Right click My Computer – Go to Advanced Tab – Click Environment Variable , under system variables, edit Path variable and append the 12Bin path using semicolon as a delimiter).

access stsadm.exe everywhere

5. This is yet another good one posted by Daniel in the comments:

“I usually create a junction point (officially a ntfs reparse point) in the file system using the junction tool from sysinternals (

junction.exe c:\wss “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\”

That gives me something like c:\wss pointing to the 12 hive and stsadm.exe under c:\wss\bin.

(I do the same for the Windows Debugging tools and create a junction for them under c:\Debug.)”

If you have any more options to make a developers life even more better and easier, please add to the comments.

ASP .Net tab missing or SharePoint site leading to Page not found and IIS 32/64-bit modes


  • ASP .Net Tab Missing in the IIS Managers Website properties
  • SharePoint site shows “Page cannot be found error”.
  • SharePoint sites shows “You are not authorized to view this page”, “HTTP Error 403 – Forbidden: Access is denied.”
  • Either of the above problems in a server farm.

Possible Solutions:

There could be couple of reasons for the ASP .Net tab missing in the IIS manager. And this issue in turn could be the reason for the SharePoint site throwing the Page cannot be found or You are not authorized to view this page errors. Reasons that could be are:

  1. Improper installation of IIS and ASP .Net framework.
  2. IIS running in 32-bit mode on a 64-bit windows 2003 server.
  3. Having multiple versions of ASP .Net framework lying around on the machine which needs registry cleanup.

If your server is a 64 bit machine, then make sure your IIS is not running in 32-bit mode. For this run,

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs GET W3SVC/AppPools/Enable32bitAppOnWin64

The output tells if enable32bitapponwin64 is true or false. If its true then, go ahead and run the following to disable 32 bit mode and enable 64 bit mode:

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

If your server is a 32 – bit machine, and your ASP .Net tab is missing then, you might follow the below steps I found in this msdn blog post and KB Article from MicroSoft:

  • Manually run the install for ASP.NET: ASPNET_regiis -i
  • Register the dll for the MMC: regsvr32.exe “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mmcaspext.dll” “rundll32.exe” “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\webengine.dll”,RegisterAspNetMMC
  • From a command prompt run: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\AspNetMmcExt.dll /tlb:AspNetMMCExt.tlb
  • Change the About value in “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MMC\SnapIns\{fedb2179-2335-48f1-aa28-5cda35a2 b36d}” from {7D23CCC6-A390-406F-AB67-2F8B7558F6F7} to {7D23CCC6-A390-406F-AB67-2F8B7558F6F6}

If you want to have just the .net framework 2.0 on the machine go cleanup the earlier versions of it in the registry. Run regedit.exe and remove all the versions other than 2.0 below these registry entries:

  • HKEY_CLASSES_ROOT\CLSID\{7D23CCC6-A390-406E-AB67-2F8B7558F6F6}\InprocServer­32
  • HKEY_CLASSES_ROOT\CLSID\{FD5CD8B1-6FE0-44F3-BBFB-65E3655B096E}\InprocServer32
  • HKEY_CLASSES_ROOT\CLSID\{FEDB2179-2335-48F0-AA28-5CDA35A2B36D}\InprocServer­32

Try to unregister the .net framework and re-register it. Depending on your machine if 32/64-bit and the asp .net version (1.1 or 2.0?):

%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -u //for uninstallation

%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i //for installation

%SYSTEMROOT%\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -u //for uninstallation

%SYSTEMROOT%\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -i //for installation

If doing all the above doesn’t bring back the ASP .Net tab then reboot the machine.

Doing all this should at least get rid of the ‘Page cannot be found‘ error but may lead  to the authorization error.

For the 403 or the authorization error, if you get this error when you access the site using the url like http://portalsite:<port&gt; then try access the site as http://portalsite:<port>/default.aspx. If the later is successful then try to create a new application pool and map it to the corresponding website. Otherwise delete the web application and recreate it from scratch and it should work. This blog post something similar.

To learn more about how to maintain multiple versions of .net framework on the same machine and serve various web applications , read the article from MSDN which talks specifics about the same.

Using stsadm to deploy, upgrade, update InfoPath Forms Templates with Managed code behind

This post talks about using stsadm and batch scripts to deploy InfoPath form with code behind which usually is called as InfoPath forms with managed code or the InfoPath forms managed templates.

The problem: If it’s just a couple of InfoPath forms with simple code behind we can deploy the form using the InfoPath Forms Client application itself. As laid out neatly here. To summarize, it involves the following steps:

  1. Publish to a network location
  2. Verify its browser compatible while uploading to InfoPath managed templates in Central Admin.
  3. Upload to InfoPath managed templates found in Central Administration
  4. Wait for the status to upload complete.
  5. SharePoint admin should activate it for a particular site where the developer want to use it.
  6. Wait for the activation to complete.

Imagine doing all this every time you make change to the code behind of the form or change the user interface. The worst part is waiting for the status to get completed as SharePoint does those kind of jobs based on the timer job service. To run these tasks forcefully the stsadm’s execsrvcjobs command operation comes handy.

Below is the script to install a new infopath form template and activate for a particular site collection:
::Publish the form to a location lets say it is published at C:\InfoPathForms\Publish\sample.xsn
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
::uncomment the below three lines if you want to uninstall and re-install the infopath form template
::stsadm.exe -o DeActivateFormTemplate -url http://demosite -filename ::C:\InfoPathForms\Publish\sample.xsn
::stsadm.exe -o RemoveFormTemplate C:\InfoPathForms\Publish\sample.xsn
::stsadm.exe -o execadmsvcjobs
stsadm.exe -o verifyformtemplate -filename C:\InfoPathForms\Publish\sample.xsn
stsadm.exe -o UploadFormTemplate -filename C:\InfoPathForms\Publish\sample.xsn
stsadm.exe -o execadmsvcjobs
stsadm.exe -o ActivateFormTemplate -url http://demosite -filename C:\InfoPathForms\Publish\sample.xsn

Below is the script to upgrade or update the existing infopath form template for a site collection:
cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
stsadm.exe -o DeActivateFormTemplate -url http://demosite -filename C:\InfoPathForms\Publish\sample.xsn
stsadm.exe -o verifyformtemplate -filename C:\InfoPathForms\Publish\sample.xsn
stsadm.exe -o UpgradeFormTemplate -filename C:\InfoPathForms\Publish\sample.xsn
stsadm.exe -o execadmsvcjobs
stsadm.exe -o ActivateFormTemplate -url http://demosite -filename C:\InfoPathForms\Publish\sample.xsn

UPDATE: If you just changed the code behind of the form and want to deploy it there is even better and quicker way to do it. When the form is deployed using the above stsadm scripts what it does is, it depoys the form as a content type feature and the folder name is some what like FT- which is found under C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\
Under this you will find folder liek solution.xsn. Find the latest one and drop the updated DLL’s in there and then reset the IIS or recycle the app pool for the site collection. That is it!!

PS: I got the initial help of preparing the batch script from here.

InfoPath cannot connect to a data source when viewed in browser – Cross Domain Issues – Universal Data Connection

InfoPath cannot run the specified query.

InfoPath cannot connect to the data source.

Access is denied.

One of the big issues with InfoPath Forms is its error reporting. It could sometimes piss you off. It says there is a problem that is it! We have to spend lot of time clicking and clicking and clicking buttons all over trying to find where is the problem. May be that is how these tools should work…

Steps to go with when you get the above error:

  1. The above error seems to be quite often and it hints that there is some problem with the ‘Data Source/Connection’. If the form is showing the error while loading i.e form never loads but shows a message to ‘continue or start over’, then there is some problem with the data source which is set up to ‘Automatically retrieve data when form is opened’.
  2. If the above is the situation then open up the Data Sources window (Tools – Data Connections) and make sure that the data connection is set up properly and the data source is in place, working and serves requests.
  3. If the above error is shown when user does some action like clicking on button, then check the Rules in the properties of that control (button) and check for those data sources/connections.
  4. If the form works fine when previewed as an application but throws the above error after publishing to SharePoint site or when viewed as a browser form, then most probably the problem will be with the cross domain issue. If the InfoPath is trying to query or submitting to a web service (could be any other data source) and that web service is hosted as and the sharepoint site is hosted as then thats called a cross domain issue. The infopath form is trying to talk to a service which is hosted in a different domain and it can’t trust it. This can be solved by giving full trust to the form(Tools – Form Options – Security and Trust) but its not the right way to go and your SharePoint admin might restrict that. The only way to go is setting the security and trust to ‘Domain’ and converting the existing data connections or just the cross domain connections to Universal Data Connection (UDC) format. Its very simple to do and gets rid of any cross domain issues. To create UDC connections read this article. For those who have no patience to read the article, below are the quick steps involved:
    1. If Universal data connection document library doesn’t exist in the SharePoint site then create one or request your admin to create one and give you proper rights for you. (Go to ‘View all site content’ – Create – Universal Data Connection Library)
    2. Open up the InfoPath forms Data Connections window, select the cross domain data source connect and then click the ‘Convert’ button and follow the wizar. You need to provide the above created UDC library along with a name for the file for example:
    3. Now that is not enough, either you or your admin should approve the sampleudc.udcx document created in the UDC library.
    4. Re-publish the InfoPath form to SharePoint and test it.
  5. In central administration, under InfoPath Forms Services configuration, there is a checkbox to allow cross-domain issues. I am not sure if this is done then above UDC is still required or not. I will update as I learn about it.

More links worth to read: