Tuesday, October 4, 2011

Migration from MOSS 2007 to SharePoint 2010


System Requirements

è For migration from MOSS 2007 to SharePoint 2010 the minimum requirement is WSS SP2 and Office Server SP2 must be installed in the MOSS 2007 server. So before upgrade the content database make sure both the things are installed in the source server

Preupgrade check

è Preupgradecheck command will let us know about the things that may restrict us to upgrade the database in SharePoint 2010 server. Before upgradation we need to fixed up all the steps which are failed in the preupgradecheck.


Backup Content Database of MOSS 2007 site

è Before start taking backup of the database first go to the Manage Content Databases section in the Central Administration site and check the name of the database attach to your site.

Central AdministrationàApplication Management->Manage Content databases


è Open SQL Server right click on the databaseàTasksàBack Up

è Click on Add button and browse to the path where you want to copy the backup file





Move the database to destination server

è Move the backed up database to your destination database server and restore it SQL server

Restoring Content Database

è Open SQL Server right click on Database à Restore database

è Specify a database name for restoring the database. If the specified database name is exist in the list of databases then your backed up database will overwrite it else it will create a new database and restore over it.





è Go to the Options page and check the Overwrite the existing database checkbox



Create a blank site in destination server

è For creating blank site in SharePoint 2010, open the Central Administration site and click on Manage web application link in the Application Management group.

Central AdministrationàApplication ManagementàManage web applications


è Click on New link from the top left corner of the page

è Enter the details of the site



è Make the site Configurable and give the Service Account for it

è After the Web Application is created click on Create Site Collection link for creating a blank site collection for the Web Application


è Give service account for Primary Site Collection Administrator


Detaching Content Database

è After the site get created go to Manage Content Database section and detach the database attached with the blank site

è Central AdministrationàApplication ManagementàManage content databases

è


Click on the database


è Check the Remove content database check box and click OK for the warning message


è Click OK button and remove it

Upgrading and Attaching Content Database

è After detaching the database attached with the blank site, our next step is to upgrade the MOSS 2007 site content Database restored in SQL Server and attach it to our blank site using PowerShell command prompt

è Run PowerShell with Administrator privilege


è Test –SPContentDatabase –Name [Database Name] –WebApplication [Web Application Name]

è The above command will check the database for any references are missing in the destination server [i.e Custom Feature, Custom Webpart, Custom Site Definition etc].If any of the components are missing then deploy those to the destination server .Basically the custom components do not restrict the upgradation of the database, you can deploy this after upgradation too but it’s a good practice to deploy it before upgradation of the database.


è Mount –SPContentDatabase –Name [Database Name] –WebApplication [Web Application name]

è The above command will upgrade the database and attach with the site collection of the specified web application


Deploying EasyTabParts webpart

Add solution Farm Solutions

Open command prompt and go to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN folder and run the command stsadm –o addsolution –filename C:\EasyTabParts.wsp

[I have store the EastTabParts.wsp file in C drive, if you have stored it in other location then specify the path instead of C:\EasyTabParts.wsp]


Deploy Solution

Open Central Administration site and go to Manage Farm Solutions page

Central AdministrationàSystem SettingsàManage Farm Solutions


Click on Deploy Solutions link and deploy the solution to your site


Search Configuration



Give a name for the Search Application

Search service account should be your service account

Give an Application pool name for Search Admin Web Service


The Application pool for Search Admin Web Service should be configurable with service account

Give an Application pool name for Search Query and Site Settings web Service

The application pool for Search Query and Site settings web Service should be configurable with service account


àClick OK to create the search Service


Click on Search Service Application MC and then click on Content Source from the left navigation bar


Edit the Content Source and map your site


Make sure the URL is your site collection URL

àSchedule your content source both for Full Crawl and Incremental Crawl as per requirement and check the start full crawl of the content source check box for crawl the content source

Check the crawl log once full crawl is completed

è Click on Central AdministrationàApplication ManagementàConfigure Service Application Associations


àClick on your site


è Change the Edit the Following group of connections to custom


è Choose the proper search service application and click ok


IIS Settings for running .exe files

Open Internet Information Service(IIS)

Click on your site from the list of sites

Double click on Handler Mapping

Click on Edit Feature Permissions, uncheck Execute checkbox and click OK to save the change

Monday, September 26, 2011

Create a Custom Sharepoint List Defination

Microsoft Visual Studio 2010 provides a project type that makes it easier to create list definitions in XML and to create list instances that are based on those definitions. A field definition, defines the columns that appear inside of the list template. For more information about the XML that is used to define a field type, see Field Types XML. Let's follow the steps below to create custom list fields with different data types at a SharePoint custom list definition...
Open Visual Studio.Net 2010 -> File (Menu) -> New -> Project:
1


