Tuesday, February 12, 2013

Class not registered exception - SharePoint 2013

Hi All,

We got below error when trying to use SPSecurity.RunWithElevatedPrivileges in console application

Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).












The code is shown below:

using Microsoft.SharePoint;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SampleComnsoleApp
{
    class Program
    {
        
        static void Main(string[] args)
        {
            bool quiet = false;
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                (new Program()).Run(quiet);
            });
        }
        private void Run(bool quiet)
        {

        }
    }
}

Resolution:

The console application is running under 32 bit processor. Just change it to 64 bit.
To do this:

  • Right click on Console Application
  • Select Properties 
  • Under Build Tab, change Platform Target to x64
  • Rerun the application and hopefully the error should go away now !

Sunday, February 10, 2013

Step by Step Procedure to Migrate sites from MOSS 2007 to SharePoint 2013

Hi,

To migrate sites from MOSS 2007 to SharePoint 2013, we need to first perform two tasks.

a. Migration from MOSS 2007 to SharePoint 2010
b. Migration from SharePoint 2010 to SharePoint 2013

Please follow the above links to perform migration and let me know in case of any issues.

Thanks !

Step by Step Procedure to Migrate sites from SharePoint 2010 to SharePoint 2013

Hi Again,

In this post, I will show how to migrate sites from SharePoint 2010 to SharePoint 2013.

Steps for Migrating SharePoint 2010 site to SharePoint 2013

1. Take backup of SharePoint 2010 Content database
2. Restore the SharePoint 2010 Content database in SQL Server 2012
 























3. Create a claims based web application. I want to use windows authentication. So I have selected “Enable Windows Authentication” checkbox while creating new web application.
















4. Note that classic authentication mode is removed by default in create web application page. You can create classic web application using PowerShell only.

5. We see that web application is created in Central Administration page










6. Open “SharePoint 2013 Management Shell” as Administrator
7. Detach the content database for the newly created web application using the below PowerShell command
    Dismount-SPContentDatabase -Identity "WSS_Content_SharePoint2013DB_4444"













8. Attach the Restored SP2010 Content database to the newly created SP2013 Web Application using PowerShell command

Mount-SPContentDatabase -Name WSS_Content_SharePoint2010ContentDatabase -DatabaseServer SHAREPOINT2013\SHAREPOINT -WebApplication http://sharepoint2013:4444/
















9. Depending on your project requirements, you may need to perform additional tasks
  • Update Web.config with
    • Connection strings to database (In case custom database is used)
    • Safe controls for Dll’s
  • Update Visual Studio code to VS 2010 (Applicable if 14 hive was used by your code. This needs to updated to 15 hive)
  • Update master page and page layouts to use dll’s of version 15.0.0.0. Note that we still have 14.0.0.0 version for Master page and Page layouts even after migration   
10. Browse the SharePoint 2013 site now and I got an access denied error as shown below












11. This is because the content database has got primary and secondary administrators of SharePoint 2010 site. This is not valid in my case since SharePoint 2013 is on another domain as shown below















12. Hence, I need to change the primary and secondary administrators to valid users as shown below and click OK to save changes

13. Welcome to your SharePoint 2013 Site! :)















14. Note that we are still in SharePoint 2010 UI. We also got a message to experience SharePoint 15 features. Click Start now

15. We get an “Upgrade Site Collection” page. Click “Upgrade this site collection”
















16. We get a popup. Click “I am ready”. Note that in SharePoint 2010 Visual upgrade, even though the site has been updated to SharePoint 2010 UI, we can still revert back to SharePoint 2007 UI using PowerShell. This is not the case with SharePoint 2013. Once the site is converted to SharePoint 2013, this cannot be reverted back to SharePoint 2010. 















17. You can see the upgrade status in Site Upgrade Status page 
       (http://<SiteUrl>/_layouts/15/siteupgradestatus.aspx)
       
      Upgrade Screen 1















       Upgrade Screen 2















18. Once, the upgrade is completed, we get a Upgrade Successful message













19. And, finally, here is our SharePoint 2013 site! :)















20. Everything got migrated properly without any issues. Kudos to the Microsoft SharePoint team for doing such an excellent job. Cheers!

Step by Step Procedure to Migrate sites from MOSS 2007 to SharePoint 2010 -


Hi All,

In this post, I will first explain how to migrate sites from MOSS 2007 to SharePoint 2010. 

Steps for Migrating MOSS 2007 site to SharePoint 2010

1.    We will migrate a simple site in MOSS 2007 to SharePoint 2010. Here is the screenshot of the site in MOSS 2007
         


2.      Set the content database for this site to READ ONLY before taking backup. 
       To do this, open SSMS and select the content database


















3.       Right click on database and select properties
4.       Under Options tab, set the database state to be READ ONLY as shown below
       

















5.    Once this is done, click OK to save changes. The database will be grayed out indicating that it is in READ ONLY mode





















6.       Now, backup the database


















7.    Once the backup is done, restore this backup on SQL Server that is connected to SharePoint 2010 Farm. I have SQL Server 2008 R2 that is connected to SP 2010 farm.
8.    To restore the MOSS 2007 content database to SQL Server 2008 R2, open your SQL Server 2008 R2 in SSMS
9.      Right click on Databases and select Restore database
10.   Select “From Device” option under “Source for restore”. Then Select the backup file




















11.   Provide the name of database under “Destination for restore” => “To database”. FYI, I restored my MOSS 2007 content database to SQL Server 2008 R2 as “WSS_Content_MOSS2007ContentDatabase”

12.   Now, go to central administration page for SharePoint 2010 and create a new web application. Do not create any site collections for this web application as we will delete content database for this web application. The name of content database for this web application is “WSS_Content_TempWebApp_4444”.












13.  Delete the content database for newly created web application (http://saiabhilash:4444/) using PowerShell command
      
      Dismount-SPContentDatabase -Identity "WSS_Content_TempWebApp_4444"

14.  Now, attach the MOSS 2007 content database to this web application using PowerShell command

Mount-SPContentDatabase -Name WSS_Content_MOSS2007ContentDatabase -DatabaseServer SAIABHILASH\SHAREPOINT -WebApplication http://saiabhilash:4444/

15.  Once this done, verify that the MOSS 2007 content database is successfully attached to SharePoint 2010 web application (Manage Content databases page in Central Administration)










16.  Depending on your project requirements, you may need to perform additional tasks
a.       Update Web.config with
                                                   i.      Connection strings to database (In case custom database is used)
                                                 ii.      Safe controls for Dll’s
b.      Update Visual Studio code to VS 2010 (Applicable if 12 hive was used by your code. This needs to updated to 14 hive)
c.       Update master page and page layouts to use dll’s of version 14.0.0.0. Note that we still have 12.0.0.0 version for Master page and Page layouts even after migration

17. This is it. Once this is done, we see the migrated site in SharePoint 2010 as shown below J













18.  We still see that UI is still in 2007 format. Use Visual Upgrade to see the updated UI (Site Actions รจ Visual Upgrade)














19.   Select “Update the user interface” tab and click OK to see SharePoint 2010 UI.


























20.   Welcome to SharePoint 2010! J














In next post, i will show you how to migrate sites from SharePoint 2010 to SharePoint 2013. Cheers !