Wednesday, December 23, 2015

Freeze header for title in SharePoint 2013 List/Library

If you have a long list in your site, when you scroll down then the headers are not appearing. That's why every time users should scroll-up and down. How to freeze header for title in SharePoint 2013 List/Library?


Before.























1. Access the library/list.
2. Then click on Edit Page.
3. Then Add an App 'Content Editor Web Part'















4. Then click on Content Editor Web Part and add the below script by clicking on 'Edit Source' from the Ribbon.
5. After you have paste the below code click on Page Tab click on Stop Editing.
6. That's it!



After.





Script:


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript">

jQuery(document).ready(function(){

stickyHeaders()

})

function stickyHeaders(){

if( jQuery.inArray( "spgantt.js", g_spPreFetchKeys ) > -1){

SP.SOD.executeOrDelayUntilScriptLoaded(function () {

findListsOnPage();

}, "spgantt.js");

} else {

findListsOnPage();

}

$(window).bind('hashchange', findListsOnPage);

}

function findListsOnPage() {

var lists          = $('.ms-listviewtable')

var quickEditLists = [];

var listViews      = [];

$(lists).each(function(i){

if($(this).find('div[id^="spgridcontainer"]').length > 0 ){

quickEditLists.push($(this))

} else if( $(this).hasClass("ms-listviewgrid") == false ) {

listViews.push($(this))

}

})

if(quickEditLists.length > 0) {

SP.GanttControl.WaitForGanttCreation(function (ganttChart) {

initializeStickyHeaders(quickEditLists, "qe");

});

}

if(listViews.length > 0) {

initializeStickyHeaders(listViews, "lv");

}

}

function initializeStickyHeaders (lists, type) {

var top_old        = [], top_new        = [],

bottom_old     = [], bottom_new     = [],

stickies       = [], headers        = [],

indexOffset    = 0 ;

var style = "position:fixed;" +

"top:65px;" +

"z-index:1;" +

"background-color:beige;" +

"box-shadow:3px 3px 5px #DDDDDD;" +

"display:none"

$(window).unbind('resize.' + type);

$(window).bind  ('resize.' + type, updatestickies );

$('#s4-workspace').unbind('scroll.' + type);

$('#s4-workspace').bind  ('scroll.' + type, updatestickies );

$(lists).each(function(){

headers.push($(this).find($('.ms-viewheadertr:visible')))

});

$(headers).each(function (i) {

var table = $(this).closest("table");

if(table.find("tbody > tr").length > 1) {

table.parent().find(".sticky-anchor").remove()

table.parent().find(".sticky").remove()      

var anchor = table.before('<div class="sticky-anchor"></div>')

stickies.push($(this).clone(true,true).addClass("sticky").attr('style', style).insertAfter(anchor))

var tbodies = $(this).parent("thead").siblings("tbody")

if(tbodies.length > 1) {

tbodies.bind("DOMAttrModified", function(){

setTimeout(function(){

$('#s4-workspace').trigger("scroll", true)

}, 250)

})

}

} else {

headers.splice(i-indexOffset,1)

indexOffset++;

}

})

//Do it once even without beeing triggered by an event

updatestickies();

function updatestickies (event, DOMchangeEvent) {

$(headers).each(function (i) {

if(DOMchangeEvent) {

width();

return false;

}

function width() {

stickies[i].width(headers[i].width()).find('th').each(function (j) {

$(this).width(headers[i].find('th:nth-child(' + (j+1) + ')').width())

})

}

top_old[i]    = top_new[i]

top_new[i]    = Math.round($(this).offset().top - 45)

bottom_old[i] = bottom_new[i]

bottom_new[i] = Math.round(top_new[i] - 30 + $(this).closest('table').height())

stickies[i].offset({

left: Math.round(headers[i].closest("div[id^=WebPartWPQ]").offset().left)

});

if(top_old[i] >= 0 && top_new[i] <= 0 ||

bottom_old[i] <= 0 && bottom_new[i] >= 0 ||

top_old[i] === undefined && bottom_old[i] === undefined && top_new[i] < 0 && bottom_new[i] > 0 ) {

width();

stickies[i].fadeIn();

} else if (top_old[i] <= 0 && top_new[i] >= 0 || bottom_old[i] >= 0 && bottom_new[i] <= 0 ) {

stickies[i].fadeOut();

}

})

}

}

</script>



Reference: This code is refered from the below article.
http://tussharonoffice365.blogspot.com/2014/05/how-to-freeze-header-for-title-in.html