Select "2010" for SharePoint under "Installed Templates" from the left side panel -> Select "Empty SharePoint Project" from the right side panel. Type a name for your project, then click the OK button.
2
Type the URL of your local SharePoint site at the "What local site do you want to use for debugging?" textbox and choose "Deploy as a farm solution" (Read about the differences between Farm & Sandbox Solutions):
3
Click on the "View" menu -> Solution Explorer -> right-click at the created solution -> Add -> New Item:
4
Select "2010" for SharePoint under "Installed Templates" from the left side panel. -> Select "List Definition" from the right side panel:
5
Keep/Edit the display name of the list definition. Select "Custom List" as the type of the list definition and check "Add a list instance for this list definition":
6
Here is our solution with the created custom list definition and added list instance:
            7
Let's add some custom list fields with different data types. Open the "Schema.xml" file under created the "customListDefinition" directory. Select the "ContentTypes" tag section under "MetaData" and remove it. (We don't need for now in this tip to create the custom content type and associate it to our custom list definition.
7.1
Then add the fields below under the "Fields" tag section:
7.2
 "Type = Text" : Single line of text. (Plain Text).
"Type = Note" : Multiple line of text.
"Type = Image" : Publishing rollup image. (Image Picker).
"Type = URL" : Hyperlink (with URL and description fields).
"Type = Boolean" : Check Box.
"Hidden = TRUE" : In order to hide the default created column "Title" field for any custom list.
"ID" : Identifier value representing a GUID "Global Unique Identifier" which can be uniquely created as follows:
7.3 
 7.4
Then, let's show the above created fields at the listing view "AllItems". Search for the "View" tag where "DefaultView=TRUE" in the "Schema.xml" file:
7.5

In the "ViewFields" tag section, add the "FieldRef" fields below, then save all:
7.6
Right click on the "ListDefViaVS2010" project, then select "Deploy"  in order to deploy our solution to the SharePoint site. Then wait until we check that the output is successfully deployed:
8

9
Now let's go to the SharePoint site to check the deployed custom list definition. Click the "Site Actions" menu then "View All Site Content":
10
As we can see below a new added list instance to our custom list definition "ListDefViaVs2010 - ListInstance1" :
11
Click on "ListDefViaVS2010 - ListInstance1" to go to the listing view "AllItems" form:
12
We can see all defined "FieldRef" fields under "ViewFields" tag section at "Schema.xml" list definition file.
Then , Let's click on the "Add new item" link:
13
Now we can see all defined custom fields under the "Fields" tag section in the "Schema.xml" list definition file.

Reference link: http://msdn.microsoft.com/en-us/library/ee231593.aspx

Saturday, September 3, 2011

Custom properties in SharePoint Webparts

For adding custom properties to our web part we need to do the following

1) Create property.

2) Decorate the property with the following attributes

WebBrowsable - To allow your property to be visible within SharePoint.

WebDisplayName- To provide display name to the property.

WebDescription- To provide description for that property.

Personalizable - To define the scope of it i.e either User or Shared through PersonalizationScope enumeration.

Let’s take a simple example wherein we have 2 properties defined, user will enter value for them and finally when the web part is rendered, we would be displaying their sum within the web part.

namespace AdditionWebPart

{

public class SumWebPart : WebPart{

private int firstVariable;

[WebBrowsable(true),

WebDisplayName("First Value"),

WebDescription("Enter value for first variable"),

Personalizable(PersonalizationScope.User)]

public int FirstVariable

{

get { return firstVariable; }

set { firstVariable = value; }

}

private int secondVariable;

[WebBrowsable(true),

WebDisplayName("Second Value"),

WebDescription("Enter value for second variable"),

Personalizable(PersonalizationScope.User)]

public int SecondVariable

{

get { return secondVariable; }

set { secondVariable = value; }

}

protected override void Render(System.Web.UI.HtmlTextWriter writer){

writer.Write(“The total is “ +this.calcTotal(this.firstVariable,this.secondVariable));

}

private int calcTotal(int a, int b){

return a + b;

}}}


Tuesday, August 2, 2011

PowerShell Command

Add Solution:
Install-SpSolution -Identity "VisualWebPartProject1.wsp" -WebApplication "URL" _GACDeployement

Feature Command
Install-SPFeature "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\Feature name"

Uninstall-SPFeature "459FF807-10D1-41d4-ACA1-EDFC3BBFFB0B"

update-SPFeature "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\BPCL Master Feature"

Backup command:
Backup-SPSite "http:///msd/AU" -path "E:\Backup\Backup\MSD\AU.bak" -Force -DatabaseServer SQL1\SPSQLLOCALSERVER -DatabaseName WSS_Content_MSD_AU

SilverlightWebParts


Using Visual Studio

You can create Silverlight-based applications using Visual Studio 2008. (Silverlight support for Visual Studio 2008 is available as a plug-in for the IDE.) Visual Studio provides the same tools for Silverlight, such as powerful editors, project management, debugging, and so on, that it already provides for creating applications with the .NET Framework.

Using Expression Blend

