Self-Service Site Creation is not working in SharePoint 2013

Assume that you have installed SharePoint 2013 and configured your MySite Host Application  . And Enabled Self-Service Site Creation feature on your MySite Host Application as described following article :
http://technet.microsoft.com/en-us/library/ee624362.aspx#enableselfsvc

To enable self-service site creation for the web application
1.Verify that you have the following administrative credentials:
To enable self-service site creation, you must be a member of the Farm Administrators group on the computer running the SharePoint Central Administration website.
2.In Central Administration, in the Application Management section, click Manage Web applications.
3.On the Web Applications page, select the web application that you created to host My Sites.
4.On the Web Applications tab, in the Security group, click Self-Service Site Creation.
5.In the Self-Service Site Creation Management dialog box, in Site Collections, select On. Optionally, in Quota template to apply, select a quota template.
6.In Start a Site, choose one of the following options:
a.Prompt users to create a team site under so users can create team sites from their My Site to use site feeds.
b.Be hidden from users if you do not want users to create team sites from their My Sites to use site feeds.
7.Click OK to finish.

Perform these additional steps to configure permissions for users to create team sites from their My Sites to use site feeds.
1.In the Policy group, click Permission Policy.
2.On Manage Permission Policy Levels dialog box, click Add Permission Policy Level.
3.Type a name for the permission policy.
4.Under Permissions, in Site Permissions, select the Grant option for Create Subsites – Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.
5.Click Save.
6.In the Policy group, click User Policy.
7.On Policy for Web Application dialog box, click Add Users.
8.On Add Users, in Zones select (All Zones), then click Next.
9.In Choose Users, enter the user names of the users that you want to create team sites from their My Site to use site feeds. If all users can create team sites from their My Site to use site feeds, click the Browse icon. In Select People and Groups, click All Users, then click Everyone. Click Add, and then click OK.
10.In the Choose Permissions section, select

But the problem is even you did the configuration is correct , Still that the users doesnt use their mysite without their personal sites and looks the Self-Service Site Creation is not working. When you click Sites, Skydrive, NewsFeed links you have facing a blank page for it.

When you checked the ULS logs , you are facing following error ;

Skipping creation of personal site from MySitePersonalSiteUpgradeOnNavigationWebPart::CreatePersonalSite() because one or more of the creation criteria has not been met. [SPWeb Url=https://blog.bugrapostaci.com/Person.aspx?accountname=MyDomain\bugra]  https://blog.bugrapostaci.com/Person.aspx?accountname=MyDomain\bugra] Self-Service Site Creation == True  Can Create Personal Site == False  Is user licensed == False  Storage&Social UPA Permission == True  Site or Page or Web Part is in design mode == False

If you facing this , Looks that you have a problem with User License.

“In Office SharePoint Server 2007 and SharePoint Server 2010, when companies purchased a SharePoint Server Enterprise client access license (CAL) and deployed a server running SharePoint Server Enterprise, all users who accessed that server could use the full enterpr ise feature set. There was no way to determine the CAL that a specific user had. The only way to ensure that only users who had an Enterprice CAL accessed Enterprise features was to have separate Enterprise and Standard server deployments.

In SharePoint 2013, farm administrators now can assign licenses to users and enable license checks. WIth this new functionality, you can ensure that only users with the appropriate license can use a specific feature. This SharePoint Server license implementation is managed by using new Windows PowerShell cmdlets. By default, licensing is disabled in SharePoint Server. Administrators can opt to enable it by using Windows PowerShell.”
http://technet.microsoft.com/en-us/library/jj219627.aspx

if in your system new licensing feature of SharePoint 2013 was enabled but not configured. (In that article also contains how to configure licensing feature) You may probably facing this issue.

For resolving this you have two options.(You must use Windows PowerShell to create mappings for license types and to return user license types. There is no user interface for this feature.)

1) Configure Licensing feature correctly.

Get-SPUserLicense
$a = New-SPUserLicenseMapping -SecurityGroup <yoursecuritygroup> –License Enterprise
$a | Add-SPUserLicenseMapping
Enable-SPUserLicensing

2) Disable Licensing feature
Disable-SPUserLicensing

 

Attach custom master page to personal site using Stapling feature for Sharepoint 2010

Hi Everyone ,

In this article i am explaining how could we attach a custom master page to  Personal sites in MySite Host. I have created two Sharepoint Project named MyMasters and MyMastersStapling using Visual Studio 2010.

you can download the visual studio solution from CodePlex
http://mymasters.codeplex.com/

The solution is anwering fallowing questions  :

