Saturday, 22 May 2021

How to start User Profile Service stuck on Starting or Stopping stage

Issue:

Recently, we have requirement to change the farm admin account due to some issue with user. We have changed the user but it broke the User Profile Service. The issue we face is that when we start it, it stuck on Starting. If we try to stop then it stuck on stopping. 

Solution:

So, finally I can across PowerShell script that is working for me that starts & stops user profile and user profile synchronisation service. 

  • To stop the service, run using powershell command for user profile service,

 stsadm -o provisionservice -action stop -servicetype “Microsoft.Office.Server.Administration.UserProfileService, Microsoft.Office.Server.UserProfiles, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” -servicename  

  •   To stop the service, run using powershell command for user profile synchronization service,

 stsadm -o provisionservice -action stop -servicetype “Microsoft.Office.Server.Administration.UserProfileService, Microsoft.Office.Server.UserProfiles, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” -servicename FIMSynchronizationService  

Now to start the service, you just need to change the action parameter to start in above powershell command.

  • To start the service, run using powershell command for user profile service,

 stsadm -o provisionservice -action start -servicetype “Microsoft.Office.Server.Administration.UserProfileService, Microsoft.Office.Server.UserProfiles, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” -servicename  

  • To start the service, run using powershell command for user profile synchronization service,

 stsadm -o provisionservice -action start -servicetype “Microsoft.Office.Server.Administration.UserProfileService, Microsoft.Office.Server.UserProfiles, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” -servicename FIMSynchronizationService  

Reference:

  • http://sharepointhyfy.blogspot.com/2016/04/user-profile-service-stuck-in.html#gsc.tab=0
  • https://social.technet.microsoft.com/wiki/contents/articles/26067.sharepoint-2013-user-profile-stuck-stopping.aspx

Wednesday, 31 March 2021

SharePoint 2019 FBA Set up Full Name Error

Recently we have set up Form based authentication (FBA) in SharePoint 2019 environment. We have configured the FBA with best practice but when we try to login using windows user or FBA user,  we were getting error – “Fullname”. 

Issue:

We faced below error when we try to login using windows user or FBA user:

 


Solution:

We have checked multiple blogs in google and verified that the set up was done using best practice. So, our doubt goes to configuration in web application, and we found out that “Client Integration” settings is responsible for this.

To disable the “Client Integration” settings follow below steps:

  • Go to Central Admin.
  • Click “Manage web application” under “Application Management”


  • Select your web application.


  • Click on “Authentication provider” from Ribbon. 


  • It will show default Zone. Click on that. 


  • Scroll bottom of the authentication provider settings dialog.
  • Click “No” for “Client Integration” Settings. 


  • Click Save.
  • It will take some time and provide below dialog. Click close.

  • Now try to login in web application. You will see the user is able to login successfully.


Sunday, 28 February 2021

How to get the strong name of your assembly by adding an External Tool?

Introduction

Solution

This tip will make it easy for you to get that assembly name right within Visual Studio.

  • In Visual Studio, Go to Tools –>  External Tools.


  • Click on “Add” to add a tool, and put in the following values:
    • Title: Strong Name
    • Command: Powershell.exe
    • Arguments: -command "[System.Reflection.AssemblyName]::GetAssemblyName(\"$(TargetPath)\").FullName"
    • Check “Use Output Window”
    • Uncheck everything else – here’s how it should look -

  


  • Right Click on your solution and Clean Your Project solution.

 


  • Now, Right Click on your solution and build Your Project solution.

 


  • That’s it, now in your project, Visit Tools –> Strong Name, and in the output window, it will give you the assembly name like this –>

 ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e3d610b32dbba675  

 




Please let me know if you face any issues.

Friday, 15 January 2021

SharePoint Permission Matrix

We recently have a client request for SharePoint OOTB Permission Matrix. We thought it would be available easily. But to my surprise, we didn't. Although, Microsoft has put a full page on that but we can't give that to client. 

So I have prepared this matrix comparing things in Microsoft blog. You can find the blog link in reference:

    Permission level
