About Me

SharePoint Architect with over 17 years of IT Experience in various roles as SharePoint Architect, Administrator, Technical Architect, IT Analyst, Application Developer, CRM Consultant, BI Developer, Microsoft Solution Architect in Client/Server, Web and Enterprise CRM Applications in E-Commerce, Financial, Healthcare, Insurance, Telecom, Outsourcing and Technology Services.
MCITP (Pro): Microsoft Certified IT Professional: SharePoint 2010 Administrator.
MCTS: Microsoft Certified Technology Specialist, SharePoint 2010 Configuration.

Thursday, January 22, 2015

Increase column widths of a SharePoint list


If you want to increase width of column widths for a SharePoint list, add a Content Editor WebPart to the list view and add following css code to the inner Html.

<style type="text/css">
.ms-vh-div[DisplayName='Title']
{
  width:200px;
}
.ms-vh-div[DisplayName='Description']
{
  width:300px;
}
.ms-vh-div[DisplayName='Category']
{
  width:100px;
}
.ms-vh-div[DisplayName='Priority']
{
  width:60px;
}

</style>

Tuesday, November 4, 2014

Implications in enabling RBS in SharePoint 2013 with Document Shredding enabled.


If you are considering enabling RBS in SharePoint 2013 and additionally if you are having scheduled SQL Backup or any other DR System in place then you should understand the implications of the effect of Document Shredding with RBS. Please read and understand how document shredding works outlined by Chris Mullendore [MSFT] in his article (link provided below).  

Document Shredding in SharePoint 2013 directly conflicts with the understanding RBS in SharePoint 2010. In simple words to conclude, RBS will not work same as how it worked in SharePoint 2010. Is because of the file chunk treatment implementation in Document Shredding. In a typical configuration scenarios, it may happen so that the chunks of content that belongs to same version of one Document, could be saved in a hybrid Storage structure, meaning, chunks of file content may be stored in parts in File System and in Content Database. Additionally, the document type if it is a ‘Office Document’ or ‘Non-Office document’, will also play a role on defining size of chunks which in-turn affect RBS Storage depending on how the RBS threshold value is set in the configuration.
It is even more complicated, if a DR System is in place with RBS enabled, in the situations if you have to restore Content Databases from SQL Backups, and if File System Data in RBS is not in sync with the timestamp of the SQL Backup, then the documents and it’s versions restored content may lose their integrity and finally corrupting the critical business data.  

*Please have a thorough understanding of the effect of ‘Document Shredding’ on ‘RBS’ in SharePoint 2013 or discuss with a professional before you enable RBS in your SharePoint 2013 environment. 

Based on Article: Shredded Storage vs. RBS by Chris Mullendore [MSFT]
http://blogs.msdn.com/b/mossbiz/archive/2013/09/13/shredded-storage-vs-rbs.aspx

PowerShell Script to list Worker Processors and their Application Pool Names with Memory consumption and CPU utilization.


Using the following Power Shell Script you will be able to enumerate worker processors and associated Application Pool Names with details of Memory consumption and CPU Utilization, that will help during investigation and troubleshooting when System Resources are in critical condition. 


The PS Script will list PID (Processor ID), VM (Virtual Memory), PM (Physical Memory), WS (Working Set), CPU utilization, with ‘Application Pool Name’.