* How to deploy custom master page ?
* How to customize a masterpage ?
* How to attach custom master page to personal sites using staping feature ?
* How to set wellcome page programmatically ?
* How to add document library as a web part to a page ?


MyMasters  Project
: is a sharepoint project that deploy a custom master page to a sharepoint site.
MyMasterStapling  Project: is a sharepoint project that attach feature of MyMasters to personal site template and activates the publishing features

First i created a site scope feature named “MyMasters”  and and a feaurereciever .The important part is here the feature guid . You need this guid for feature stapling configuration. you can get the feature guid from Feature manifest file.

<Feature xmlns=”http://schemas.microsoft.com/sharepoint/” Title=”MyMasters” Description=”This feature enables defined master page for your site”
Id=”09c222f7-68ed-4278-a3ce-d64b8dbfb168” ReceiverAssembly=”MyMasters, Version=1.0.0.0, Culture=neutral, PublicKeyToken=2e49c3c1155d0e27″ ReceiverClass=”MyMasters.Features.MyMasters.MyMastersEventReceiver” Scope=”Site”>
… child nodes
</Feature>

And I have create two modules MasterPageModule and CustomAssests Module .

MasterPageModule : contains masterpage file and when the feature is activated it deploy master page the masterpage library under _catalogs folder.
CustomAssests : contains necessary css , js and image files. when the feature is activated it deploy assests to Style Library List of target site by creating specific folder for each asset type.

Here is the code of Feature Reciever.

public class MyMastersEventReceiver : SPFeatureReceiver
{
// Uncomment the method below to handle the event raised after a feature has been activated.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
ApplyTheme(properties);
}
// Uncomment the method below to handle the event raised before a feature is deactivated.
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
RevertTheme(properties);
SPSite site = (SPSite)properties.Feature.Parent;
if (site != null)
{
//Remove custom master page
SPFile masterFile = site.RootWeb.GetFile(“_catalogs/masterpage/PersonalSite.master”);
masterFile.Delete();
//Remove assets folders.
site.RootWeb.Folders[“Style Library”].SubFolders.Delete(“CustomCssFiles”);
site.RootWeb.Folders[“Style Library”].SubFolders.Delete(“CustomJSFiles”);
site.RootWeb.Folders[“Style Library”].SubFolders.Delete(“CustomImages”);
}
}   private void ApplyTheme(SPFeatureReceiverProperties properties)
{
SPSite site = (SPSite)properties.Feature.Parent;
if (site != null)
{
// Set the System Master Page to orginal
Uri masterUri = new Uri(site.RootWeb.Url + “/_catalogs/masterpage/v4.master”);
site.RootWeb.MasterUrl = masterUri.AbsolutePath;
// Set the Publishing Master Page our custom PersonalSite.master page.
Uri customMasterUri = new Uri(site.RootWeb.Url + “/_catalogs/masterpage/PersonalSite.master”);
site.RootWeb.CustomMasterUrl = customMasterUri.AbsolutePath;
site.RootWeb.Update();
}
}
private void RevertTheme(SPFeatureReceiverProperties properties)
{
SPSite site = (SPSite)properties.Feature.Parent;
if (site != null)
{
// Set the System Master Page to orginal
Uri masterUri = new Uri(site.RootWeb.Url + “/_catalogs/masterpage/v4.master”);
site.RootWeb.MasterUrl = masterUri.AbsolutePath;
// Set the Publishing Master Page  to orginal
Uri customMasterUri = new Uri(site.RootWeb.Url + “/_catalogs/masterpage/v4.master”);
site.RootWeb.CustomMasterUrl = customMasterUri.AbsolutePath;
site.RootWeb.Update();
}
}
}

By default the following rule applies when you deploy a master page:

  • Site Master Pages: used by all publishing pages – and only by publishing pages
  • System Master Pages: used by everything else including forms and view pages

So in Feature reciever ->  ApplyTheme() function we set two master page first one is V4.master the orginal master for System masterpage and our custom master for Site Master page. As you know you have to enable Publishing Features for  the site if you want to this deplotment work correctly.
For deploying PersonalSite.master via module the element file :

<?xmlversion=1.0encoding=utf-8?>
<Elementsxmlns=http://schemas.microsoft.com/sharepoint/>
<ModuleName=MasterPageModuleList=116Url=_catalogs/masterpage>
   <FilePath=MasterPageModule\PersonalSite.master  Url=PersonalSite.masterType=GhostableInLibrary >
        <PropertyName=UIVersionValue=4 />
        <PropertyName=ContentTypeIdValue=0x010105 />
   </File>
</Module>
</Elements>

You can deploy this solution any site by using visual studio at the end you can able to see this view :