Permission Permission Description View
Only
Limited
Access
Restricted
Read
Read Contribute Edit Approve Design Manage
Hierarchy
Full
Control
List Level
Manage List Create and delete lists, add or remove columns in a list, and add or remove public views of a list.           Yes   Yes Yes Yes
Overrise List Behavior Discard or check in a document that is checked out to another user, and change or override settings that allow users to read/edit only their own items             Yes Yes Yes Yes
Add Items Add items to lists, and add documents to document libraries         Yes Yes Yes Yes Yes Yes
Edit Items Edit items in lists, edit documents in document libraries, and customize Web Part pages in document libraries         Yes Yes Yes Yes Yes Yes
Delete Items Delete items from a list, and documents from a document library.         Yes Yes Yes Yes Yes Yes
View Items View items in lists, and documents in document libraries Yes   Yes Yes Yes Yes Yes Yes Yes Yes
Approve Items Approve a minor version of list items or document.             Yes Yes   Yes
Open Items View the source of documents with server-side file handlers     Yes Yes Yes Yes Yes Yes Yes Yes
View Versions View past versions of a list item or document. Yes     Yes Yes Yes Yes Yes Yes Yes
Delete Versions Delete past versions of list items or documents.         Yes Yes Yes Yes Yes Yes
Create Alerts Create alerts       Yes Yes Yes Yes Yes Yes Yes
View Application Pages View forms, views, and application pages. Enumerate lists Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
                       
Site Permission
Manage Permissions Create and change permission levels on the web site and assign permissions to users and groups                 Yes Yes
View Web Analytics Data View reports on Web site usage                 Yes Yes
Create Subsites Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.                 Yes Yes
Manage Web Site Grants the ability to perform all administration tasks for the web site, as well as manage content                 Yes Yes
Add and Customize Pages Add, change, or delete HTML pages or Web Part pages, and edit the website.               Yes Yes Yes
Apply Themes and Borders Apply a theme or borders to the whole website.               Yes Yes Yes
Apply Style Sheets Apply a style sheet (.css file) to the website.               Yes Yes Yes
Create Groups Create a group of users that can be used anywhere within the site collection                   Yes
Browse Directories Enumerate files and folders in a website by using SharePoint Designer 2013 and Web DAV interfaces         Yes Yes Yes Yes Yes Yes
Use Self-Service Site Creation Create a website using Self-Service Site Creation. Yes     Yes Yes Yes Yes Yes Yes Yes
View Pages View pages in a website Yes   Yes Yes Yes Yes Yes Yes Yes Yes
Enumerate Permissions Enumerate permissions on the website, list, folder, document, or list item                 Yes Yes
Browse User Information View information about users of the website Yes Yes   Yes Yes Yes Yes Yes Yes Yes
Manage Alerts Manage alerts for all users of the website                 Yes Yes
Use Remote Interfaces Use SOAP, Web DAV, the Client Object Model, or SharePoint Designer 2013 interfaces to access the website Yes Yes   Yes Yes Yes Yes Yes Yes Yes
Use Client Integration Features Use features that launch client applications. Without this permission, users must work on documents locally and then upload their changes Yes Yes   Yes Yes Yes Yes Yes Yes Yes
Open Enables users to open a website, list, or folder to access items inside that container Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Edit Personal User Information Enables users to change their own user information, such as adding a picture.         Yes Yes Yes Yes Yes Yes
                       
Personal
Manage Personal Views Create, change, and delete personal views of lists.         Yes Yes Yes Yes Yes Yes
Add/Remove Personal Web Parts Add or remove personal Web Parts on a Web Part page.         Yes Yes Yes Yes Yes Yes
Update Personal Web Parts Update Web Parts to display personalized information         Yes Yes Yes Yes Yes Yes
                       
 

                     

Note: Restricted Read, Approve and Manage Heirarchy Permission are available for Publishing Site only.

Reference:

  • https://docs.microsoft.com/en-us/sharepoint/sites/user-permissions-and-permission-levels


Tuesday, 12 January 2021

Error occurred in deployment step 'Recycle IIS Application Pool': Invalid namespace SharePoint

Issue:

Recently, we were developing a custom webpart for SharePoint 2019 On-Premise. We got below error while deploying the solution:

Error occurred in deployment step 'Recycle IIS Application Pool': Invalid namespace



Analysis:

We have face this issue in past . We thought we are having issue in .Net framework of the project. We tried with reduce the .Net framework to 4.5. But that didn't solve the issue this time. Then we google the issue and found out there were some configuration changes we need to do in the development environment. 


Solution:

We found out that we need to add "IIS 6 WMI Compatibility" feature. Please follow below steps to add the same:


If you are using windows server, go to server manager.  

  • Click on “Add Roles and Feature”

 


  • It will open “add feature” dialog. Click next till you reach “Server Roles”.


  • In that, expand “Web Server (IIS)”






  • In that expand “Management Tools”

 


  • In that expand “IIS 6 Management Compatibility”

 


  • In that, check “IIS 6 WMI Compatibility”, “IIS 6 Metabase Compatibility” & “IIS 6 Management Console” and click Next.

 


