Friday, February 26, 2010

Application variables empty in classic ASP when deployed on IIS 7.0

 

Last week, I went back in time when one of my friend asked me to help on his site developed in classic ASP. He wanted to deploy this on IIS 7.0 and was getting all his Application variables empty. First, I thought there will be one more global.asa in one of parent directory. But there was no other global.asa file and the worst part was all session variables were working. Finally, I was able to fix this by converting the site from Virtual directory to an Application in IIS 7.0.

So, to make your classic ASP site which is using Application variables work with IIS 7.0, deploy it as an application and not virtual directory. Glad ASP.NET came :-)

Friday, February 05, 2010

Microsoft SharePoint 2010 Products Preparation Tool

 

This tool assist you in the installation of the software prerequisites for SharePoint Server 2010. Ensure that you have an Internet connection, because some of these prerequisites are installed from the Internet.

To Run this tool:

This tool checks if following prerequisites exists:

  • Web Server (IIS) role
  • Application Server role
  • Microsoft .NET Framework version 3.5 SP1
  • Microsoft "Geneva" Framework
  • Microsoft Sync Framework Runtime v1.0 (x64)
  • Microsoft Filter Pack 2.0
  • Microsoft Chart Controls for the Microsoft .NET Framework 3.5
  • Windows PowerShell 2.0 CTP3
  • Microsoft SQL Server 2008 Analysis Services ADOMD.NET
  • ADO.NET Data Services v1.5 CTP2

Tuesday, February 02, 2010

Feature Activation Error : Office SharePoint Server Publishing Infrastructure

 

If you get error denied while activating this feature, you have not activated the dependent feature called “PublishingResources”.

Fix:

Activate the “PublishingResources” feature using stsadm command

stsadm -o activatefeature -name PublishingResources -url http://YOUR_WEBSITE
(change the URL)

Now, Activate the Office SharePoint Server Publishing Infrastructure feature.

Friday, January 29, 2010

Error: “The search service is currently offline. Visit the Services on Server page in SharePoint Central Administration to verify whether the service is enabled. This might also be because an indexer move is in progress”

 

Check you don’t have duplicate XML tag in the machine.config file on the server reporting error. It was Index server for me.

Wednesday, December 23, 2009

Free Microsoft Office 2010 Book

 

Download the free e-book “First Look: Microsoft Office 2010” from here

http://blogs.msdn.com/microsoft_press/archive/2009/12/09/free-e-book-first-look-microsoft-office-2010.aspx

Wednesday, December 02, 2009

The current farm uses database from the following SQL server(s) whose versions are not supported.

 

While upgrading from MOSS 2007 to SharePoint 2010, you might get the following error-

 

The current farm uses database from the follwoing SQL server(s) whose versions are not supported.


SharePoint requires these SQL server(s) to be upgraded to minimum supported version before you can continue. Refer to the log file of this configuration wizard for more information about the minimum supported SQL versions and download instructions.

 

To fix this you need to install cumulative updates for SQL Server 2008 SP1
http://support.microsoft.com/kb/970315

Steps to change Virtual Directory Local Path for a MOSS WebAppications and Central Admin site

 

One of easiest way to move Web Application virtual path is to delete the Web application(only IIS site) from Central Administration and recreate them again using new path. But you cannot move Central Admin site using this approach.

After goggling for sometime, I found this nice article which describes the steps to move SharePoint sites including Central Admin

The link is http://www.mattjimison.com/blog/2009/02/26/how-to-change-the-iis-path-for-a-sharepoint-web-application/\

Monday, November 30, 2009

Install SharePoint 2010 on Windows 7(64-bit):

 

SharePoint 2010 provide functionality to install SharePoint 2010 on Windows7. Follow these steps to install on Windows7(64-bit):

1.      Install SQL Express 2008 from "http://www.microsoft.com/express/sql/download/”

2.     Download SharePoint 2010 Beta from http://technet.microsoft.com/en-us/evalcenter/ee388573.aspx. Copy the exe to the folder C:\SharePointFiles

3.      Open Command prompt and run

c:\SharePointFiles\ en_sharepoint_server_2010_beta_x64_x16-19249.exe /extract:c:\SharePointFiles

4.      Open the file using notepad “c:\SharePointFiles\files\Setup\config.xml”

5.      Add <Setting Id="AllowWindowsClientInstall" Value="True"/> to the Configuration section