Designers can take advantage of the end-to-end capabilities of Microsoft Expression Blend to design, build, and deliver Silverlight-based applications. Expression Blend has all the capabilities needed to create graphics and media assets, design interactivity, and produce experiences. Expression Blend can generate XAML output, meaning that programmers who use Visual Studio and designers who use Expression Blend can share the same files.

Creating a Silverlight-based application with Microsoft Expression


Resources for Getting Started

Some of the resources in the following list provide information for both versions of Silverlight; other resources are specific to either 1.0 or 2. Note that the term "Silverlight" without a version number applies to both versions.

· Getting Started with Silverlight: Provides an introduction to developing applications with Silverlight 2.

· Silverlight Architecture: Provides an overview of the architecture of Silverlight.

· Silverlight 1.0 - Development with JavaScript: Provides information for developing with Silverlight 1.0, which supports the XAML markup language and JavaScript for creating applications. Most of the conceptual material contained in this section (animations, graphics, XAML, and so on) is also useful to Silverlight 2 developers.

· Silverlight 2 Beta 2 - Development with the .NET Framework: Provides information for developing with Silverlight 2, which includes .NET Framework features.

· Silverlight Technical Articles: Provides additional MSDN articles about Silverlight.

Introduction to Creating a Silverlight Web Part

This article describes how to create a very simple Microsoft Silverlight Web Part in ASP.NET that hosts a canvas (XAML), which can have events mapped to ECMAScript (JScript, JavaScript). We develop the Silverlight Web Part by using Microsoft Visual Studio 2005. The Silverlight Web Part uses Microsoft Silverlight only on the client side, and is based on the Microsoft Silverlight 1.0 Runtime. You can then use the Silverlight Web Part in Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 to display a canvas (XAML).

Prerequisites

· To successfully create and use the Silverlight Web Part, you must understand the following: Microsoft Silverlight, XAML, ECMAScript (JScript or JavaScript code), and ASP.NET control development.

· To be able to test the solution, you must have the latest version of the Silverlight plug-in installed on the client computer.

To view the Page.xaml.js file and Default_html.js file referred to in this article, see Complete Page.xaml.js File and Default_html.js File.

Creating the Silverlight Web Part

The first part of our task is to create a solution in Visual Studio 2005, and then create the Silverlight Web Part.

To create the Silverlight Web Part

1. In Microsoft Visual Studio 2005, open a Visual C# Class Library project.

2. Remove Class1.cs.

3. Add the basic SilverlightWebpart.cs to the project.

4. In the project references, add a reference to System.Web.

5. Add private properties, which set the path to .js files and the .xaml file. You can add properties to customize the Silverlight Web Part to suit your specific needs.

6. Register the following three EcmaScript (JScript, JavaScript) files in the Web Part; these files are part of any standard Silverlight project or control:

· silverlight.js A standard file that detects whether the Silverlight client plug-in is installed on the client computer. If not, the file shows an icon of a location from where you can install the plug-in.

· Default_html.js The same as createsilverlight.js; this file contains the createSilverlight function that we need to modify with the code shown in code listing 7.

· Page.xaml.js Contains the event listeners.

7. Add the code that generates the HTML

tag where the Silverlight object will be created in your Web Part (for more information, see Creating Custom Web Parts).

8. Create a Default_html.js file and copy the following code into it to modify the createSilverlight function.

Deploying the Silverlight Web Part on Office SharePoint Server 2007

You can deploy the Silverlight Web Part on your server running Office SharePoint Server 2007 by using the following steps.

To deploy the Silverlight Web Part

1. Ensure latest version of the Silverlight plug-in is installed on the client computer. In the case that the plug-in is not installed, when the page with the Web Part loads for the first time, it displays a link that will show a location from which to download and install the plug-in. (This will happen automatically and no code is required.)

2. Copy the SomeName.dll (in our sample it will be SilverlightWebPart.dll) into the _app_bin directory of your SharePoint application; for example, C:\Inetpub\wwwroot\wss\VirtualDirectories\80\_app_bin. The .dll file can be signed and copied to the global assembly cache also.

3. Copy the files default_html.js, Page.xaml, Page.xaml.js and SilverLight.js into the top-level site (root) of the SharePoint Web application (for example, C:\Inetpub\wwwroot\wss\VirtualDirectories\80\_app_bin). We can copy these files at other locations also. Change the Silverlight Web Part property JSPath to the path where you have copied the .js files.

4. Add a element to the following entry to the web.config file with references to the SilverLight assembly, NameSpace, and mark it as safe.

5. For strong-named assemblies, the version, culture, and publickeytoken attributes will be added to the SafeControl element.

6. Go to the Web Part gallery from the site collection administration page. Click New, select BasicSilverLightWebPart, and then click populate gallery.

7. Go to any sample SharePoint site, and add the Silverlight Web Part to a page. Modify custom properties, such as the Silverlight control height and width.

8. Ensure that you supply the complete path to the Page.xaml file in the Silverlight Web Part’s custom properties (for example, /Page.xaml).

9. Save or publish the page.