Sunday, January 24, 2016

Basic SharePoint 2013 tips & tricks collection - Part 1

I'm starting with SharePoint in end of 2015, then also want to write blog again, to collect all my work experience with SharePoint, probably with SharePoint 2013 this time.

I know all that tips tricks might be easy to find over the internet, but I will try to write them again with describe specific situation I meet. And will update time by time.

1. Change host-named for site collection in SharePoint 2013
That was painful lesson for me when I blow away all data of a site collection in production server (luckily it's not go live yet )

2. To login with different user
I don't know why, this thing is to hard in SharePoint, but in situation I run the UAT test, then should login with many accounts with different role. That is quick way to do:
http://<site URL>/_layouts/closeConnection.aspx?loginasanotheruser=true

3. Disable Loop Back Check in SharePoint 2013
It's not really SharePoint issue, that is Windows issue, then you can get Solution for that in Microsoft in this link:

In quick, you can see (not recommended but I tried):

Run this power shell command
New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -value "1" -PropertyType dword

You can also navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa in registry and create the dword32 for DisableLoopbackCheck, modify the value to 1.

Thank you.
will update more...

Tuesday, January 19, 2016

Change host-named for site collection in SharePoint 2013

Today I'm facing with problem to change host-named of existing site collection to another. It takes me a lot of search with some issues in each steps. So I think that will be useful if I summarize something here to save my time in future and your time also.

In short, what I do exactly is:
 - Create new site collection with new domain
 - Deploy the website on it
 - Backup old site collection, then Restore on the new site collection

Before the begin, lets define some addresses I will use in detail steps.
WebCollectionAddr : that's the web collection address, ex: sharepoint-123:8888
OldSiteCollectionAddr : that's the old site collection address, ex: sharepoint-123:8888/sites/mysite
NewSiteCollectionAddr : that's the new site collection address, ex:
I will use those above sites to demonstrate in each steps, so you should change it by your own sites.
Now we go in detail each step:

1. Create IIS binding for domain: 
 - Go to IIS Manager, click on your site under 'Sites'. You can see 'Bindings...' somewhere in the right content, click on.
 - Click 'Add'to add new and follow the step to create new site binding.

2. Create new site collection
 - Use sharepoint Powershell:
New-SPSite ‘http://NewSiteCollectionAddr/’ -HostHeaderWebApplication ‘http://WebCollectionAddr’ -Name ‘My site’ -Description ‘This is my site’ -OwnerAlias ‘domain\account’ -language 1033 -Template ‘STS#0’

 - Note: domain\account that account to login and have permission to create site collection

3. Check site is created
 - Use sharepoint Powershell:
Get-SPSite 'http://NewSiteCollectionAddr/'

4. Deploy the web site
 - Deploy the web site in the new site collection

5. Backup the old site collection
 - Use sharepoint Powershell:
Backup-SPSite 'http://OldSiteCollectionAddr/' -Path 'D:\SPBackup\bk_name.bak'

6. Delete old site collection
 - Go to sharepoint Central Administration > Application Management > Delete a Site collection
 - Select the old site collection then delete it

7. Remove the old site collection from recycle bin
 - After deleted, the site collection go to recycle bin, to restore data to new site collection, you should completely delete old site collection
 - To do that, you should get site id of old site collection from database 'AllSites' table
 - Use sharepoint Powershell:
Remove-SPDeletedSite -Identity 'GUID_SITE_ID'
 - Note: GUID_SITE_ID will be changed by site id, usually is guid text

8. Run Gradual Site Deletion Timer Job
 - Go to Central Administration > Monitoring > Review Job Definations.
 - Click on job name: Gradual Site Delete. Click on Run now.

9. Restore to new site
 - Use sharepoint Powershell:
Restore-SPSite 'http://NewSiteCollectionAddr/' -Path 'D:\SPBackup\bk_name.bak' -HostHeaderWebApplication ‘http://WebCollectionAddr’ -Force

Follow those steps, if you have any futher issue please comment in this blog.

Thank you.