Tuesday, January 28, 2014

Difference between SharePoint 2010 and MOSS 2007


SharePoint 2010
MOSS 2007
Look and feel
In SP 2010 look and feel perspective there will be a ribbon where we can have a look and feel like Office 2010
In MOSS 2007 there is no ribbon
Deployment of Web parts
In SharePoint 2010 deploying custom web part is pretty simple i.e. just right click on the solution and click Deploy
In MOSS 2007 you need to drag the dll either to bin or GAC
Silverlight Application
In SP 2010 we can create a Silverlight application directly from Visual Studio 2010
In MOSS 2007 we have to create a web part to host Silverlight application
Shared Database & Service Application
In SP 2010 there is no SSP but there is a concept of Service Application like BCS as one service application, Excel Services as another service application, User Profile as separate service application
General idea is that you have an application for each service, rather than one application with lots of service crammed into it
Own database rather than shared database in SP 2010
In MOSS 2007 we have SSP where we can work around with BI,Search Settings, User Profile Import, Excel Services, Info path
In Database also we use to have separate area for SSP stuff
Easy exports/imports between the forms
In SP 2010 we can update existing information
In MOSS 2007 through we can just read the information and we can't update the existing services
Improvement in Deployment
In SP 2010 we can Deploy through Farm based and solution based solution in SP 2010
In MOSS 2007 there is no such option
Alerts





In SP 2010 alerts were sent only through emails and send alerts to mobile device as SMS message. A New property delivery channel is introduced to indicate, whether the alerts is delivered as Email or an SMS message.
In MOSS 2007 alerts were sent only through emails.
Improvements of events
New events for list creation and web creation
No List and web events in MOSS 207
Getting Items from the list
In SP 2010 through object model we can fetch multiple list data by LINQ query and object model
In MOSS 2007 we can fetch only through object model
Rating
In SP 2010 we can have rating column by default
In MOSS 2007 we should install the feature that is available in codeplex to have rating
Key Word Suggestions
In SP 2010 we can have keyword suggestions
In MOSS 2007 we don’t have any keyword suggestions
Taxonomy
In SP 2010 we can create Taxonomy by using Managed Metadata service
In MOSS 2007 we don’t have taxonomy
Other Features
In SP 2010 we have Power Shell Scripting, JavaScript object model, Chart Web Parts
In MOSS 2007 we don’t have Power Shell Scripting, JavaScript object model, Chart Web Parts
Running stsadm command
In SP 2010 we have to go 14 hive path to run stsadm command
In MOSS 2007 we have to go 12 hive path to run stsadm command

Wednesday, January 22, 2014

PowerShell Script to run visual upgrade on all the migrated site collections

After migrating sites from SharePoint 2007 to SharePoint 2010, first thing usually we do is to visually upgrade the sites to look like SharePoint 2010 sites and not old 2007 look. You can perform this activity through Visual Upgrade page on Site Settings.
But if you have several site collections migrated from 2007 to 2010, the best way could be to use PowerShell to visually upgrade all the sites under all the site collections in a given web application.
You can easily customize this script to run it for single site collection as well.
1
2
3
4
5
6
7
8
#[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c")

#Add SharePoint PowerShell Snapin which adds SharePoint specific cmdlets

Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue

$webApplicationUrl = "Name of the Web Application URL"
$webapp = Get-SPWebApplication $webApplicationUrl
Write-Host "Visually upgrading sites under" $webApplicationUrl
foreach ($s in $webapp.sites)
{
     $s.VisualUpgradeWebs()
}
Write-Host "Visually upgrade Completed Successfully"


Common SQL Queries for SharePoint Content Database

