Log on as different user in Sharepoint 2013

12/03/2015 14:54

Add following string to your site collection url in address bar or add it manually to global navigation


_layouts/closeConnection.aspx?loginasanotheruser=true


you can also use script to add the link to global navigation


Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

$webUrl = "https://devapps.millennium.sk/sites/powerforms4";

$nodeName = "Login as a different user"
$nodeUrl = $webUrl + "/_layouts/closeConnection.aspx?loginasanotheruser=true"
$web = Get-SPWeb $webUrl

$node = $web.Navigation.TopNavigationBar
$item = $node'where-object {$_.Title -eq $nodeName}
                   
                   
#create new link in Global Navigation, if doesn't exist
if($item)
{
    "Link '{0}' already exists in Global Navigation on '{1}'." -f $nodeName, $webUrl
}
else
{
    "There is no '{0}' link in Global Navigation Menu. Creating..." -f  $nodeName
    $newNode = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode($nodeName, $nodeUrl)
    $web.Navigation.TopNavigationBar.AddAsLast($newNode)
          
    "Link '{0}' was succesfuly added to Global Navigation on '{1}'." -f $nodeName, $webUrl
}
 
$web.dispose()