Total Pageviews

Showing posts with label SharePoint 2016. Show all posts
Showing posts with label SharePoint 2016. Show all posts

18 Jul 2018

SharePoint 2016 Restore User that was deleted from User Information List

There could be a scenario when the user was deleted both in AD and the User Information List and we need to restore it. That could be necessary when there was a custom solution developed that relies on the user accounts to exist in SharePoint. Needless to say these solutions were developed incorrectly, but who am I to judge.

For these rare cases, here is the way that to restore the deleted user. This worked for me in SharePoint 2016, but it might also work in 2013 and 2019.

Disclaimer: Any direct modifications to the SharePoint SQL databases are not supported by Microsoft. Restore the user by following approach only if you know for sure what you are doing.

1. First of all - determine an ID of the deleted user:


2. In SQL Management Studio - find your content database and navigate to the UserInfo table. Verify that deleted user is still listed in the table. Notice that tp_Deleted will equal to the user ID and tp_IsActive will be equal to 0:


3. Modify a row where tp_id is equal to the user's ID:
 a) set tp_Deleted to 0
 b) set tp_IsActive to True
 c) Save changes to the row


4. For the appropriate content database, run the following command to find deleted user in the  AllUserData table:
  
  SELECT * FROM [WSS_Content].[dbo].[AllUserData] 
  Where bit3 = 1 and tp_ID = User_ID

Make sure this command returned a single row. If there was a single row - proceed to restoring the user:

5. To restore the user, we need to change bit3 column's value from 1 to 0 :
 
 
 UPDATE [WSS_Content].[dbo].[AllUserData] 
 SET bit3 = 0 
 Where bit3 = 1 and tp_ID = User_ID


Done! Now go ahead and click on the deleted user. Verify that there is no error.

27 Jun 2018

Maintenance Mode in SharePoint Online and Modern pages

Turns out, if you append ?maintenancemode=true of your SharePoint page you will see a special maintenance view:



On your page, you will see a summary of data from the Manifest and Data tabs. The summary information includes:
Alias
The name of the web part
Id
The unique ID of the web part
Instance Id
The ID of a specific instance of a web part (that is, if you have two more of the same web parts on a page, they will each have the same web part ID, but a different instance ID.
IsInternal
Indicates whether the web part was made by Microsoft or a third party. If True, it is made by Microsoft. If False, it is made by a third party.
Version
The version number of the web part.
Environment
Environment: Indicates the SharePoint environment in use.
  • 0 = Test environment
  • 1 = Local Workbench
  • 2 = SharePoint
  • 3 = Classic SharePoint
UserAgent
A string that contains information about the device and software in use (such as browser type and version).


Microsoft article "Open and use the web part maintenance page"

22 Jun 2018

Determine if SharePoint has enough memory allocated to the distributed cache service

After reading half a dozen articles explaining how to eyeball and calculate the distributed cache size I was wondering: Why no one suggests just to check the current consumption before changing anything? Here is a scary thought: What if we have a ton of memory and we don't need to add any more? I know, this sounds revolutionary.

This is a quick script that I've slapped together to show 1) maximum allocated memory for  the Distributed cache. 2) current usage for all AppFabric caches on the current server.

So, before bumping the Distributed cache, test the current consumption with the script below.


###### DETERMINE IF YOU HAVE ENOUGH MEMORY ALLOCATED TO DISTRIBUTED CACHE:
Add-PSSnapin Microsoft.SharePoint.Powershell
Use-CacheCluster
$hostname = hostname
$configuration = Get-AFCacheHostConfiguration -ComputerName $hostname -CachePort "22233"
Write-host Maximum Size: $($configuration.size)MB HostName: $($configuration.HostName) -ForegroundColor Blue
# Get-AFCache | % {Get-AFCacheConfiguration -CacheName $_.CacheName}
$caches = Get-AFCache | % {Get-AFCacheConfiguration -CacheName $_.CacheName}

 foreach($cache in $caches){
  $stats = Get-AFCacheStatistics $cache.CacheName
  Write-host $cache.CacheName -ForegroundColor Green Cache.
  Write-host Usage: $($stats.Size / 1MB) MB
  Write-host
 }

###### DETERMINE IF YOU HAVE ENOUGH MEMORY ALLOCATED TO DISTRIBUTED CACHE END

Here is the sample result:


22 Oct 2016

The Best Way to Develop SharePoint Client Side Applications

 

Please, read these articles by Andrew Koltyakov.

He explains in great detail how to properly develop client side solutions using tools like node, gulp, Visual Studio Code with SharePoint

11 Oct 2016

Stefan Goßner: PSCONFIGUI.EXE vs PSCONFIG.EXE

Nice article: Why I prefer PSCONFIGUI.EXE over PSCONFIG.EXE by Stefan Goßner

In case you need to use PSCONFIG.EXE to automate some tasks you should use the following command:

PSConfig.exe -cmd upgrade -inplace b2b -wait -cmd applicationcontent -install -cmd installfeatures -cmd secureresources -cmd services -install