– Query to get all the top level site collections
SELECT SiteId AS SiteGuid, Id AS WebGuid, FullUrl AS Url, Title, Author, TimeCreated
FROM dbo.Webs
WHERE (ParentWebId IS NULL)
– Query to get all the child sites in a site collection
SELECT SiteId AS SiteGuid, Id AS WebGuid, FullUrl AS Url, Title, Author, TimeCreated
FROM dbo.Webs
WHERE (NOT (ParentWebId IS NULL))
– Query to get all the SharePoint groups in a site collection
SELECT dbo.Webs.SiteId, dbo.Webs.Id, dbo.Webs.FullUrl, dbo.Webs.Title, dbo.Groups.ID AS Expr1,
dbo.Groups.Title AS Expr2, dbo.Groups.Description
FROM dbo.Groups INNER JOIN
dbo.Webs ON dbo.Groups.SiteId = dbo.Webs.SiteId
– Query to get all the users in a site collection
SELECT dbo.Webs.SiteId, dbo.Webs.Id, dbo.Webs.FullUrl, dbo.Webs.Title, dbo.UserInfo.tp_ID,
dbo.UserInfo.tp_DomainGroup, dbo.UserInfo.tp_SiteAdmin, dbo.UserInfo.tp_Title, dbo.UserInfo.tp_Email
FROM dbo.UserInfo INNER JOIN
dbo.Webs ON dbo.UserInfo.tp_SiteID = dbo.Webs.SiteId
– Query to get all the members of the SharePoint Groups
SELECT dbo.Groups.ID, dbo.Groups.Title, dbo.UserInfo.tp_Title, dbo.UserInfo.tp_Login
FROM dbo.GroupMembership INNER JOIN
dbo.Groups ON dbo.GroupMembership.SiteId = dbo.Groups.SiteId INNER JOIN
dbo.UserInfo ON dbo.GroupMembership.MemberId = dbo.UserInfo.tp_ID
– Query to get all the sites where a specific feature is activated
SELECT dbo.Webs.Id AS WebGuid, dbo.Webs.Title AS WebTitle, dbo.Webs.FullUrl AS WebUrl, dbo.Features.FeatureId,
dbo.Features.TimeActivated
FROM dbo.Features INNER JOIN
dbo.Webs ON dbo.Features.SiteId = dbo.Webs.SiteId AND dbo.Features.WebId = dbo.Webs.Id
WHERE (dbo.Features.FeatureId = ’00BFEA71-D1CE-42de-9C63-A44004CE0104′)
– Query to get all the users assigned to roles
SELECT dbo.Webs.Id, dbo.Webs.Title, dbo.Webs.FullUrl, dbo.Roles.RoleId, dbo.Roles.Title AS RoleTitle,
dbo.UserInfo.tp_Title, dbo.UserInfo.tp_Login
FROM dbo.RoleAssignment INNER JOIN
dbo.Roles ON dbo.RoleAssignment.SiteId = dbo.Roles.SiteId AND
dbo.RoleAssignment.RoleId = dbo.Roles.RoleId INNER JOIN
dbo.Webs ON dbo.Roles.SiteId = dbo.Webs.SiteId AND dbo.Roles.WebId = dbo.Webs.Id INNER JOIN
dbo.UserInfo ON dbo.RoleAssignment.PrincipalId = dbo.UserInfo.tp_ID
– Query to get all the SharePoint groups assigned to roles
SELECT dbo.Webs.Id, dbo.Webs.Title, dbo.Webs.FullUrl, dbo.Roles.RoleId, dbo.Roles.Title AS RoleTitle,
dbo.Groups.Title AS GroupName
FROM dbo.RoleAssignment INNER JOIN
dbo.Roles ON dbo.RoleAssignment.SiteId = dbo.Roles.SiteId AND
dbo.RoleAssignment.RoleId = dbo.Roles.RoleId INNER JOIN
dbo.Webs ON dbo.Roles.SiteId = dbo.Webs.SiteId AND dbo.Roles.WebId = dbo.Webs.Id INNER JOIN
dbo.Groups ON dbo.RoleAssignment.SiteId = dbo.Groups.SiteId AND
dbo.RoleAssignment.PrincipalId = dbo.Groups.ID

Tuesday, January 21, 2014

Visual Upgrade from SharePoint 2007 to 2010

1.    Take the Content database from Source Server
Once connected to your database server, you will need to browse to your database in the left window pane of Management Studio.
Right Click on your database, and under “Tasks” choose “Back Up…
kb-sql-backup-mgmt-studio-1
Step 2
A new window will open where we will configure where to save the database backup file.
You will want to ensure that the “Backup type” is set to “Full” to get a Full backup of your database.
Now, highlight the Destination file that is already in the list by clicking on it, and Click “Remove“.
kb-sql-backup-mgmt-studio-2
Step 3
Now, Click “Add…” to specify where to save the backup file.
kb-sql-backup-mgmt-studio-3

Step 4
A window will pop up, asking you where to save the backup file. Enter a location of your choice. For this example, we will save it to “C:\Backup\backmeup-Full-041608.bak“.
Note that this is the entire actual filepath.
kb-sql-backup-mgmt-studio-6






Step 5
Now, we have to make sure that the backup you are creating overwrites all existing backup sets, as appending it to an existing set can cause conflicts when attempting to perform a restore. On the left-hand side of the window, click on ‘Options‘, and then click on ‘Overwrite all existing backup sets‘.
kb-sql-backup-mgmt-studio-5
Step 6
Once this option is in place, all that is left to do is to run the backup! Click “OK” to begin the database backup.
kb-sql-backup-mgmt-studio-4
Step 7
If the database backed up successfully, you should receive a message as pictured below.
kb-sql-backup-mgmt-studio-7




