Mar 2, 2013

Sign in as different user in SharePoint 2013

In all the versions of SharePoint, we have option for signing in as different user which helps us in various scenarios. Also, it helps in testing purposes.
But in SharePoint 2013, we do not have this option. 

In this article we will know how to achieve this:

1. When you log in to a SharePoint site, you don't have sign in as different user option which is shown as below:

2. To overcome this limitation either we have to sign in to the IE as different user and then we can log in to the SharePoint site as different user.
3. To achieve this in SharePoint (which is like option in older versions of SharePoint), we need to modify the welcome.ascx which is present in the 15 hive of SharePoint server.
4. Navigate to the below path and find the welcom.ascx file.
C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\CONTROLTEMPLATES
5. Open the file in the visual studio or in the notepad and add the following code above the tag which has ID_RequestAcess as shown below:

<SharePoint:MenuItemTemplate runat="server" ID="ID_LoginAsDifferentUser" Text="<%$Resources:wss,personalactions_loginasdifferentuser%>"
Description="<%$Resources:wss,personalactions_loginasdifferentuserdescription%>"
MenuGroupId="100"
Sequence="100"
UseShortId="true"
/>

 6. Save the file and now refresh the site, you will see the SharePoint page with option "Sign in as different user" option as shown below:


 Hope this helps you. Please free to comment. It helps me to write more.

Snipping Tool in Windows Server 2012

Snipping tool is very nice tool for capturing the screens which comes with latest versions of Windows. In this article lets see how to enable the snipping tool in Windows Server 2012.

Snipping tool is not installed in the default installation of Windows OS. We have to enable it manually.

Steps:
1. Go to Server Manager -> Manage Features -> Features -> Select DESKTOP EXPERIENCE under user interfaces and infrastructure -> Next -> Feature will be installed and it will ask for restarting the server.
2. Restart the server and log in to the server. Under Windows accessories you will see the Snipping tool installed.
Screenshots for reference:




Hope this helps you!

Feb 26, 2013

Jan 7, 2013

The feature being activated is a Site scoped feature which has a dependency on a Site Collection scoped feature which has not been activated. Please activate the following feature before trying again: SharePoint Server Publishing Infrastructure f6924d36-2fa8-4f0b-b16d-06b7250180fa

Some times while activating the Publishing feature in SharePoint through the options in Site Settings we will get this error:
The feature being activated is a Site scoped feature which has a dependency on a Site Collection scoped feature which has not been activated. Please activate the following feature before trying again: SharePoint Server Publishing Infrastructure f6924d36-2fa8-4f0b-b16d-06b7250180fa

Reason:
The reason being the "SharePoint Server Publishing Infrastructure" feature has to be enabled at SITE COLLECTION level, then it has to be activated at SITE LEVEL enable the feature. So that we can create Publishing pages in SharePoint.

Solution:
It can be done in many ways (2 ways mentioned below):
1. We can use the Site Settings -> Site Collection Administration -> Site Collection Features to enable this feature.
2. Then Site Settings -> Site Administration -> Site Features -> Enable this feature.
3. We can also achieve this using STSADM command as shown below:
STSADM.EXE -o deactivatefeature -id f6924d36-2fa8-4f0b-b16d-06b7250180fa -url "http://SiteURLHere/" -force
Then,
STSADM.EXE -o activatefeature -id f6924d36-2fa8-4f0b-b16d-06b7250180fa -url "SiteURLHere" -force
Hope this helps you!

Export SharePoint Group to Excel using PowerShell

$siteUrl="SiteURLHere"
$groupName="GroupNametoExport"
$Output = @("GroupName|Name|Login|Email|Department|Title")
$web = Get-SPWeb $siteUrl
$site = $web.Site
$rootWeb = $site.RootWeb
$UserList = $rootWeb.Lists["User Information List"]
$web.SiteGroups[$groupName].Users|%{$user = $UserList.GetItemById($_.ID)
if($user -ne $null)
{
$JobTitle = $user["JobTitle"]
$Department = $user["Department"]
}
$Output += ($groupName+"|"+$_.Name+"|"+$_.UserLogin+"|"+$_.Email+"|"+$ Department +"|"+$JobTitle)
}
$rootWeb.Dispose()
$web.Dispose()
$site.Dispose()
$Output > "D:\MembersExport.csv"

Import Excel to SharePoint List using PowerShell

# Import the .csv file, and specify manually the headers, without column name in the file 
$contents = Import-CSV ‘C:\Input.csv' -header("Employee ID", "Employee Name")
# Web URL
$webURL = “SITEURL here”
$web = Get-SPWeb -Identity $webURL
$listName = "ListNameHere"
$list= $web.Lists["$listName"] 
# Iterate for each list column
foreach ($row in $contents )
{
    $item = $list.Items.Add();
    $item["Employee ID"] = $row.GroupName
    $item["Employee Name"] = $row.Permissions
    $item.Update()
}
Write-Host -ForegroundColor green "List Updated Successfully"
$web.Dispose()

Jan 6, 2013

Import Users from Excel to SharePoint using PowerShell

# Import the .csv file, and specify manually the headers, without column name in the file 
$userList=IMPORT-CSV C:\UserToUpload.csv -header("GroupName","UserName")

#Get the site name to the variable
$web = Get-SPWeb SiteURLHere

foreach ($user in $userList)
{
$groupName = $web.SiteGroups[$userList.group]
$user = $web.Site.RootWeb.EnsureUser($userList.user)
$groupName.AddUser($user)
}
Write-Host -ForegroundColor green "Users Added Successfully"
}
$Web.Dispose()

Add Users to SharePoint Group using PowerShell

#Get the site name to the variable
$web = Get-SPWeb SitURLHere
#Get the group name to the variable
$groupName = $web.SiteGroups["Group Name Here"]
#Assign user to variable
$user = $web.Site.RootWeb.EnsureUser(“User ID Here”)
#Add user to group 
$groupName.AddUser($user)
Write-Host -ForegroundColor green "User Added Successfully";