Wednesday 6 July 2011

Powershell command to access Microsoft.SharePoint assembly does not work

I wanted to list the set of resource measures on the SharePoint environment that I am working on. To get the list of resource measures we can use powershell, using the command
[Microsoft.SharePoint.Administration.SPUserCodeService]::Local.ResourceMeasures
I encountered the following error in the console.
Unable to find type [Microsoft.SharePoint.Administration.SPUserCodeService]: make sure that the assembly containing this type is loaded.
At line:1 char:56
+ [Microsoft.SharePoint.Administration.SPUserCodeService] <<<< ::Local.ResourceMeasures + CategoryInfo : InvalidOperation: (Microsoft.Share...UserCodeService:String) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound


Solved:
The problem was because SharePoint powershell snap in was not loaded.
The command to load the SharePoint powershell snap in is as follows. We need to just run this command in the powershell command prompt.
Add-PSSnapin Microsoft.SharePoint.Powershell

Error : Sandboxed Solution deploy

I created a sandbox solution. While working on the solution I added a Sharepoint mapped image folder to the solution. In visual studio when I clicked deploy of the project I encountered the following error.
The deployment type "TemplateFile" of file "ALLMTGS.GIF" in Project Item "Images" is not compatible with a Package in a Sandboxed Solution.
The Project Item "Images" cannot be deployed through a Package in a Sandboxed Solution.


Solved:
The cause of the problem was that, I created a Sandboxed solution. A Sandboxed solution does not support disk operations. I changed the solution type from Sandboxed to farm solution and the deployment worked fine. Below are the steps I followed in visual studio to change the sandboxed solution to a farm solution.
  1. In the solution explorer, select the sharepoint project that is to be deployed
  2. With the selection on the project, navigate to the properties window (press F4)
  3. Change the value of the property 'Sandboxed Solution' to 'false'
  4. An alert will be displayed asking if you have farm administrator previleges. Click 'OK'

Tuesday 5 July 2011

Error when upgrading sandbox solution

The URL '_catalogs/solutions/mysolutions.wsp' is invalid. It may refer to a nonexistent file or folder, or refer to a valid file of folder that is not in the current Web.

I encountered this error when trying to upgrade a sandbox solution in Sharepoint 2010.

Solved:
The problem was due to a feature template xml having a wrong namespace given to the assembly name for the feature receiver attributes. I corrected the namespace problem and the upgrade started working fine.
The corrected section of the feature.template.xml goes like this.
<UpgradeActions ReceiverAssembly="HelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b2135059549c7590"
ReceiverClass="HelloWorld.Features.HelloWorldFeature.HelloWorldFeatureEventReceiver">

Friday 24 June 2011

Error @ SPSite site = new SPSite()

I created a new console application using Visual Studio2010. The console application had only one single line of code.

using(SPSite site = new SPSite("http://myspsite2010"))
{
Console.Write(site.RootWeb.Title);
}


The error message I got when I debugged this simple console application is.

The Web application at 'http://myspsite2010' could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Solved:
Right-click on the project > Go to properties. In the properties dialog go to 'Build'. Under the 'General' section change the 'Platform target' to 'x64'.

Friday 26 March 2010

Step by step installation of MOSS 2010 (beta)

Hi,

Currently only the beta version of MOSS 2010 is available for installation.


Check system requirements

MOSS 2010 needs a set of system requirements to be present before we can proceed with the installation.

Download the build
The build can be downloaded from the microsoft technet page.

Patches to be installed
Before proceeding for installation, we need some patches to be installed on the OS for completing the installation of MOSS 2010 successfully. Some of them are listed below.
  • KB976462

    FIX FOR: WCF: Sharepoint Shared Services Roll-up


  • KB971831

    FIX: A hotfix that provides a method to support the token authentication without transport security or message encryption in WCF is available for the .NET Framework 3.5 SP1


  • ...


Common installation errors
  • This update is not applicable to your computer :
    A common error which pops up while installing most of the patches are "This update is not applicable to your computer". Ignoring the patch which gives such a message will not do any harm to the installation of MOSS 2010.


Install MOSS 2010
Follow the on-screen instructions and complete the installation. The prepare tool available in the main screen installs all the prerequisite software required for MOSS 2010.

Compared to MOSS 2007, the installation of MOSS 2010 is very eazy.