Monday, March 7, 2016

Add list of users to SharePoint group using powershell


After migrating SharePoint 2010 site to SharePoint 2013 the user permission is not working as in 2010. The users are getting access denied message. This is due to SharePoint 2013 use the claim based authentication mechanism. As a quick fix I wrote a power shell script to add users to a SharePoint group.

Store the users in a text file as bellow format:
i:0#.w|domain\username

Use the bellow script to add permission:


 $loc = Get-Location;  
 $Users = Get-Content "$loc\Users\Users.txt";      
 foreach ($User in $Users) {       
 write-host($User);  
 Set-SPUser -Identity $User -Web "http://shpapp:2000/sites/TaskApproval/" -Group " Task Confirmation Users";       
 }  

Friday, March 4, 2016

Site collection feature not visible when upgrade solution from SP 2010 to SP 2013


I migrated a SharePoint 2010 site to SharePoint 2013 farm. And crated a custom web part and deployed to the 2013 environment as usual PowerShell commands.

The commands as follows:


After deploying the wsp to a web application the feature was not visible in the site collection features page.

The issue is due to the migrated site is comes with the 2010 user experience. Once the wsp is deployed using the above command the feature goes to 15 hive which cannot be display in a 2010 user experience site.

Resolution
I have tried below 2 options both worked: 
  1. Change the user experience to SP 2013 UI by following 'Start now' link at the top of the site.



After changing the user experience you can see the feature in the site collection features page.
If the user does not like to change the UI layout this option is not going to work out.

2. You can follow bellow commands to deploy the wsp:

This command is adding the feature to the 14 hive features directory, this will be displaying in the site collection features page.