6.      Install the Filter Pack from C:\SharePointFiles\PrerequisiteInstallerFiles\FilterPack\ FilterPack.msi

7.      Install the following softwares:

 

8.      Run following command to Install Windows Features(IIS and other related)

 

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;

IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;

IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;

IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;

IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;

IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;

IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;

IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;

IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;

WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;

WCF-NonHTTP-Activation

 

 

9.      Run “c:\SharePointFiles\Setup.exe” to install SharePoint

10.   On “Choose the installation you want page”, click Standalone

11.   Choose default settings and complete the installation

12.   Now, run RegEdit and browse to “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS”

13.   Change “ServerRole” value from SINGLESERVER to WFE

14.   Start the “the SharePoint Products and Technologies Configuration Wizard” and follow the steps to install SharePoint 2010

Thursday, November 26, 2009

Sandboxed Solution in SharePoint 2010

 

SharePoint 2010 comes with a great feature – Sandboxed Solution. This is type of solution which could be deployed to a site by a site administrator. A site administrator don’t need to be a farm administrator to deploy the solution. The solution have full access to the site where it is deployed but limited to other sites and resources for security reason.

This would be ideal for SharePoint Online services where you could create multiple sites and give user permission to manage and upload custom code to their site without needing assistance from farm administrator

To create a sandboxed solutions:

  1. Create a new SharePoint project in VS 2010
  2. On SharePoint Customisation Wizard, enter your Site URL. Select “Deploy as a sandboxed solution” as trust level
  3. Click Finish and start adding your artifacts to the project
  4. Build the solution and create WSP package
  5. Browse to your site
  6. Open Site Actions – Site Settings
  7. Under the Galleries section, select solutions
  8. On the Solution page, upload the solution

Untitled

Now, you could add your artifacts(web parts, activate features) specific to your site

Safe List object from SPWeb in SharePoint 2010

 

If MOSS 2007, the code to read the list object use to be

SPWeb web;
SPList list = null;
try
{
list = web.Lists[“Pages”] }
catch(Exception ex)
{
// List not found
}

The reason to have a try-catch was because SharePoint would throw an exception if the list does not exist

Glad to see that in SharePoint 2010, this issue is fixed. The code in SharePoint 2010, would be

SPWeb web;
SPList list = web.Lists.TryGetList(“Pages”)

TryGetList returns the list with the specified title from the list collection, but returns null if its not found. No more more error handling is required

Monday, November 23, 2009

Using Linq To SharePoint in 2010

 

SharePoint 2010 comes with SpMetal tool that auto-generate entity types based on a list definition. It uses the SharePoint Lists web service to get the schema of a list.

This tool is located at c:\program files\common files\microsoft shared\web server extensions\14\bin

The syntax is

spmetal.exe /web:SITE-URL /namespace:YOUR_NAMESPACE /code:CLassName.cs

Microsoft.Sharepoint.Linq Assembly

 

This is not installed in GAC and hence would not be visible in .NET assembly tab when adding a new reference to project. This is located under at “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI”

Data View Web Part in SharePoint 2010

 

This web part have been replaced by XSLT List View Web part in SharePoint 2010. The old Data View Web part is still supported in SharePoint 2010 but not recommended to use.

Developer Dashboard in SharePoint 2010

 

SharePoint 2010 comes up with great tool to check the performance and process steps(same like ASP.NET trace). This would enable the following information to be displayed:

· The SQL queries they have and their timings.
· Web Part Events Offsets for testing performance against custom web parts.
· Trace information, usually only found in the ULS logs, now available on the page.
· A tree view of all controls on the page.
· Session and Cookie information

To enable it, follow these steps:

  • Enable Developer Dashboard- Run this command “stsadm.exe" -o setproperty -pn developer-dashboard -pv OnDemand”
  • Do IISReset
  • Activate Developer dashboard by clicking on the icon in the top right corner of the browser window of your site
  • This will refresh the browser and display the tool bar at the bottom of the page. Click on the Show or hide additional tracing information link at the bottom for detail trace information

Friday, November 20, 2009

Update Parent Content Type

 

When you update a parent content type, the following consideration need to be taken account:

  1. Settings of child content type column would be overridden by setting of parent content type column
  2. If you make some changes in parent content type and don’t push them down to child content type, these changes would not be pushed to child content type on later stage.
  3. If you delete any column in child content type, they are not created again when you push changes from Parent content type
  4. Read-only and Sealed child content type will not be updated and an error would raise