Note - In my case the first two were installed. If it is not installed in your side, it will show as not checked.

  • Click Next in feature selection.

 


  • Click Install in confirmation installation screen.

 


  • It will start installing the feature. Wait for the completion.

 


  • Click close once done.

 


  • Restart the visual studio and try to deploy the project and it will deploy successfully. 

 


If you are using Windows operating system machine, then you can follow below steps to install “IIS 6 WMI Compatibility”:

  • Go to Control panel.

 


  • Click on Program.

 


  • Click on “Turn Windows Feature on or Off” (you will require admin rights for this).
  • It will open feature dialog. 
  • Open Internet Information Services.
  • Open Web Management Tools.
  • Open IIS 6.0 Management Compatibility.
  • Click to select the IIS 6 Metabase and IIS 6 configuration compatibility, IIS 6 WMI Compatibility, and IIS 6 Management Console check boxes.

 


  • Click OK.

You can set up this using powershell as well. 

Follow below steps for the same:

  • Open “Windows PowerShell” in administrator mode.
  • You need to first import server manager module. 
  • Then you can run command to run feature. 

PS C:>Import-Module servermanager

PS C:> Add-WindowsFeature Web-WMI

The output will look like below:



Sunday, 6 December 2020

Change SharePoint Online list or library Internal name

 Change SharePoint Online list or library Internal name 

Issue:

Recently we have provided a build and guideline document to our client and by mistake they have set up a library with wrong internal name. In starting it worked well but as the additional functionality added, it broke. As the users have started working on that, we needed to fix the internal name anyway. 

Our library internal name is “TrainingDocuments” and display name is “Training Documents”. While Client has set up “Training Documents”.



Solution: 

Initially we thought it might be not possible. But then we found 2 ways to do it:

Approach 1: Using SharePoint Designer 2013

Follow below steps to fix this using SharePoint Designer 2013:

  1. In SharePoint Designer, Open your site.
  2. Navigate to All Files navigation node (not List and Libraries node),
    Note – you will need “Site Collection Administrator” permission in the site collection to see “All Files” option.
  3. Find your list there
  4. Right-click list
  5. Rename.



Approach 2 : Using PNP PowerShell

In case you are not able to connect the site in the SharePoint designer or you do not have installed in your machine, you can do this using PNP PowerShell as well. 


PowerShell to change Library Name:

 #Set Parameters  
 $SiteURL = "Site URL"  
 $ListName = "Library Internal Name"  
 $NewListURL = "New Library Name"  
 #Connect to PNP Online  
 Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)  
  #this will change URL  
 #Get the List  
 $List= Get-PnPList -Identity $ListName -Includes RootFolder  
 #sharepoint online powershell change list url  
 $List.Rootfolder.MoveTo($NewListURL)  
 Invoke-PnPQuery  
 #this will change library title  
 Set-PnPList -Identity $ListName -Title $NewListURL  


PowerShell to change List Name:

 #Set Parameters  
 $SiteURL = "Site URL"  
 $ListName = "Library Internal Name"  
 $NewListURL = "New Library Name"  
 #Connect to PNP Online  
 Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)  
 Set-PnPList -Identity $ListName -Title $NewListURL  

File server migration to SharePoint online using SPMT PowerShell Part 2

In previous blog we have go through the csv creation part. You can find it on below link:

In this blog, we are going to use that file and SPMT migration PowerShell commands to migrate file server to SharePoint online.

Prerequisite –

SharePoint Migration Tool needs to be installed in the machine

Solution

First, we are going to get credentials for

 Import-Module Microsoft.SharePoint.MigrationTool.PowerShell  
 $Global:SPOUrl = "SharePoint site collection url"  
 $Global:UserName = "username"  
 $Global:PassWord = ConvertTo-SecureString -String "Password" -AsPlainText -Force  
 $Global:SPOCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Global:UserName, $Global:PassWord  

 

After this we will read csv file

 #Load CSV  
 $csvItems = import-csv "C:\Migration\migrationscript.csv" -Header c1,c2,c3,c4,c5,c6  

 

Now we will register migration task. This needs to be done once for all migration task. So we will keep this out of for loop

 Register-SPMTMigration -SPOCredential $Global:SPOCredential -Force -MigrateWithoutRootFolder -PreserveUserPermissionsForFileShare $true  

 

