Tuesday, September 20, 2011

SharePoint Recycle Bins - Lets get it Crystal Clear

SharePoint Recycle bin feature was newly introduced in its 2007 version, and it offers End-users, Site collection admin's to recover the content with out running behind DBA's :-)

There are some confusion among SharePoint community in understanding recycle bin settings. So in this article lets get it crystal clear.

Two Stages of Recycle bin:
Yes, SharePoint offers Two stages in recycle bins, 
  1. First-stage recycle bin - When users delete Files/List items it goes to First stage recycle bin. Also called "End user Recycle bin". Content in this recycle bin is counted on Site quota, So when you delete a file, it goes to recycle bin, But you wont get any additional free space, still it occupies site quota. This recycle bin is accessible to the end users, and its Security trimmed (Even a site collection admin can't see end user's recycle bins, He/She needs to use "Site collection Recycle bin"  to see end user's recycle bin.
  2. Second-stage recycle bin - When the content deleted from First-stage recycle bin, its moved to Second stage recycle bin. Here Items not counted on Site quota, But total space occupied by second stage recycle bin is based on Central administration setting "Second stage Recycle bin Percentage in Live site's Quota". This Recycle bin acts at site collection level, and can be accessed only to site collection admins.
Ok.. Lets explore the Recycle Bin Settings: There are two: Days & Percentage

Deleted Items in Recycle in - Days:
sharepoint recycle bin days

This setting applicable to: Total Life Time of a file in First Stage & Second stage recycle bins. (Not 30 days in First stage and another 30 days in Second Stage!!! But just 30 days altogether). Lets say you set 30 days for this setting. When you delete a file for first time, it goes to first stage recycle bin, stays there for 30 days, then deleted permanently!

Another example: Lets say you deleted a file, It stays in First stage recycle bin. After 15 days you delete that file from First stage recycle bin. Now, from First stage recycle bin, it goes to second stage recycle bin, stays there for 15 more days, then deleted permanently.

So here, The deleted file's Total Life time is: 30 days. (Not 30 + 30 = 60 days)

Second Stage Recycle bin's % allocation setting:
sharepoint 2010 recycle bin quota

This setting applicable only to second stage recycle bin.

Where to Setup these settings:
To setup the Recycle bin settings, we go to: Central Administration >> Application Management >> Manage web applications >> select the desired web application >> General settings
sharepoint recycle bin settings 2010

Want to bypass SharePoint recycle bin ? (Permanently Delete without sending to recycle bin)?
If you want to Turn off second stage recycle bin you can choose "OFF" button there.. If you want to Turn off the recycle bin option altogether, that's also can be done in this page.

SharePoint recycle bin quota:
Lets do some practical. Lets create a site with 100 MB and lets test these scenarios with two 50 MB files, say File-1 and File-2. Let the settings be 50% for second stage recycle bin. When we allocate 100 MB to the site quota, additional 50 MB will be allotted to our site for Second-Stage Recycle bin as per our Central admin setting (50% for second stage recycle bin!)

Lets upload those two 50 MB files File-1 and File-2, then delete those two files from document library. Again when you try to upload a file, You will get Error message saying site quota is FULL! because those two files you deleted - still in first stage recycle bin and part of site quota.

So now in our First stage recycle bin, There are 2 files, 100 MB of 50+50 MB. Lets delete those files one by one... When we delete the first file from First-stage recycle bin, it goes to Second-stage recycle bin, again when we delete the File-2 from First-stage recycle bin, SharePoint permanently deletes the First deleted file: File-1 from Second-stage recycle bin, and puts the File-2 there.

End-User Recycle Bin vs Site collection Administrator's Recycle Bin:
Even though you are the site administrator, when you access the recycle bin from "Quick Links" section, What you get to see is: End-user recycle bin, which is security trimmed (meaning, You will not see items deleted by other users!).

SharePoint Recycle Bin Permissions
You must have site collection Administrator access rights to get Admin Recycle bin. To view All the items in End-User recycle bins (Items deleted by all end-users), Go to site settings page >> Recycle bin under Site Collection Administration where you will get the End user Recycle Bin items (Which is actually Administrator's recycle bin with all deleted items of all users. It is the First stage recycle bin) and "Deleted from end user Recycle Bin" (which is nothing but 2nd Stage recycle bin).

URL Shortcuts for accessing Recycle bin:
After the SharePoint Site URL (say: http://company.sharepoint.com/) append:
  • /_layouts/recyclebin.aspx  - For End User Recycle Bin
  • /_layouts/AdminRecycleBin.aspx - For Site collection Administrator Recycle bin.
My Related Posts on SharePoint recycle bin:

TechNet: http://technet.microsoft.com/en-us/library/cc263011.aspx

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Monday, September 19, 2011

Migrate from MOSS 2007 to SharePoint 2010 - Step by Step

In this article, I'm walking through Migrating from MOSS 2007 to SharePoint 2010 using database attachment method. 

  1. Run Preupgradecheck in MOSS 2007 server.
    1.  Analyze & Fix the issues.
  2. Take the back up of content database from MOSS 2007.
  3. Restore the content databases backup to SQL Server of SharePoint 2010.
  4. Create web application in SharePoint 2010.
  5. Attach the MOSS 2007 content databases to SharePoint 2010.
  6. Post Migration fixes

1. Run preupgradecheck in MOSS 2007 Server

This will be our primary analysis and reporting tool providing us with invaluable information regarding your SharePoint 2007 farm and actions that may be required to be taken prior to upgrading to SharePoint 2010. It is better to have October CU: http://support.microsoft.com/kb/976730/ where the preupgradecheck is enhanced further. 

Run the preupgradecheck as below in command prompt:

stsadm.exe -o preupgradecheck

stsadm.exe -o preupgradecheck Report
Once you get "Operation completed successfully", it will launch the “SharePoint Products and Technologies Pre-Upgrade Check Report”.  It can also be located under the following location;
%COMMONPROGRAMFILES%\Microsoft Shared\Web Server Extensions\12\Logs\

1(a).   Analyze the report and Fix the following settings:

2. Take the Content Database Backup from MOSS 2007

Set the database to read-only before taking backups.
Set the database as read only:
  1. On the MOSS 2007’s database server, click Start, point to All Programs, Microsoft SQL Server, and then click SQL Server Management Studio.Take the Content Database Backup from MOSS 2007

SQL Server 2005 Management Studio Splash Screen

  1. Traverse to Databases node by expanding the tree.
  2. Right-click the name of the database that you want to set to read-only, and then click Properties.
4.    In the Properties dialog box, click the Options tab.
      5.   Under State, select the Database Read-only to True, and then click OK
Set SharePoint Content Database to Read-Only

Backup the database:
Follow these steps to take back-up:
  1. Traverse to Databases node by expanding the tree.
  2. Right-click the database you want to back up, point to Tasks, and then click Backup DatabaseBackup SharePoint Content Database from SQL Server
 3. In the SQL Server Backup dialog box, specify a name for the backup, select Back-up type - Full, select a destination, and then Click OK to start the backup process.
Backup SharePoint Content Database from SQL Server

 4. Repeat these steps to back up the databases that are used by MOSS 2007 in the environment.

3. Restore the back up on SharePoint 2010’s SQL Server:

  1. Open the SQL Server Management studio, traverse to “Databases” node. Then right click the “Databases” node and choose “Restore Database…” from the context menu. Restore SharePoint 2007 Content Database to SharePoint 2010
  1. Specify the Database name, Restore Source, Destination, File names in the screens.
Restore MOSS 2007 Content Database to SharePoint 2010
3. Click “OK” to start the restore operation and Wait for the restore to complete! The time of restoring database depends upon the database size and server’s capacity.

4. Create web application in SharePoint 2010

  1. In the SharePoint Central Administration, click on “Application Management” and click on “Create or extend Web application” under “SharePoint Web Application Management”.
  2. Again click on “Create Web application”. Set the settings according to the needs say http://SharePoint2010.company.com
  3. Don’t create any site collection.
  4. Install & Copy the solutions, file system changes (like images, themes) from MOSS 2007 to MOSS 2007 servers.

Remove content database of the newly created web application in SharePoint 2010

Now, we need to delete the content db of the newly created web application in order to avoid any URL conflicts. Run the below stsadm command:

stsadm -o deletecontentdb -url http://SharePoint.company.com -databasename <MOSS2007_Migration_Content>

Remove SharePoint Content Database: stsadm -o deletecontentdb

5. Attach restored database with the newly created web application in SharePoint 2010

Test the content database
Before attaching the content databases to the Web applications, use the Test-SPContentDatabase PowerShell cmdlet to verify that all of the custom components that you need for that database. It checks for all artifacts such as feature, setup files, web parts,etc that are referred in the content database are installed in the farm and provide you with an report.

Test-SPContentDatabase -Name <DatabaseName> -WebApplication <URL>

Delete the corrupted objects

stsadm -o databaserepair -url  <URL of SharePoint site>  -databasename <name of database> -deletecorruption

Finally, we need to attach the restored MOSS 2007 database to MOSS 2007 by running the STSADM
  1. The Content DB containing the root site collection is always applied first.
  2. The other content DBs can be applied in any order.
Attach the Content DB of the Root Site collection First. And then Attach the Content DBs of other Site Collections.

stsadm.exe -o addcontentdb -url http://SharePoint.company.com -databasename <MOSS2007_Portal_Content>

Attach Content Database to SharePoint

 Or you can use the PowerShell cmd-let: Mount-SPContentDatabase
Mount-SPContentDatabase -Name <DatabaseName> -DatabaseServer <ServerName> -WebApplication <URL> 

Post Migration fixes

Once the content database attachment process is over, we have to manually fix the below things:

Unit Test:

Browse the migrated sites in SharePoint 2010 and check their look& feel and functionality.
SharePoint 2010 look and feel
Before and After:
MOSS 2007 to SharePoint 2010 - Before and After Screen


You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Sunday, September 18, 2011

Migrating SharePoint 2007 Site/List Templates(.stp) into SharePoint 2010

Unfortunately, SharePoint 2007 site templates(.stp) can't be used as in SharePoint 2010. Hmm... Then what to do with the custom SharePoint 2007 Site templates? Can't I use them in SharePoint 2010? well, You can,  Here is the work around to Migrating MOSS 2007 Site, List Templates(.stp) to SharePoint 2010:
  1. Create a site in SharePoint 2007 using the custom .stp template.
  2. Migrate that site to SharePoint 2010 by either In-Place or Database attach method (backup the database for that site from SQL Server for SharePoint 2007 and restore it on SharePoint 2010's SQL Server, then atach the DB(stsadm -o addcontentdb) to SharePoint 2010)
  3. After you do that just Open up the site and fix any issues (like file system references).
  4. Once upgraded to SharePoint 2010, follow these steps:
  5.   Click on Site Actions >> Site Settings.
  •   On the Site Settings page click "Save site as Template", then enter a file name and Template name and click OK.
  •    Now, The site template is saved as a WSP file to the Solutions Gallery for that site collection. This solution can then be re-used as a Site Template.
Migrating MOSS 2007 Site,List Templates(.stp) to SharePoint 2010
Open the .wsp solution in Visual studio 2010, change the Scope to “Farm” and re-deploy, if you want this site template to be available at the farm level.

Important: When saving site as a template enable "Include Content" check box! otherwise you may end up in Error: Exception from HRESULT: 0x81070905" when creating sites from the particular template.

Migrating List Templates from MOSS 2007 to SharePoint 2010
Likewise, List templates created in MOSS 2007 can't be used in SharePoint 2010. You will get this error when you try to create a list based on MOSS 2007's List template:

 Error: Microsoft SharePoint Foundation version 3 templates are not supported in this version of the product!
Migrating List Templates from MOSS 2007 to SharePoint 2010

Fortunately, There is a work around. We can use the same method as above. Or if its just a list template, we can use the below trick:
  1. Download the .STP file from the site, and Rename .STP to .CAB
  2. Extract the manifest.xml
  3. In "ProductVersion" element, Change its value to from "3" to "4"
  4. Repackage the manifest.xml into a .CAB. makecab.exe c:\manifest.xml c:\template.cab
  5. Rename the .cab file from .CAB to .STP and upload it into the List templates (_catalogs/lt)
Here is a scripted way: http://www.heyweb.net/2011/06/converting-sharepoint-2007-document-library-templates-for-sharepoint-2010/

    You might also like:
    SharePoint Usage Reports
    Usage reports, collaboration and audit for SharePoint.
    Document SharePoint Farm
    Automatically generate SharePoint documentation.

    Wednesday, September 14, 2011

    IIS URL Rewrite Module with SharePoint

    Want to get rid of "/Pages/" from SharePoint URL? Want to redirect from "http" to "Https" ? want to redirect from one SharePoint site to another? then your search ends here. Use IIS URL Rewrite Module, Just a free add-on to IIS.
    IIS URL Rewrite Module with SharePoint
    Here are the posts on using IIS Rewrite module with SharePoint:


    You might also like:
    SharePoint Usage Reports
    Usage reports, collaboration and audit for SharePoint.
    Document SharePoint Farm
    Automatically generate SharePoint documentation.

    TFS Basics Tutor for End User

    Team Foundation Server is a source control, data collection, reporting, project tracking, and is intended for collaborative software development projects. This guide briefs on the basics about using TFS.

    Table of Contents
    Team Foundation Server – Introduction
    1.0    Pre-Requisites
    2.0    Setting up Team Foundation Server for the first time
    3.0    Adding New Files to TFS
    4.0    Committing changes to the TFS Server
    5.0    Get the Latest files from TFS
    6.0    Editing/updating files in TFS
    7.0    Deleting Files to TFS
    8.0    Going back to a Prior version

    1.0    Pre-Requisites:
    1.       Visual Studio 2010/2008/2005 with SP1.
    2.       TFS for Visual studio:
    3.       Forward compatibility plug-in for (Note that you need Service Pack 1 installed for Visual Studio for forward compatibility plug-ins to work):
    You can access the TFS web as well 

    2.0    Setting up Team Foundation Server for the first time:

             Open the visual studio

     Go to View à Team Explorer (Ctrl + M) Shortcut

     Click on “Add Existing Project “ Icon as in the below screen 
    Click on “Servers” Button
     In Servers dialog box, Enter the details:

    Server Name:    http://TFS-Server-Address.org
    Path:                     tfs
    Port Number:    8080
    Protocol:             HTTP
    Then select  the project name, for e.g. “SharePoint” from the project list and click on “Ok” button
     Once you have team explorer connected, we need to create a “Work-space” to establish a connection between the TFS server and our local machine
     Creating Work Space: Double Click on “Source Control” and then “Workspaces”
        Click on “Add” button
    Click on the “…” Button on the “Source Control Folder” column
    Select the “SharePoint” Project  in the list and click “OK” button
    and then under the Local folder, Select the local folder from your machine, where the TFS artifacts will be stored
    Now, Click on “Ok” button to save the changes.

    3.0    Adding New Files to TFS

    To add files to TFS, place the files in Local Workspace folder and add them through TFS. Here is an example:  Add a File Named “MOSS 2007 to SharePoint 2010 Migration IG.docx” in D:\TFS-SharePoint\Administration\Implementation Guides”
    Open the TFS, and Click on “Add Item” icon as highlighted in the below picture
    Pick the file/folder from your Local “Workspace” folder, and click on “OK” button to add.
    Once added, you will get a small + Icon to the file name, which denotes this change needs to be committed with the TFS Server.

    4.0    Committing changes to the TFS Server:

    Once we add Files/folders to TFS, It just added to our local work-space. We need to commit our change to the TFS server in order to persist the change to reflect on the server.
    Committing the change to the server:
    Right click on the Project folder or any other folder which consists of the change, select “Check-in Pending changes” from the Menu to commit the changes to the TFS Server.
    This will open a window, which has all the new changes from the Local workspace

    5.0    Get the Latest files from TFS

    Under the Source control explorer, Right click on the Project Name “SharePoint” (or whatsoever) and select “Get Latest Version”

    This will retrieve the latest files from the TFS to the Local workspace folder.

    6.0    Editing/updating files in TFS

    Files inside TFS workspace folders are READ-ONLY!!! So in order to edit the files, they need to be checked-Out First. To Check out files, Open the source control, Navigate the folder where the desired files are stored, right click on the File/Folder, click on “Check-Out for Edit”

    Select the Lock type, typically it would be “Unchanged”
    Now, you can edit the files either directly from TFS or from your local workspace folder.
    Once done with editing, check it in back by right clicking and choosing “Check in Pending changes”
    Enter the optional comments,  and click on “Check-In” Button.

    7.0    Deleting Files to TFS

    To delete the files from TFS, Open the source control, Navigate to the Target folder and delete the file/folder.  Right click and choose “Delete” item from the Menu.
    Once delete, commit the changes by “checking in the pending changes”

    8.0    Going back to a Prior version

    In TFS each check-in creates a new version. To get the particular version, Select the folder/file and choose “Version” menu item
    This will give a list of versions, from which we can view/copy the files of prior versions.
    To get a Prior version:
    Right click on the desired folder and choose “Get Specific Version” 
    You can restore a specific version based on Change Set value, Date, comments, etc

    You might also like:
    SharePoint Usage Reports
    Usage reports, collaboration and audit for SharePoint.
    Document SharePoint Farm
    Automatically generate SharePoint documentation.

    You might also like:

    Related Posts Plugin for WordPress, Blogger...