Wednesday, February 27, 2013

Setting Up the Development Environment for SharePoint 2010 on Windows 7

The development environment that you create by using these instructions will not support SharePoint farm installations, and you should not host active production sites with this configuration. These instructions enable you to get started with an environment that is specifically suited to developing SharePoint custom solutions.

Note:
For a Windows PowerShell script that installs and configures all of the prerequisites and products that you will need to get started with SharePoint Server 2010 development, see SharePoint 2010 Easy Setup Script.

--------------------------------------------------------

Hardware requirements
Processor: 64-bit, four cores
RAM: 4 GB for developer or evaluation use (8 GB of RAM is preferable)
Hard disk: 80 GB for system drive

--------------------------------------------------------

Prerequisite & hotfixes

SharePoint requires your operating system to have certain prerequisites installed before installation begins. But you cannot use PrerequisiteInstaller.exe, included in setup files, on Windows 7.

You must install the WCF Hotfix for Microsoft Windows 7.

Updates the ASP.NET common language runtime (CLR) to recognize a new option of optimizing compilations. To take advantage of this option, set the optimizeCompilations property of the tag in your web.config file to true.

<compilation optimizecompilations="true">

This change significantly improves the initial page load time after you have installed a solution to the bin directory.

You must also install the ADO.NET Data Services Update for .NET Framework 3.5 SP1 to enable REST-based data services. This update is available for Windows Server 2008 R2 and Windows 7.

Note:
You can use a separate Microsoft SQL Server instance, but you should not configure your installation as a SharePoint farm and you should not host active sites on this configuration.

--------------------------------------------------------

To set up a developer workstation

Using a text editor such as Notepad, open the installation configuration file, config.xml, located in the installation folder e.g.: c:\SharePointFiles\files\Setup\config.xml

Add this line inside the <configuration> tag:

<Setting Id="AllowWindowsClientInstall" Value="True"/>

Review the complete configuration file. It now looks similar to the following for SharePoint Foundation 2010. The complete configuration file will be longer for SharePoint Server 2010 (and therefore the text below cannot replace the contents of that file), but should use the same setting for the AllowWindowsClientInstall attribute.

<Configuration>
  <Package Id="sts">
    <Setting Id="SETUPTYPE" Value="CLEAN_INSTALL" />
  </Package>
  <DATADIR Value="%CommonProgramFiles%\Microsoft Shared\Web Server
   Extensions\14\Data" />
  <Logging Type="verbose" Path="%temp%" Template="Microsoft Windows
   SharePoint Services 4.0 Setup *.log" />
  <PIDKEY Value="PIDKey Value" />
  <Setting Id="UsingUIInstallMode" Value="1" />
  <Setting Id="SETUP_REBOOT" Value="Never" />
  <Setting Id="AllowWindowsClientInstall" Value="True"/>
</Configuration>

Note:
All of the text in this configuration file is case-sensitive. If you do not edit the configuration file as described in the previous step or if you do not save the configuration file, when you try to run the installation you see the following error message.



Now install the following additional prerequisites:
  • Microsoft FilterPack 2.0
  • Microsoft Sync Framework
  • SQL Server Native Client
  • Windows Identity Foundation (Windows6.1-KB974405-x64.msu)
The following 2 is not required if you are going to install SharePoint Foundation 2010
  • Chart Controls
  • SQL Server Analysis Services - ADOMD.Net

It can be found in the setup directory under ...\PrerequisiteInstallerFiles\FilterPack\FilterPack.msi

Next manually enable each of the required Windows Features under the Internet Information Services and then restart your computer to complete the changes that you made to Windows Features.





Note:
They have been broken into two figures for the sake of readability.

--------------------------------------------------------

Install SharePoint 2010


After the installation is complete, you are prompted to start the SharePoint Products and Technologies Configuration Wizard.

Note:
If you are using a local instance of Microsoft SQL Server 2008, install the Microsoft SQL Server 2008 KB 970315 x64 before starting the wizard.



More details can be found at:
http://msdn.microsoft.com/en-us/library/ee554869(v=office.14).aspx

Sunday, February 17, 2013

Code trick to manipulate existing SPtimer jobs

Today I got to go on a trip down memory lane.

Long story short I had to create a sp2007 timerjob, had a few ups and downs and found this very helpful post to manipulate already running timer jobs.

SharePoint 2007 has a number of timer jobs. These are things that run on a scheduled basis.
To see a list of them go to Central Administration > Operations > Timer Job Definitions

So say for instance, Contoso wants you to deliver a solution based on "Information Management Policy" in a flat 4 hours. Well that's great, except that you can't demo it because guess what, that job is set to run on a daily basis. I think it would be very useful to test such things that run based on a timer in a development environment, so there has to be a way to configure these jobs to run on a shorter time schedule. Luckily, there is such a way.

For instance, the "Information Management Policy" job, is a part of the "PolicyConfigService" One way would be to use SharePoint's API to write code to change the job's schedule.

namespace ConsoleApplication1
{
    using System;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.Administration;

    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite tmpSPSite = new SPSite("http://moss2007"))
            {
                SPServiceCollection tmpSPServiceCollection = tmpSPSite.WebApplication.Farm.Services;

                foreach (SPService tmpSPService in tmpSPServiceCollection)
                {
                    if (tmpSPService.Name == "PolicyConfigService")
                    {
                        foreach (SPJobDefinition tmpSPJobDefinition in tmpSPService.JobDefinitions)
                        {
                            if (tmpSPJobDefinition.Title == "Information management policy")
                            {
                                SPMinuteSchedule tmpSchedule = new SPMinuteSchedule();
                                tmpSchedule.BeginSecond = 0;
                                tmpSchedule.EndSecond = 59;
                                tmpSchedule.Interval = 5;

                                tmpSPJobDefinition.Schedule = tmpSchedule;
                                tmpSPJobDefinition.Update();
                            }

                            Console.WriteLine("JOB: " + tmpSPJobDefinition.Title);
                        }
                    }
                }
            }
        }
    }
}

As you can see, the above code replaced the schedule for the Information management policy job to a minute based schedule.

Now, when you set a site collection policy to delete a document, it can be demonstrated in a minute's time.

Thursday, February 7, 2013

Trying to delete a SP site after SP1 (using old sp DB)

Error
Specified method is not supported.
Troubleshoot issues with Microsoft SharePoint Foundation




After installing SP1 for SP2010, you'll noticed that you can still create new site/webs but you can no longer delete them, this is because the database of the web application needs to be upgraded.


If you go to
Go to Central Admin -> Upgrade and Migration -> Review database status
You will see the some DB has the following status “need to be upgraded”.

Solution:
Upgrade-SPContentDatabase PowerShell command


More info on, resuming of a failed database upgrade / initiating a database upgrade:
http://technet.microsoft.com/en-us/library/ff607813.aspx