$list = get-process w3wp
$lineitems = @()
   foreach($p in $list)
   {
                $linestr = New-Object PSObject
                $filter = "Handle='" + $p.Id + "'"
                $wmip = get-WmiObject Win32_Process -filter $filter
                $cmdline = $wmip.CommandLine
               
                [regex]$pattern="-ap ""(.+)"""
                $PoolNameStr = $pattern.Match($cmdline).Groups[1].Value
                $PoolName = $PoolNameStr.substring(0, $PoolNameStr.IndexOf(""""))

                $linestr | add-member NoteProperty Id  $p.Id
                $linestr | add-member NoteProperty VM $p.VM
                $linestr | add-member NoteProperty PM  $p.PM
                $linestr | add-member NoteProperty WS  $p.WS
                $linestr | add-member NoteProperty CPU  $p.CPU
                $linestr |  add-member NoteProperty "AppPoolName" $PoolName
                $lineitems += $linestr
   }
$lineitems | Format-Table * -AutoSize

Format-Table


Out-GridView

You can also use Grid View parameter which displays data in Grid View.




Getting Content breadcrumb navigation path in SharePoint 2010 as seen in SharePoint 2007

Content breadcrumb navigation (Textual Current Navigation Path)

Here is a workaround with minimal coding effort to show Current Navigation Path in SharePoint 2010 Master page. This is one of the features in SharePoint 2007 suppose to be very a useful visual element that is missing in SharePoint 2010 during migration from SharePoint 2007.

In SharePoint 2007
In SharePoint 2010

In SharePoint 2010, the out-of-the box shows navigation path but it gets trimmed if the path is too long.


Here is a simplest workaround to get the full textual path. Try adding following few lines of code in the v4 Master page (at approximately after line 648). You can use SharePoint Designer 2010 to make a copy of the v4 master page and apply it as master page from the Site Settings.

<td valign="top" class="ms-titlearea">
        <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
<asp:SiteMapPath SiteMapProvider="SPContentMapProvider" id="ContentMap" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/> &nbsp;
          </asp:ContentPlaceHolder>
</td>
This will bring the following Navigation Path in SharePoint 2010 master page as below. There is no limitation on the length of the path and hierarchy is shown in full.


Review on SharePoint 2013 Site Collection deletion and restore options and recovering had-disk space from a deleted site.

In this post I want to review PowerShell Commands available for managing Site Collections to do operations like delete, restore-deleted and remove-deleted, viz., Remove-SPSite, Restore-SPDeletedSite, Remove-SPDeletedSite. I will also be reviewing differences in deleting Site Collection from Central Admin feature against using PowerShell commands with and without using -gradualdelete option.



Deleting Site Collection from Central Admin:




The Site Collection deletion action from central admin will not permanently delete the Site Collection but it will only be marked as deleted in the Site map table in the Configuration Database.


The Central admin deletion of Site Collection is same as deleting site using PowerShell Command with gradualdelete option.
Example:


If you run the following SQL Query against configuration database you will find the delete transaction id for the deleted site. (Please note that, since is a lab exercise I took liberty to execute query against a SharePoint Database. Querying SharePoint database is not supported by Microsoft)






This deleted Site Collection will only get deleted permanently only when the Timer Job for ‘Gradual Site Delete’ for that specific Web Application is ran as per schedule.



Before the timer-job is ran, the deleted site collection, can be found in the deleted Sites Collections list using the command Get-SPSiteDeleted.





If deleted site still exist in the deleted site list, then it can be restored successfully using Restore-SPDeletedSite





After restore, the Site Collection can be seen back at the same place where it was before deletion.





Remove-SPDeletedSite

Let’s redo the deletion as a -gradualdelete and then perform removing site permanently from the SharePoint Farm (from Site Map).




Verify in Site Map Table in Config Database.

No record of the site


Using 'Remove-SPSite' without using option 'gradualdelete'. (Deleting the Site Permanently).


If site is deleted using PowerShell with Remove-SPSite without gradualdelete option, then the site gets deleted permanently from the farm configuration - it can not be restored.


Remove-SPSite –Identity "http://test.sp2013.corp/Sites/SiteABC"



“Gradual Site Delete” Timer-Job


However the site may have got deleted permanently from the SharePoint Farm, and confirmed as per information in “Site Map” table, and even it can not be restored further, the Content Database only get back the deleted site space only after the ‘Gradual Site Delete’ timer-job is ran.

Issues in cloning a SharePoint 2013 Content Database and Mounting to the same SharePoint Farm.


Following are some scenarios where you may have to clone the Content Databases because of the Site Collections being so large that you can not use Site Collection backups as they are unsupported for Site Collection sizes over 100GB. 

So, I did a few lab exercises assuming different situations, by cloning Root and Additional Content Databases and mounting them using -AssignNewDatabaseId option to determine best possible options available without breaking the site functionality and not affecting 'site mapping' configurations.



I am referring the Content Database with 'top-level' site collection as a 'root Content Database', the rest of content databases existing in Web Application as 'Additional Content Database'

Following are situations in this blog post discussion:  
  • You may have large Site Collection (>200GB) existing in Root Content Database that you want to move to its own content database.
  • You may have a large Site Collections in a non-root content database co-existing one or more Site Collections that you want this site to be moved to its own Content Database.



  • You may have a large site collection over 200 GB existing in a Web Application (A) that you want to move it to another Web Application (B)


  • You may have a Web Application (A) with a root Content Database having a large Site Collection that you can not take backup of it by any method, and you have a requirement to decommission this Web Application (A) and migrate existing Site Collections to another new or existing Web Application (B).



  • You may have a requirement to move numerous Site Collections that it is difficult to take backup of them by any available methods, to a separate Content Database. So, as a workaround, it may be easy to duplicate Content Database and delete unwanted site collections in either Content Database. Or it may be that, you may have to migrate numerous site collections from one Content Database to other Content Database, that you may think it is easier to clone Content database and mount it with AssignNewDatabaseId rather than working with stsadm/PowerShell Site Backup and restore operations.

Content Databases:
As we knew that every SharePoint Content Database has a Unique Id and the Content Database ID will be saved in "Database Information Table" in Content Database. Also, when a New Site Collection is created in any of the Web Application, or an existing Content Database is mounted to the SharePoint Farm, the 'Objects' table in Configuration Database gets updated with the 'Database ID' and 'Site Map' table gets updated with the 'Site Collection' details with URL mappings, Web Application and Content Database details.
As a default SharePoint Architecture,
  • A cloned copy of an existing Content Database can not be attached to the Same Farm. SharePoint returns error saying that another Database is already existing with same Database Id. But, Mount-SPContentDatabase allows you attach a cloned database with –AssignNewDatabaseId option. But unfortunately, any site collections existing in the Content Database have the same 'Site Id', then they become orphaned and will not showup in the Central Admin's Site Collections list. Also, upon mounting the 'Site Map' table will not get updated with the Site Collections information having conflict with existing Site Ids.

  • An existing Site Collection cannot backedup and restore with different name to the Same Web Application. SharePoint returns error saying another Site Collection exists with Same 'Site Id'. But, you may allowed to restore the backup in a different Web Application with same or different name.

Following is a workarounds to overcome issues with 'Site Id' Conflicts if you are trying to duplicate a content database and you want to keep one unique Site Collection in each Content Database and avoid conflicts with 'Site Ids', using –AssignNewDatabaseId.
  • First make a duplicate of the Content Database.
  • After verifying the backup copy, delete the site collections existing in the Original Content Database.
  • Detach the Original Database.
  • Mount Cloned copy of Original Content Database using Mount-SPContentDatabase with –AssignNewDatabaseId option. This will allow the New Database be be attached to the farm without a conflict of Database Id.
  • Delete the Site Collections those you want to keep in Original Content Database and don't want them in the Second Cloned Copy of Content Database.

    (Optional Scenario-1)
  • If this Cloned Content Database is likely to be attached as additional Content Database to the same Web Application, then delete the Top-Level Site Collection.

    (Optional Scenario-2)
  • If this Content Database was a root Content Database and if you are trying to attach to another Web Application, then Delete Top-Level Site Collection and Re-create as New.

  • After making sure you have unique Site Collections in both Content Databases, Attach Original Content Database.
To Conclude, AssignNewDatabaseId will only sets a New Database ID to the Content Database, but it will not set new 'Site Id's for existing site collections. So, you will have to work with several additional steps to not to make site Collections orphaned. Please also make a note that the workarounds may or may not not work in all scenarios and they may not be fully supported by Microsoft.
Note: Please do not duplicate/Clone (Backup Database and restore with different name) and attach to the farm using -AssignNewDatabaseId parameter without having a thorough understanding of the SharePoint Architecture at Site Mapping functionality and Configuration Database level. Workarounds explained above are for specific scenarios are validated against out-of-the box Site Collections having no customization. So, the workarounds may not be applied in your case and may leave your sites as orphans and also may cause an unrecoverable damage. Please consult an experienced professional for best guidance in your case.

Questions on restoring a SharePoint 2013 Top-Level Site Collection with a backup of another Site Collection.

Following are a few General questions with regard to Top-level Site Collection,
  1. Can a Top-Level Site Collection be recreated having Site Collections in Managed path?
  2. Can a Top-Level Site Collection be restored with a backup of the Site Collection in managed path?
  3. Can a Top-Level Site Collection backup be restored as a New Site Collection in Managed Path?
So, in order to get clarification on above questions I did a lab exercise in SharePoint 2013 and following are my findings.

  1. Can a Top-Level Site Collection be recreated?
In situations if we have deleted a Top-Level Site Collection accidentally or it could be that, the Top-Level Site Collection was initially recreated with incorrect Site Template then we wanted to recreate with a correct site template.
So, I did an exercise in lab in SharePoint 2013 with a Top-Level Site Collection with another site collections existing in the Managed Path. Interestingly, the Top-Level Site was able to be recreated and both Top-Level Site and Site Collection in managed path were accessible and functional.
  1. Can a Top-Level Site Collection be restored with a backup from Site Collection existing in managed path?
Unfortunately, No. The backup of a Site Collection in managed path was not able restore the To-Level Site Collection. (If if it was deleted and the location is empty)
But, PowerShell Export and Import was able to restore a Top-Level Site Collection.
Export-SPWeb -Identity http://publishportal.sp2013.corp/sites/PubSiteA -Path 
C:\ PubSiteAExport\PubSite.cmp -IncludeUserSecurity -IncludeVersions All -NoFileCompression -Verbose

Import-SPWeb http://publishportal.sp2013.corp –Path C:\PubSiteAExport\PubSite.cmp
–UpdateVersions -IncludeVersions -NoFileCompression Overwrite

Note: Please remember to use Export-SPWeb with IncludeVersions if you have exported Site with IncludeVersions. Use of –IncludeVersions parameter exports .dat files to a Folder name as defined in the path. The export will not actually create a file called export.cmp file but instead it creates a folder as ‘/export.cmp/’ and saves backup files there. The Export-SPWeb export backup to the file export.cmp only when the parameter –IncludeVersions is not used.

  1. Can a Top-Level Site Collection backup be restored as a New Site Collection in Managed Path?
Unfortunately, No, You can not restore to the same Content Database where you have existing Top-Level Site Collection.

Alternatively, you can restore the backup of a Top-Level Site Collection to another (Non-Root) Content Database. If you don’t have then add a new Content Database to the Web Application.*These exercises are conducted on sites having no customizations.