2.    Restore Database to Target Database Server
1. Open SQL Server 2005 Management Studio.
2. Connect to the appropriate server.
3. Expand Databases.
4. Right-click the desired database, mouseover Tasks, mouseover Restore and select Database.
5. The Restore Database window will appear.
6. Ensure that the correct database name appears in the To database field. If not, select it from the dropdown.
7. Under Source for restore, select the From device radio button.
8. Click the button next to the textbox to select the device to restore from.
9. The Specify Backup window will appear.
http://blogs.tech-recipes.com/shamanstears/files/2007/02/sqlrestore.png
10. Click Add and locate and select the backup file from the Locate Backup File Window. Click OK.
11. Under Select the backup sets to restore, select all three backups (full, transaction log, and differential).
12. In the left pane, select Options.
13. Under Recovery state, ensure that the Restore with Recovery radio button is selected.
14. Click OK to begin restoring the database.
15. Once the restore is complete, a notification box will appear. Click OK to close the box. You have now restored your database to the most recent state.

3.    Use Test-SPContentdatabase to find out any issues in source server SharePoint sites
Use the Test-SPContentDatabase cmdlet to test a content database against a Web application to verify all customizations referenced within the content database are also installed in the web application. This cmdlet can be issued against a content database currently attached to the farm, or a content database that is not connected to the farm. It can be used to test content databases from SharePoint 2010 Products and from SharePoint Products and Technologies.
Ex: Test-SPContentDatabase -Name  -WebApplication  [-AssignmentCollection ] [-DatabaseCredentials ] [-ServerInstance ] [-ShowRowCounts ]

4.    Using Mount Database option to attach the content database to Target SharePoint Farm
The Mount-SPContentDatabase cmdlet attaches an existing content database to the farm. If the database being mounted requires an upgrade, this cmdlet will cause the database to be upgraded.

The default behavior of this cmdlet causes an upgrade of the schema of the database and initiates upgraded builds for all site collections within the specified content database if required. To prevent initiation of upgraded builds of site collections, use the NoB2BSiteUpgrade parameter. This cmdlet does not trigger version-to-version upgrade of any site collections.

-----------------EXAMPLE 1---------------------
Mount-SPContentDatabase “MyDatabase” -DatabaseServer "MyServer" -WebApplication http://sitename

This example mounts an existing database to the sitename web application. If upgrades are required, it triggers database schema upgrade and then performs only build-to-build upgrade actions on existing site collections if required. This operation does not changed the CompatibilityLevel for existing site collections in this database.

-----------------EXAMPLE 2---------------------
Mount-SPContentDatabase “MyDatabase” -DatabaseServer "MyServer" -WebApplication http://sitename -NoB2BSiteUpgrade
 
This example mounts an existing database to the sitename web application but it prevents any site upgrades from occurring. If upgrades are required, it triggers database schema upgrades only and no build-to-build upgrade actions are performed on any site collections. This operation does not change the CompatibilityLevel for existing site collections in this database.





5.    Using Upgrade database option to force to unlock the site collections
This cmdlet contains more than one parameter set. You may only use parameters from one parameter set, and you may not combine parameters from different parameter sets. For more information about how to use parameter sets, see Cmdlet Parameter Sets.

Use the Upgrade-SPContentDatabase cmdlet to resume a failed database upgrade or begin a build to build database upgrade against a SharePoint content database. When the Upgrade-SPContentDatabase cmdlet is run, an upgrade of an existing content database attached to the current farm is initiated. This cmdlet begins a new upgrade session, which can be used either to resume a failed version-to-version or build-to-build upgrade of a content database or to begin a build-to-build upgrade of a content database.

Upgrade-SPContentDatabase -Identity $contentdb

Details Steps as below
  • Open up the SharePoint 2010 Management Shell
  • get-spcontentdatabase
  • Copy the ID for the database that you're having problems with
  • upgrade-spcontentdatabase -id

6.    Apply New Master Pages to Migrated Site collection
To enable the look and feel choice back to enabled on every site within a site collection, use the script below. Replace SiteCollection with the actual URL for your site collection.
$SiteCollection=Get-SPsite http://SiteCollection 
foreach($SPWeb in $SiteCollection.AllWebs){$SPWeb.UIversionConfigurationEnabled=$true;$SPWeb.update();}
To enable the look and feel choice back to enabled on a single site use the following command. Replace Site with the actual URL for your site/web.

$Site=Get-SPWeb http://Site 
$Site.UIversionConfigurationEnabled=$true;$Site.update();

Monday, January 20, 2014

SharePoint 2007 to SharePoint 2010 Upgrade Content database Issue.

Error Details:
"error_pagetitle An error occurred while getting the items.  List does not exist.
The page you selected contains a list that does not exists. It may have been deleted by another user. 
ErrorPageRequestGuid {ac1563be-ad6b-41a7-b48a-e612d0a494c9}

Solution Details:
I've managed to fix this, at least on my site collection.
  1. Open up the SharePoint 2010 Management Shell
  2. get-spcontentdatabase
  3. Copy the ID for the database that you're having problems with
  4. upgrade-spcontentdatabase -id
This also fixed a problem I was having with the Site Theme gallery not loading which was another nice plus - it seems that the update hadn't completed fully and needed to be resumed.