We are passing below two parameters

  1. MigrateWithoutRootFolder – This will not migrate parent folder. Only items withing the given path directory will be migrated. This is not mentioned in the MSDN link, but it is mentioned in the build changes document. This was included in build –  3.4.119.7

  2. PreserveUserPermissionsForFileShare – This parameter is used if you want to migrate file server permission to SharePoint online

 

Now we will loop through csv file and add migration task.

 ForEach ($item in $csvItems)  
 {       
   Write-Host $item.c1  
   Add-SPMTTask -FileShareSource $item.c1 -TargetSiteUrl $item.c4 -TargetList $item.c5 -TargetListRelativePath "/"  
 }  

 

After this we will start migration

 Start-SPMTMigration  

 

The full PowerShell will look like below:

 Import-Module Microsoft.SharePoint.MigrationTool.PowerShell  
 $Global:SPOUrl = "SharePoint site collection url"  
 $Global:UserName = "username"  
 $Global:PassWord = ConvertTo-SecureString -String "Password" -AsPlainText -Force  
 $Global:SPOCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Global:UserName, $Global:PassWord  
 #Load CSV  
 $csvItems = import-csv "C:\Migration\migrationscript.csv" -Header c1,c2,c3,c4,c5,c6  
 Register-SPMTMigration -SPOCredential $Global:SPOCredential -Force -MigrateWithoutRootFolder -PreserveUserPermissionsForFileShare $true  
 ForEach ($item in $csvItems)  
 {  
   Write-Host $item.c1  
   Add-SPMTTask -FileShareSource $item.c1 -TargetSiteUrl $item.c4 -TargetList $item.c5 -TargetListRelativePath "/"  
 }  
 Start-SPMTMigration  

 

Reference –

File server migration to SharePoint online using SPMT PowerShell Part 1

Recently we have a project where we need to migrate file server to SharePoint Online. So, we decided to go with SharePoint Migration Tool (SPMT). But we had 50 plus folders and all were needed to migrate to different sites documents library. As it takes long time to migrate using tool due to creating connection, we decided to use PowerShell version.

 

Issue –

We faced below issues in this requirement:

  1. The documentation for this is not that accurate or in single place. We need to search here and there for things.
  2. SPMT tool migrates file server child items directly but when you use PowerShell, it migrates parent folder. Due to curse of first point, it took some time for us to find the hidden solution. Go through this post to see that hidden gem.
  3. The last but no least is permission migration. SPMT has all this functionality but as I said earlier it is not documented well.

So, we will try to explain all our knowledge in detail here.

 

Solution -

 

First, we need to prepare a csv which will be read by PowerShell and It will have connection details of source and migration.

important notes for preparing csv:

  1. Do not include a header row in your CSV file.
  2. Remember to account for all six columns in the file, even if you are not needing a value for a given field.
  3. If you use the standard out-of-the-box Document library ("Shared Documents"), you must use the Display name "Documents" as the placeholder value for the Target Document Library in your CSV file. If you enter "Shared Documents" in that column, you will receive an "invalid document library" error.

Note - If the language of the destination SharePoint site is other than English, check the Display name of the "Shared Documents" Document library by browsing to Documents library.

The format of csv is as below:

Source,SourceDocLib,SourceSubFolder,TargetWeb,TargetDocLib,TargetSubFolder


As we are migrating from file server, we will not pass the “SourceDocLib” & “SourceSubFolder” details. So, our csv detail will look like below:

File server path,,, TargetWeb,TargetDocLib,TargetSubFolder

For example,

C:\MigrationTests\testfiles,,,https://contoso.sharepoint.com/sites/Sample/,DocLibraryName,DocLibraryName_subfolder

 

In case, you don’t want to migrate it to sub folder, the subfolder part will be blank

File server path,,, TargetWeb,TargetDocLib,

For example,

C:\MigrationTests\testfiles,,,https://contoso.sharepoint.com/sites/Sample/,DocLibraryName,

In next blog we will use this csv in the PowerShell.

Reference:
  1. https://docs.microsoft.com/en-us/sharepointmigration/how-to-format-your-csv-file-for-data-content-migration#:~:text=number%20of%20tasks.-,Using%20a%20comma%20separated%20value%20(CSV)%20file%20for%20data%20content,to%20create%20the%20CSV%20file

The "Mark as Decorative" Feature in SharePoint: A Small Toggle With a Big Accessibility Impact

If you've spent any time building pages in SharePoint Online, you've probably noticed a new checkbox tucked inside the Accessibility...