Thursday, November 5, 2015

Term Store Management - Submission Policy grayed out


In the Submission Policy section, specify whether you want the term set to be Closed or Open. If you want the term set to be updated only by those people who have permission to update managed metadata, select Closed. If you want all users to be able to add new terms to the term set when they update the value for Managed Metadata columns mapped to this term set, then select Open.


Submission Policy grayed out.







Open SharePoint Management Shell as Administrator and run next command:

 
#Connect to Central Admin
$Session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession(“Central Admin URL”)

#Connect to Managed Metadata Service
$Store = $Session.TermStores[“Managed Metadata Service Name”]
#Get the group
$Group = $Store.Groups[“Group Name”];
#Get the Term Set
$TermSet = $Group.TermSets[“Term Set Name”];
#Update the Is Open property
$TermSet.IsOpenForTermCreation = $false;

#Commit changes
$Store.CommitAll();








Example:

#Connect to Central Admin
$Session = new-object Microsoft.SharePoint.Taxonomy.TaxonomySession(“http://dev6:55555”)

#Connect to Managed Metadata Service
$Store = $Session.TermStores[“Managed Metadata Service”]
#Get the group
$Group = $Store.Groups[“System”];
#Get the Term Set
$TermSet = $Group.TermSets[“Keywords”];
#Update the Is Open property
$TermSet.IsOpenForTermCreation = $false;

#Commit changes
$Store.CommitAll();
 

Monday, November 2, 2015

Inheriting parent site Theme in sub-sites - SharePoint 2013

How to inherit parent site theme on subsites?

Theme Inheritance – Publishing Sites


Site Settings > Master Page, under the Theme section of that page check "Reset all subsites to inherit the theme of this site"









Theme Inheritance – Non-Publishing Sites

Open SharePoint Management Shell as Administrator and start next command:
$url = "http://your-site"
$site = Get-SPSite -Identity $url
Write-Host "RootWeb Theme: " site.RootWeb.ThemedCssFolderUrl
foreach ($web in $site.AllWebs) {
  Write-Host "Web Title: " $web.Title
  Write-Host "Web Theme: " $web.ThemedCssFolderUrl
  $web.ThemedCssFolderUrl = $site.RootWeb.ThemedCssFolderUrl
  $web.Update()
  $web.Dispose()
}
$site.Dispose();

Wednesday, October 14, 2015

Office Web Apps Server 2013 - machines reported as Unhealthy

After you configure Web Apps 2013 farm you found the Web Apps Machine is Unhealthy






In order for IIS to understand .svc files, and not use the Static file handler, you need to install HTTP Activation for .NET Framework 4.5 WCF Services on your WAC machines. It can be done using the following PowerShell command:

Add-WindowsFeature NET-WCF-HTTP-Activation45

 
 
Once the feature is installed, there is no need for any server restart, you should see that your machines are reported as Healthy. Remember it can take up to 10-20 minutes. You can sometimes speed up the health reporting a bit by restarting the WAC Service:
 

Wednesday, October 7, 2015

Enable feature in SharePoint 2013 - PowerShell

How to activate SharePoint feature using powershell script?



Open SharePoint Management Shell as Administrator

Enable-SPFeature FeatureID -url http://url
Optional [-Force]

To get Feature ID run the command Get-SPFeature


Example:

Active Site Collection Publishing Feature

Enable-SPFeature f6924d36-2fa8-4f0b-b16d-06b7250180fa -url http://webApplication/siteColection/

Friday, October 2, 2015

Remove property from Property Bag with PowerShell

How to remove properties from multiple places in SharePoint with powershell script?

For Web Application

$web = Get-SPWeb <url>
$web.Properties.Remove('test') // this is a key
$web.Update()
$web.Properties

For Farm

$web = Get-SPFarm
$web.Properties.Remove('test') // this is a key
$web.Update()
$web.Properties



Powershell to get Property bag for Farm, Web App or Site Collection



Wednesday, September 23, 2015

Excluding Sites from Search - SharePoint 2013

Instead of setting each subsites search visibility property manually, use Powershell to exlude SharePoint sites from search.

Content from that site and all of its subsites will not appear in search results.


$siteUrl = "http://NameOfSite"

Get-SPSite $siteUrl | Get-SPWeb -Limit all | ForEach-Object {
Write-Host “`tProcessing Web: $($_.ServerRelativeUrl)…” -ForegroundColor White
 if (!$whatIf)
 {
 Write-Host “Setting properties on Web:” $_.Title -ForegroundColor White
 $_.NoCrawl = $true
 #Update the web
 $_.Update()
 }
 else
 {
 Write-Host “Reading properties on Web:” $_.Title -ForegroundColor White
 Write-Host “No crawl enabled: “$_.NoCrawl
 }
 }
 $site.Dispose()

Start User Profile Synchronization Service using PowerShell

How to start User Profile Synchronization Service using PowerShell?


Open SharePoint Management Shell.

Get-SPServiceInstance | Where-Object {$_.TypeName -eq 'User Profile Synchronization Service'}

Using this powershell commandlet you can get GUID details.


Start-SPServiceInstance –Identity  GUID of the Service application


Sometimes your User Profile Synchronization service might stuck in “Starting” due to some issues in Synchronization. To Stop that service, use the below command

Stop-SPServiceInstance –Identity  GUID of the Service application

Wednesday, September 16, 2015

Add different Colors to Calendar Overlay

How to add different Colors to Calendar Overlay in SharePoint?


Edit page.














Add web part, Content Editor.














Edit Source.












Paste text


<style type="text/css">
.ms-acal-color1{
   background-color:#1BBA61;
}
.ms-acal-color2{
   background-color:#C0362C;
}
.ms-acal-color3{
   background-color:#816C5B;
}
.ms-acal-color4{
   background-color:#668D3C;
}
.ms-acal-color5{
   background-color:#007996;
}
.ms-acal-color6{
   background-color:#1BECDC;
}
.ms-acal-color7{
   background-color:#253529;
}
.ms-acal-color8{
   background-color:#288054;
}
.ms-acal-color9{
   background-color:#AEA9B8;
}
</style>


You can choose the color from http://www.color-hex.com/

Friday, September 11, 2015

Start and Stop the Distributed Cache Service PowerShell

How to start and stop Distributed Cache Service using SharePoint Management Shell?


# Start the Distributed Cache service by using Windows PowerShell     
     
$InstanceName = "SPDistributedCacheService Name=AppFabricCachingService";           
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}           
$serviceInstance.Provision();           
            
# Stop the Distributed Cache service by using Windows PowerShell       
   
$instanceName = "SPDistributedCacheService Name=AppFabricCachingService"           
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}           
$serviceInstance.Unprovision();


Thursday, September 10, 2015

Delete Search Service Application - SharePoint 2013

Can't delete SharePoint search service application from GUI? Here is a solution.


POWERSHELL

Run SharePoint Management Shell as Administrator.

$spapp = Get-SPServiceApplication -Name "Name Search Service Application"
Remove-SPServiceApplication $spapp -RemoveData


Or

Get-SPServiceApplication

$P = Get-SPServiceApplication -identity PutYourSearchApplicationGuidHere
Remove-SPServiceApplication $P
Remove-SPServiceApplication $P -RemoveData



STSADM


Open up a Command Prompt using Admin Rights

Change directory to: cd  C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN

Type the STSADM command

stsadm -o deleteconfigurationobject -id [Search Service Application GUID ID]

Thursday, September 3, 2015

Cannot change Preferred Search Center in My Site Settings - SharePoint 2013

You can't change the search center for SharePoint My Site from the UI. The solution would be in powershell.














Open and run SharePoint Management Shell as Administrator.

Run next command

$ssa = Get-SPEnterpriseSearchServiceApplication "Search Service Application"
$ssa.SearchCenterUrl = "http://url/site/searchcentername/Pages/"
$ssa.Update

"Search Service Application" - name of  Search Service Application

When done do an IIS reset and try searching from your mysite.























Tuesday, September 1, 2015

My Site creation stuck at “We’re almost ready" SharePoint

The personal site managed path created on the web application hosting the Personal Site site collections, so why can't it find the correct managed path.  Well, in fact the User Profile application is not looking at the list of managed paths on the web application, it’s looking at the list of managed paths defined on the SPContentService.  

To find out what managed paths you have defined on your Content Service, you can run this bit of PowerShell from a SharePoint PowerShell console window:

Get-SPManagedPath -HostHeader








New-SPManagedPath -RelativeURL "personal" -HostHeader







To verify the command added the managed path correctly, re-execute the following PowerShell from a SharePoint console window:

Get-SPManagedPath –HostHeader

 

Friday, August 28, 2015

Disable Loopback Check - PowerShell

How to disable Loopback Check in Windows Registry with PowerShell?

Run the following PowerShell command as Administrator.

New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck" -Value "1" -PropertyType dword






Change Distributed Cache service memory - SharePoint 2013

Use this procedure to reconfigure the memory allocation of the cache size of the Distributed Cache service in SharePoint

1.Determine the total physical memory on the server.

2.Reserve 2 GB of memory for other processes and services that are running on the cache host. For example, 20 GB – 2 GB = 18 GB. This remaining memory is allocated to the Distributed Cache service.

3.Take half of the remaining memory, and convert it to MB. For example, 18 GB/2 = 9 GB or 9216 MB. This is the cache size of the Distributed Cache service.

4.To check the existing memory allocation for the Distributed Cache service on a server, run the following command at the SharePoint Management Shell command prompt:

Use-CacheCluster
Get-AFCacheHostConfiguration -ComputerName ComputerName -CachePort "22233"

5.Stop the Distributed Cache service on all cache hosts in the farm.

6.To change the cache size of the Distributed Cache service, run the following command at the SharePoint Management Shell command prompt:

Update-SPDistributedCacheSize -CacheSizeInMB 9216

7.Start the Distributed Cache service on all cache hosts in the farm.

Wednesday, August 26, 2015

Redirect Host Name Site Collection from HTTP to HTTPS


HNSC works on HTTP.













Open SharePoint Management Shell as Administrator and run next command

$site = Get-SPSite -Identity http://test
$site.Rename("https://test.eps.rs")







In DNS create New Host (A) record for HTTPS (https://test.eps.rs)
In IIS Manager add binding for HTTPS app on Web Application.














That's it! The HNSC works on HTTPS.

 

Tuesday, July 21, 2015

Open Document in Client Applications by Default - PowerShell


"Open Document in Client Applications by Default"  in SharePoint 2013 from PowerShell.





Open SharePoint Management Shell and run next command.

Enable-SPFeature 8a4b8de2-6fd8-41e9-923c-c7c3c00f8295 -url http://WebApp/SiteCollection
In my case I have a root site collection.

 






To enable other feature, go to link

Monday, July 13, 2015

Moving a Site collection from one content database to another content database

Under some circumstances, you might want to move one or more SharePoint site collections to a different content database. For example, a site collection can outgrow the content database on which it resides, and you would have to move the site collection to a larger content database.
You can move site collections between databases in a SharePoint Server farm by using Microsoft PowerShell.

$siteUrl = Read-Host “Enter Site Collection URL to be moved”
$newDBName = Read-Host “Enter destination Database Name”
$contentDBInfo = Get-SPContentDatabase -Site $siteUrl
$oldDBName = $contentDBInfo.Name
Move-SPSite -Identity $siteUrl -DestinationDatabase $newDBName
Write-Host ""
Write-Host "Site collection " $siteUrl "has been moved from " $oldDBName "to " $newDBName " successfully." -ForegroundColor Blue

Create new Database in SQL Managemnet Studio.
In Central Administration add Database to Web Application.
Central Administration, Content Databases, choose Web Aplication, Add a content database.




















Run PowerShell as Administrator and start the script.







Possible error:

“Cannot complete the copy or merge operation because the database schema versions are different.”


Sometimes you content databases do not get properly upgraded during the installation of a cumulative update or service pack. There is a quick an easy fix. Just use the Upgrade-SPContentDatabase cmdlet to update the content database.


Upgrade-SPContentDatabase -Identity <content database name>



 

Wednesday, July 8, 2015

SharePoint configuration wizard Failed


An exception of type Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException was thrown. Additional exception information: Failed to upgrade SharePoint Product













Resolution:

1. Clear configuration cache with GUI or PowerShell

2. Find current pv value using:

    stsadm -o getproperty -pn command-line-upgrade-running

    if -pv value is yes, change to No. If no change to Yes

    stsadm -o setproperty -pn command-line-upgrade-running -pv No


3. Re-run configuration wizard with PowerShell or GUI.

    PowerShell command:

    PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures


4. If still not working, you need server reboot.
 
 


 


 

Tuesday, July 7, 2015

Tuesday, June 30, 2015

Cannot connect to WMI provider - SQL Server Configuration Manager



Error: “Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 and later servers with SQL Server Configuration Manager.”














Resolution:

Open command prompt, navigate following path:
C:\Program Files <x86>\Microsoft SQL Server\110\Shared

The value of number depends on the version of SQL Server

Microsoft SQL Server 2012
110
Microsoft SQL Server 2008 R2
100
Microsoft SQL Server 2008
100
Microsoft SQL Server 2005
90

 
Type next command, and then press ENTER:

mofcomp sqlmgmproviderxpsp2up.mof











After you run the Mofcomp tool, make sure to restart the WMI service for the changes to take effect.

Event ID 5586, Cannot generate SSPI context


Event Viewer:

Unknown SQL Exception 0 occurred. Additional error information from SQL Server is included below.The target principal name is incorrect.  Cannot generate SSPI context.

 

Solution:

Logon to the SQL server using Domain Admin rights.

Start command prompt as Administrator:
setspn -L MyDomain\MyUserName
Registered ServicePrincipleNames for CN=MyUserName Service Account, OU=Service Accounts, DC=MyDomain,DC=com: mssqlsvc/MyServer1.MyDomain.com:MyPort mssqlsvc/MyServer2.MyDomain.com:MyPort mssqlsvc/MyServer3.MyDomain.com:MyPort

Note: MyUserName will be SharePoint Timer Service account, this is SharePoint Farm account

If you are getting the error (Cannot generate SSPI context), you will not find the SQL server name in the list displayed by the command.

To Register your SQL server type the following command.
setspn -A MSSQLSvc/MyServer.MyDomain.com:1433 MyDomain\MyAccount
Note:- MyServer will be the SQL server name to which you are not able to connect.

Again run the
setspn -L MyDomain\MyUserName command, you should find your SQL servers FQDN registered.


 

Tuesday, June 23, 2015

Deploy desktop shortcut and Icon using a Group Policy

You can easily to add desktop shortcuts using Group Policy with just a few clicks.

Open Group Policy Management

Click on "Create a GPO in this domain, and Link it here..."






















Type Name of GPO.















Right click on GPO, Edit.









Then will be open Group Policy Management Editor.
Navigate to User Configuration, Windows Settings, Shortcuts.




















Right click, New, Shortcut.



















Configure Properties.

























"Gpupdate /force" in PowerShell on user machine, or restart.




Enable email notification in task list in SharePoint

How to send a email notifications in SharePoint task list to persons who have been assigned list items?

Run SharePoint Management Shell as Administrator

$site=Get-SPWeb "http://SiteURL"
$list=$site.Lists.TryGetList("List Name")
if($list -ne $null)
{
   $list.EnableAssignToEmail =$true
   $list.Update()
}




Tasks in SharePoint MySite - "Last updated" every minute


How to reduce the refresh time for Tasks in SharePoint My Site?


Start SharePoint Management Shell as Administrator

$wmservice = Get-SPServiceApplication -Name "Work Management Service Application"

$refreshTime = New-Timespan -Minutes 1

Set-SPWorkManagementServiceApplication -Identity $wmservice -MinimumTimeBetweenProviderRefreshes $refreshTime


Tuesday, April 7, 2015

Recover SharePoint Farm Managed Account Passwords

You lost password for SharePoint accounts? Recover them from PowerShell

This script will Display the SharePoint Farm Managed Accounts password including the Farm Account, without requiring the current user to be a part of the SharePoint Farm Admin Group.

Run PowerShell as Administrator on a SharePoint Server.



Download script


#------------------------------------------------------------------------------------------
# Name:            Recover-SPManagedAccounts
# Description:    This script will retrieve the Farm Account credentials and show the 
#                passwords for all of the SharePoint Managed Accounts
# Usage:        Run the script on a SP Server with an account that has Local Admin Rights
# By:            Ivan Josipovic, Softlanding.ca
#------------------------------------------------------------------------------------------

#Checks if the Current PowerShell Session is running as the Administrator
if(([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") -eq $false){
    Throw "This Script must be ran as Administrator"
}

#This section retrives the Farm Account UserName/Password from the Security Token Service Application Pool
$Farm_user = C:\Windows\System32\cmd.exe /q /c $env:windir\system32\inetsrv\appcmd.exe list apppool "SecurityTokenServiceApplicationPool" /text:ProcessModel.UserName;
$Farm_pass = C:\Windows\System32\cmd.exe /q /c $env:windir\system32\inetsrv\appcmd.exe list apppool "SecurityTokenServiceApplicationPool" /text:ProcessModel.Password;
$Credential = New-Object System.Management.Automation.PsCredential($Farm_user, (ConvertTo-SecureString $Farm_pass -AsPlainText -Force));

# This line contains the script which returns the account passwords, script is from http://sharepointlonghorn.com/Lists/Posts/Post.aspx?ID=11
$GetManagedAccountPasswords = "
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0;
function Bindings(){
    return [System.Reflection.BindingFlags]::CreateInstance -bor
    [System.Reflection.BindingFlags]::GetField -bor
    [System.Reflection.BindingFlags]::Instance -bor
    [System.Reflection.BindingFlags]::NonPublic;
}
function GetFieldValue([object]`$o, [string]`$fieldName){
    `$bindings = Bindings;
    return `$o.GetType().GetField(`$fieldName, `$bindings).GetValue(`$o);
}
function ConvertTo-UnsecureString([System.Security.SecureString]`$string){ 
    `$intptr = [System.IntPtr]::Zero;
    `$unmanagedString = [System.Runtime.InteropServices.Marshal]::SecureStringToGlobalAllocUnicode(`$string);
    `$unsecureString = [System.Runtime.InteropServices.Marshal]::PtrToStringUni(`$unmanagedString);
    [System.Runtime.InteropServices.Marshal]::ZeroFreeGlobalAllocUnicode(`$unmanagedString);
    return `$unsecureString;
}
Get-SPManagedAccount | select UserName, @{Name='Password'; Expression={ConvertTo-UnsecureString (GetFieldValue `$_ 'm_Password').SecureStringValue}}";

#Writes the Script to the Public Folder (C:\Users\Public), this is required as we cant run the script inline as its too long.
Set-Content -Path "$($env:public.TrimEnd("\"))\GetManagedAccountPasswords" -Value $GetManagedAccountPasswords;

#The Script which will be ran in the new PowerShell Window running as the Farm Account, it also removes the script above which we wrote to the file system
$Script = "
`$Script = Get-Content `"$($env:public.TrimEnd("\"))\GetManagedAccountPasswords`";
PowerShell.exe -Command `$Script;
Remove-Item `"$($env:public.TrimEnd("\"))\GetManagedAccountPasswords`";
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA 0;"

#Runs PowerShell as the Farm Account and loads the Script above
Start-Process -FilePath powershell.exe -Credential $Credential -ArgumentList "-noexit -command $Script" -WorkingDirectory C:\





Monday, April 6, 2015

Create new Host Header Site Collection in a new content database SharePoint 2013

Host-Named Site Collection (HNSC) is actually a means to have a separate DNS for each site collection rather than having all the site collections follow the URL of the web application (path-based site collections). Now you can to have and separate database with PowerShell.

 Download script


Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue
 $webapp = Read-Host "Enter WebApplication URL"
 $dbserver = Read-Host "Enter SQL Server"
 $siteurl = Read-Host "Enter Host Header Site Collection URL"
 $site = Read-Host "Enter Host Header Site Collection Name"
 $language = Read-Host "Enter Language (2074)"
 $dbname = Read-Host "Enter ContentDB name of WebApplication"
 $dbname1 = Read-Host "Enter ContentDB name of HHSC"
 $owner1 = Read-Host "Enter Primary Site Collection Administrator (DOMAIN\UserName)"
 $owner2 = Read-Host "Enter Secondary Site Collection Administrator (DOMAIN\UserName)"
 New-SPContentDatabase -Name $dbname1 -DatabaseServer $dbserver -WebApplication $webapp | out-null
 New-SPSite $siteurl -OwnerAlias $owner1 -SecondaryOwnerAlias $owner2 -ContentDatabase $dbname1 -HostheaderWebApplication $webapp -Name $site -Language $language
 Get-SPContentDatabase -Site $siteUrl | Set-SPContentDatabase -maxSiteCount 1 -WarningSiteCount 0
Write-Host “Site Collection at” $site “has been created in the” $dbname1 “content database” -ForegroundColor Yellow


Create HostA in DNS.
Open IIS Manager, Sites, Edit Bindings on WebApplication, add Site Binding (picture).
Change on all SharePoint servers.
















When you open site in browser choose site template and set up groups for site.

Wednesday, April 1, 2015

Import Google embed map in SharePoint web part


How to Embed Google Maps to a SharePoint?

Google Maps can be embedded onto a Microsoft SharePoint page very easily using a Google Maps and web part.


Open https://maps.google.com


Find location. 

















 




 
Copy link.


























Open SharePoint site, Edit page, Insert, Embed Code.



















Paste link.

Insert.

 
Save.