Error “Attempting to load a 64-bit application, however this CPU is not compatible with 64-bit mode"

 

This error occurs when you are trying to create a 64 Bit operating system VMware.

To fix this, restart your machine and enter your system BIOS. Look for Virtualization property and enable it. This is disabled by default.

Installing SharePoint 2010 on Microsoft Virtual PC

 

You can't install SharePoint 2010 on Microsoft Virtual PC as it needs 64 bit Platform. As of now, Microsoft Virtual PC don’t support 64 bit operating system guest.

To overcome, you need to use VMWARE as Windows 2008 64 Bit could be installed on VMware Client.

Upgrade Vista 32 Bit to 64 Bit Windows 7

 

If you try to install Windows 7 64-bit on 32-bit Vista, the following error would occur:

The Version of this file is not compatible with the version of Windows you're running.

The issue is you can’t do a direct in-pace upgrade from 32-bit to 64-bit Windows 7. The only way to do a clean install. Follow the below steps:

  1. Backup manual data from your machine
  2. Backup the application settings and user documents\pictures etc using Windows Easy Transfer(http://www.microsoft.com/windows/windows-vista/features/easy-transfer.aspx)
  3. Create a bootable DVD or USB using Windows 7 USB/DVD Download tool(http://download.cnet.com/Windows-7-USB-DVD-Download-Tool/3000-18513_4-10972600.html)
  4. Restart the machine and access BIOS(using F12 or other key as per your machine). Change the Boot sequence to use DVD\USB as the first option
  5. Restart the machine, Windows7 setup should start now
  6. Select “Custom” installation option and follow the instructions
  7. Install and activate Windows 7

Enjoy the wonderful experience of Windows 7

Tuesday, November 17, 2009

Update SharePoint List LookUp field

To update a lookup field in SharePoint, you need to use SPFieldLookupValue constructor

The format is

Item[“LookupField”] = new SPFieldLookupValue(ITEM_ID, ITEM_TITLE);

Create a blank page in Pages Library

You need to perform these steps:

Get a blank page from file system or using the below function

StringBuilder sb = new StringBuilder();
sb.Append("<%@ Page Inherits=\"Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,");
sb.Append("Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c\" %> <%@ Reference VirtualPath=\"~TemplatePageUrl\" ");
sb.Append("%> <%@ Reference VirtualPath=\"~masterurl/custom.master\" %><html xmlns:mso=\"urn:schemas-microsoft-com:office:office\" ");
sb.Append("xmlns:msdt=\"uuid:C2F41010-65B3-11d1-A29F-00AA00C14882\"><head>&nbsp;<!--[if gte mso 9]><xml>");
sb.Append("<mso:CustomDocumentProperties><mso:PublishingContact msdt:dt=\"string\">1218</mso:PublishingContact>");
sb.Append("<mso:display_urn_x003a_schemas-microsoft-com_x003a_office_x003a_office_x0023_PublishingContact ");
sb.Append("msdt:dt=\"string\">avanade</mso:display_urn_x003a_schemas-microsoft-com_x003a_office_x003a_office_x0023_PublishingContact>");
sb.Append("<mso:PublishingContactPicture msdt:dt=\"string\"></mso:PublishingContactPicture>");
sb.Append("<mso:PublishingContactName msdt:dt=\"string\"></mso:PublishingContactName>");
sb.Append("<mso:ContentTypeId msdt:dt=\"string\">0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390064");
sb.Append("DEA0F50FC8C147B0B6EA0636C4A7D40073BD3FF4186E874380ADB2C06F742F8E</mso:ContentTypeId>");
sb.Append("<mso:Comments msdt:dt=\"string\"></mso:Comments>");
sb.Append("<mso:PublishingContactEmail msdt:dt=\"string\"></mso:PublishingContactEmail>");
sb.Append("<mso:PublishingPageLayout msdt:dt=\"string\">/_catalogs/masterpage/BlankWebPartPage.aspx, ");
sb.Append("Blank Web Part Page</mso:PublishingPageLayout>");
sb.Append("</mso:CustomDocumentProperties>");
sb.Append("</xml><![endif]--><title></title></head>");
Byte[] blankPage = ASCIIEncoding().GetBytes(sb.ToString());

 

Now, add this blank page to the Pages Library

SPList list = web.Lists["Pages"];

SPFile file= list.RootFolder.Files.Add(“blankpage.aspx”, blankPage);