For MyMasterStapling Project . I have created a farm level feature named “MyMastersStapling” and an empty element named “StaplingElement”


Element.xml :

<?xmlversion=1.0encoding=utf-8?>
<Elementsxmlns=http://schemas.microsoft.com/sharepoint/>
<FeatureSiteTemplateAssociationId=f6924d36-2fa8-4f0b-b16d-06b7250180faTemplateName=SPSPERS#0 />
<FeatureSiteTemplateAssociationId=22a9ef51-737b-4ff2-9346-694633fe4416TemplateName=SPSPERS#0 />
<FeatureSiteTemplateAssociationId=09c222f7-68ed-4278-a3ce-d64b8dbfb168TemplateName=SPSPERS#0 />
</Elements>

The FeatureSiteTemplateAssociation element maps feature GUIDs to site defintions – note that the format of the TemplateName attribute value is <SiteDefName>#<ConfigurationID>. This obviously allows a degree of flexibility and allows you to do fairly complex things with different configurations of site definitions. As you now at the beginning of article we highlighted a GUID the feature of MyMasters.

The third item is using this guid 09c222f7-68ed-4278-a3ce-d64b8dbfb168 .What about first two ? these feature ids are blong to Publishing Features. First one is “Publishing Feature Site”  feature’s id at site level and the second one is Publishing feature’s id at web level.

These two ids are built in sharepoint 2010 and it is not change by installation .If you wonder how could i found this ids ,i used the powershell console for sharepoint :
get-spfeature | where-object { $_.DisplayName -like “*Publish*” }


For Template name  SPSPERS is the personal site template name.  for #Zero i am attaching the default configuration.

For More information about site templates.
http://office.microsoft.com/en-us/sharepoint-server-help/a-preview-of-the-sharepoint-server-2010-site-templates-HA101907564.aspx

So far so good. After you deploy our stapling project and activate the feature , the users can able to see our custom master page even if self site creation is enabled for personal sites .

See you next articles.

Create all users’ personal site via Powershell script – Sharepoint 2010

#PowerShell Script - Create All Users Personel Sites - SharePoint 2010 #The scripts is distributet "as-is." Use it on your own risk. 
#Add SharePoint PowerShell SnapIn if not already added if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

[Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")

$mysiteHostUrl = "http://my"
$personalSiteGlobalAdmin = "DOMAIN\padm"
$personalSiteGlobalAdminNot ="padm@bugrapostaci.com"
$personalSiteGlobalAdminDisplayName = "Personel Site admin"
$mysite = Get-SPSite $mysiteHostUrl

$context = [Microsoft.Office.Server.ServerContext]::GetContext($mysite)
$upm =  New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)

$AllProfiles = $upm.GetEnumerator()

foreach($profile in $AllProfiles)
{

    $DisplayName = $profile.DisplayName
    $AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value
       #Add your restrictions for users.        if($Accountname -like "YourDomain*")
       {
          if($profile.PersonalSite -eq $Null)
          {
               write-host "Creating personel site for ", $AccountName
               $profile.CreatePersonalSite()
               #Adding an extra admin for personel sites                $pweb = $profile.PersonalSite.OpenWeb()
               $pweb.AllUsers.Add($personalSiteGlobalAdmin,$personalSiteGlobalAdminNot,$personalSiteGlobalAdminDisplayName,$null);
               $padm= $pweb.AllUsers[$personalSiteGlobalAdmin];
               $padm.IsSiteAdmin = $true;
               $padm.Update();
               $pweb.Dispose();
               write-host "Personal Site Admin has assigned"
          }
          else
          {
               write-host $AccountName ," has already personel site"
          }
   }
}
$mysite.Dispose();

Sharepoint 2010 – Delete all users’ personel sites via powershell

#PowerShell Script - Delete All Users Personel Sites - SharePoint 2010
#The scripts is distributet "as-is." Use it on your own risk. The author give no warranties, guarantees or conditions.

#Add SharePoint PowerShell SnapIn if not already added
 if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
    Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
[Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")

$mysiteHostUrl = "http://my"
$mysite = Get-SPSite $mysiteHostUrl
$context = [Microsoft.Office.Server.ServerContext]::GetContext($mysite)

$upm =  New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)

$AllProfiles = $upm.GetEnumerator()

foreach($profile in $AllProfiles)
{
   $DisplayName = $profile.DisplayName
   $AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value  

   if($profile.PersonalSite -ne $Null)
   {

	   $profile.PersonalSite.Delete()
	   write-host $AccountName , " personel site deleted successfully"
   }
}
$mysite.Dispose();