CONFIGURING MULTITENANCY HOSTING IN SHAREPOINT 2010 AND SHAREPOINT 2013

If we consider a hosted environment like SharePoint Online it offers customers 2 mode of hosting
1. Standard: This is a shared infrastructure where multiple customers will be hosting their web applications/site collections (what we call as multi-tenant mode)
2. Dedicated: This is a separate infrastructure of the customer
Multitenancy is the ability to host unique deployments for multiple tenants on the same SharePoint server farm by isolating the data, operational services, and management of a tenant from other tenants using the same farm.
To achieve Multitenancy–based architectures requires a combination of
the following key capabilities:
➤ Site subscriptions
➤ Service application partitioning
➤ Tenant administration
➤ Feature packs

Create the Site subscriptions
• Create the Subscription Settings SA & Proxy
http://gallery.technet.microsoft.com/ScriptCenter/c6598b84-1a58-4d55-ab41-fe7608cb343c

Get-SPServiceInstance | where{$_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"} | Start-SPServiceInstance

$acc = Get-SPManagedAccount "sharepoint\spservices"
$appPool = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $acc

$app = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPool –Name SettingsServiceApp –DatabaseName SettingsServiceDB
$proxy = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $app

•Create new Site Subscription(s)
•Create Tenant Admin Site(s)
•Create Member Sites(s)
http://gallery.technet.microsoft.com/ScriptCenter/en-us/6b012e44-4262-4446-9112-a8b3133c4654
Get-SPServiceInstance | where{$_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"} | Start-SPServiceInstance
$acc = Get-SPManagedAccount "sharepoint\spservices"
$appPool = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $acc
$app = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPool –Name SettingsServiceApp –DatabaseName SettingsServiceDB
$proxy = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $app

Service application partitioning


Get-SPServiceInstance | where{$_.GetType().Name -eq "MetadataWebServiceInstance"} | Start-SPServiceInstance

$pool = Get-SPServiceApplicationPool -Identity 'SharePoint Web Services Default'
$meta = New-SPMetadataServiceApplication -ApplicationPool $pool -Name 'Tenant Managed Metadata' -DatabaseName TenantMetadataDB -DatabaseServer sp2010 -PartitionMode

$proxy = New-SPMetadataServiceApplicationProxy -PartitionMode -ContentTypePushdownEnabled -DefaultKeywordTaxonomy -DefaultSiteCollectionTaxonomy -Name 'Tenant Managed Metadata Proxy' -DefaultProxyGroup -ServiceApplication $meta

Set-SPSiteSubscriptionMetadataConfig -identity $sub -serviceProxy $proxy -hubUri 'http://sp2010/mircosoft/mdhub'

Feature packs
http://gallery.technet.microsoft.com/ScriptCenter/d32274d0-e19c-4553-8556-3938671c95d9/

$sub = Get-SPSiteSubscription -identity GUID
$pack = New-SPSiteSubscriptionFeaturePack
$pack
Add-SPSiteSubscriptionFeaturePackMember -identity $pack -FeatureDefinition eaf6a128-0482-4f71-9a2f-b1c650680e77
$pack
$mgr = [Microsoft.SharePoint.SPSiteSubscriptionSettingsManager]::Local
$mgr.AssignFeaturePackToSiteSubscription($pack, $sub)

C# code Analysis using visual studio 2010 and FxCop

FxCop, an abbreviation “Framework Police,” is a rules-based engine that checks managed code assemblies for Microsoft’s .NET Framework design guidelines and custom guidelines. FxCop is a rule based engine which helps the development team to follow best practices of the .NET platform and development standards

Download: http://www.microsoft.com/en-us/download/details.aspx?id=6544

Step by steps on how to use: http://www.codeproject.com/Articles/78599/How-to-Use-FxCop

FxCop Integrator allows to integrate stand-alone FxCop and Code Metrics PoewrTool into VS2010. You can analysis your source code on VS2010 Pro.

http://fxcopintegrator.codeplex.com/

 

SharePoint 2010 Code Documentation using SandCastle and Visual Studio 2010

SharePoint 2010 Code Documentation   using SandCastle and Visual Studio 2010

In this post I’ll show you, how you can create a documention of your code. In the past ndoc was the tool to create code docus but the project seems to be dead. Therefore we use SandCastle, a freeware tool, that is also used by Microsoft to create Code-Documentations.
Here is the reference of the comments within visual studio:

First of all you need to install these things in the given order.
Before you can create the code documentation, you have to create the documentation XML in Visual Studio. Therefore open your solution. Open the properties of a project within the solution.
Now in the build tab check the “XML Documentation File”. The xml is now generated in the \bin\Debug folder. Of couse you can enter your own path if necessary.
Now rebuild your solution and check if a xml file exists beside the newly created dll.
The next steps are to open the GUI (SandCastel Help File Builder) and create a new project. You should find the gui in your start menu > programs.
I don’t want to reinvent the whell therefore, I forward you to some other sites. These sites can explain the next steps certainly better than I can. If you choose the Step by Step Tutorial, you can now start by step 4.

Powershell script for SharePoint 2010 & SharePoint 2007 Site Usage report

SharePoint 2010 & SharePoint 2007  – Powershell script for finding site Url, Title,user Count, Primary & Secondary Site collection admins, Usage, Hits, views, Created Date, last modifed date

[System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”)
# get local farm
$farm = [Microsoft.SharePoint.Administration.SPFarm]::Local
# get web services from local farm
$websrvcs = $farm.Services | where -FilterScript {$_.GetType() -eq [Microsoft.SharePoint.Administration.SPWebService]}
# format for .csv file output
$outputToCSV = @()
function CheckedOutItems()
{
    # get all web services available in the farm   
    foreach ($websrvc in $websrvcs) {
        # retrieve web applications
        foreach ($webApp in $websrvc.WebApplications) {
            # now get site collections from the web application
            foreach ($site in $webApp.Sites) {
                # process each web site
                Try {
                    foreach ($web in $site.AllWebs) {
                         $siteUrl = $web.Url
                         $siteName = $web.Title
                         $siteUserCnt = $web.AllUsers.Count
                         $PimarySiteAdmin = $site.Owner.Name
                         $SecondarySiteAdmin = $site.SecondaryContact.Name
                      $siteusage = $site.Usage.Storage/1MB
                         $Hits = $site.Usage.Hits                       
                         $Created = [datetime]$web.Created
                         $LastModified = $Web.LastItemModifiedDate
                         $SnapShot = (get-date)
                         $LastUpdate = ($SnapShot – [datetime]$LastModified)

                         $outputToCSV += New-Object PSObject -Property @{"Site Title" = $siteName; "Url" = $siteUrl; "Primary site collection admin"= $PimarySiteAdmin; 
                                                                        "Secondary site collection admin"=$SecondarySiteAdmin; "Total Users" =$siteUserCnt;"Size" = $siteusage; 
                                                                        "Date Last Modified" = $LastModified; "Days Last Update" = $LastUpdate; "Hits" =$Hits; "Date Created" =$Created
                                                                        }
                                        $file_date = get-date -format M-d-yyyy
                                        $file_name = "$env:USERPROFILE\Desktop\NoCheckedInVersion"+ $file_date + ".csv"
                                        $outputToCSV | ConvertTo-Csv -notype > $file_name

                } # end $site.AllWebs loop
            } # end Try statement 
            # General catch exceptions
            Catch {
                    "General Exceptions caught: " >> "$env:USERPROFILE\Desktop\errorlog.txt"
                    $_.Exception.Message >> "$env:USERPROFILE\Desktop\errorlog.txt"
            }# end general catch statement
            }
        }
    }
}
# Make a call to the function
CheckedOutItems