SharePoint Error: Metadata backend service request ExpectedFailure: Metadata backend service request failed in a authorized access exception: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: AccessDeniedEx:The current user has insufficient permissions to perform this operation.

I got the following error:

Exception returned from back end service. System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: AccessDeniedEx:The current user has insufficient permissions to perform this operation. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.UnauthorizedAccessException: AccessDeniedEx:The current user has insufficient permissions to perform this operation.
at Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication.CheckPermission(SPIisWebServiceApplicationRights requiredPermissions)
at Microsoft.SharePoint.Taxonomy.TaxonomyDatabaseMapper.GetTermSetWithAllTerms(Guid rawPartitionId, Guid termSetGuid, Boolean includeDeprecated, Boolean limitMembership)
at Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication.GetTermSetWithAllTerms(Guid rawPartitionId, Guid termSetGuid, Boolean includeDeprecated, Boolean limitMembership)
at SyncInvokeGetTermSetWithAllTerms(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatche…).

Metadata backend service request ExpectedFailure: Metadata backend service request failed in a authorized access exception: System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: AccessDeniedEx:The current user has insufficient permissions to perform this operation. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.UnauthorizedAccessException: AccessDeniedEx:The current user has insufficient permissions to perform this operation.
at Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication.CheckPermission(SPIisWebServiceApplicationRights requiredPermissions)
at Microsoft.SharePoint.Taxonomy.TaxonomyDatabaseMapper.GetTermSetWithAllTerms(Guid rawPartitionId, Guid termSetGuid, Boolean includeDeprecated, Boolean limitMembership)
at Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication.GetTermSetWithAllTerms(Guid rawPartitionId, Guid termSetGuid, Boolean includeDeprecated, Boolean limitMembership)
at SyncInvokeGetTermSetWithAllTerms(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatche…).

Solution

If you are running your Search Service Application using a different account than the farm account then you need to grant “Full Control” permission the this account on the Managed Metadata Service Application!

SharePoint: Error in ULS and Windows Event Log: Unknown SQL Exception 241 occurred. Additional error information from SQL Server is included below.

Today I did some SharePoint 2016 => 2019 migration tests for a customer.

I set up the new farm weeks ago, but today I saw the following error for the first time in the SharePoint ULS and Windows Event Log:

Entering Monitored Scope (Storage Metrics processing timer job). Parent=Timer Job job-storage-metrics-processing

System.Data.SqlClient.SqlException (0x80131904): Fehler beim Konvertieren einer Zeichenfolge in ein Datum und/oder eine Uhrzeit.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.SharePoint.Utilities.SqlSession.ExecuteNonQuery(SqlCommand command, SqlInfoMessageEventHandler handler) ClientConnectionId:c66450bf-adc7-4fc4-bbcd-e9e2c050a75a Error Number:241,State:1,Class:16

Unknown SQL Exception 241 occurred. Additional error information from SQL Server is included below. Fehler beim Konvertieren einer Zeichenfolge in ein Datum und/oder eine Uhrzeit.

It happens during execution of the SP timer job “Storage Metrics Processing” (technical name: “job-storage-metrics-processing”).

In the “job history” in the Central Administration I could see the affected database. It was one of the migrated database I mounted before to the new SP farm.

Fix

After two hours I found the solution:

In SQL Server the login for the new farm account “sp-farm-new” was set to DEFAULT LANGUAGE = GERMAN.

I changed the DEFAULT LANGUAGE of all accounts to “ENGLISH” and the error was gone.

I checked all SP service accounts of the old farm: They are all set to DEFAULT LANGUAGE = ENGLISH.

Set URL for “New Tab” in Microsoft Edge

In Microsoft Edge the default behaviour of “new tab” is it to open a customizable page with Microsoft Bing and other content. The content can be disabled but there is no way to change the “new tab” page completely.

Here is a PowerShell snippet to do it, tested on Windows Server 2019. Not working on Windows 10 Pro 20H2 / MS Edge 88.

if( (get-item "HKLM:\Software\Policies\Microsoft\Edge" -ea Ignore) -eq $null) {
    New-Item "HKLM:\Software\Policies\Microsoft\Edge"
}

if( (Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Edge" -Name NewTabPageLocation -ea 0) -eq $null ) {
    New-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Edge" -Name NewTabPageLocation -PropertyType String -Value "https://google.de"
} else {
    Set-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Edge" -Name NewTabPageLocation  -Value "https://google.de"
}

Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Edge" -Name NewTabPageLocation 

Update…

It does not work on a machine that is not domain joined. 🙁

Here I found a possible solution for Windows 10:

Fix PowerShell Error: “The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.”

Just as a reminder.

When getting this error:

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

…just add this to your PowerShell script:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

Auto Update VISUAL STUDIO 2019/2017 on Windows

I have some development machines with Visual Studio 2017 and/or 2019 installed. Too many to constantly install updates in.

For a long time I was looking for a solution for this, but I did not find one. Supposedly the automatic update of Visual Studio is not possible.

In the end… I have found a way.

In a nutshell:

  1. Download the latest Visual Studio Installer for the respective version.
  2. Install the VS Installer update.
  3. Use the VS Installer to run the Visual Studio Update.

Look at this:

https://github.com/ikarstein/auto-update-vs

Original “PS2EXE” migrated from MS Technet Gallery to Github

This is more “for the record” than it makes real sense. But why not? For a few years “PS2EXE” was represented on Technet and has over 90.000 downloads to date. That is super great. – Meanwhile there is also a successor, which I didn’t develop, but it seems to be alive. That makes me happy, even if a bit wistful, because I didn’t manage to stay on the ball with this little project.

So here is the link: https://github.com/ikarstein/ps2exe

SharePoint 2013 Error: An error occurred during the compilation of the requested file, or one of its dependencies.

I have had this exception on SharePoint 2013 pages on several servers after they are running a for one or two days:

“An error occurred during the compilation of the requested file, or one of its dependencies.”

In the Windows Event Log -> Application I found this error:

sperror20161108-1

There are two possible reasons (maybe there are more 😉 ):

    1. There was .NET Framework 4.6.x installed but was removed in order to “fix” the SharePoint 2013 setup failure message.

      In this case you need to re-install .NET Framework 4.6.x after SharePoint 2013 setup. SharePoint 2013 is fully supported with 4.6.x!

       

    2. If the server is under heavy load and there are lots of processes startet in the Windows OS, then the “Desktop Heap” could be out of memory.

      In this case you need to increase the Desktop Heap size of the “Inactive Windows Desktop”.

      1. Open the Windows registry and navigate to HKLM\System\CurrentControlSet\Control\SessionManager\SubSystems
      2. Open Property “Windows”
      3. Copy the complete content …
      4. … into Notepad
      5. Change the 3rd value of the “SharedSection” part to 20480.
      6. Copy the whole string back into the registry property “Windows”
      7. Reboot your server

      sperror20161108-2

      This will increase the Dektop Heap to 20MB for the inactive desktops.
      Links:

      https://blogs.msdn.microsoft.com/winsdk/2015/06/03/what-is-up-with-the-application-failed-to-initialize-properly-0xc0000142-error/
      https://support.microsoft.com/en-us/kb/126962
      https://blogs.msdn.microsoft.com/ntdebugging/2007/01/04/desktop-heap-overview/

 

SharePoint 2013: Error in “Products Configuration Wizard” after Update to SP1

Today I got an error on my development farm after I updated SP 2013 to SP1 level. I also removed Visual Studio 2012 from the box and installed Visual Studio 2013.

In fact I did the SP1 update as last step.

Than I tried to run the “SharePoint 2013 Products Configuration Wizard” and got this error in the first update step (“Initializing…”):

image

One ore more typed failed to load.

I was pretty sure this error was caused by the Visual Studio “update”

image

Could not load file or assembly ‘Microsoft.Data.Edm, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies.

image

Could not load file or assembly ‘Microsoft.Data.OData, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies.

After some research I found this two components belong to “WCF Data Services 5.0 for OData V3”.

I downloaded the package from http://www.microsoft.com/en-us/download/details.aspx?id=29306 and installed it on my SharePoint dev box.

After that the “Products Configuration Wizard” worked as expected.

Troubleshooting: Cannot access Managed Metadata Service Application in SharePoint 2013

In the last couple of months I got several times the following error:

The Managed Metadata Service Application was not accessible in the Central Administration.

 

image

I checked all know issues of missing security settings of the service application and in the database. – Everything as expected.

Some days before it worked like a charm.

In one case I saw the problem appear after deploying the (new) Service Pack 1.

In the ULS is this error:

image

Failed to get term store for proxy ‘Managed Metadata Service Application’. Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at Microsoft.SharePoint.Taxonomy.Internal.XmlDataReader.GetDateTime(String name)
at Microsoft.SharePoint.Taxonomy.Internal.SharedTermStore.Initialize(IDataReader dataReader, Guid termStoreIdValue, Boolean fromPersistedData)
at Microsoft.SharePoint.Taxonomy.Internal.SharedTermStore..ctor(IDataReader dataReader, Guid termStoreId, Boolean fromPersistedData)
at Microsoft.SharePoint.Taxonomy.Internal.DataAccessManager.GetTermStoreData(MetadataWebServiceApplicationProxy sharedServiceProxy, Boolean& partitionCreated)

Searching the internet I found no solution but exactly the same error, e.g:

http://sharepoint-community.net/forum/topics/failed-to-get-term-store-for-proxy-managed-metadata-service

I tried lots of suggested approaches, e.g. to re-create the service application using the old database. Nothing worked for me.

Finally I tried the following and it solved the issue without loosing data.

1. Check and note all settings of the service application, especially security and properties (Hub Url, etc.)

2. Backup the service application using PowerShell and cmdlet Backup-SPFarm:

Add-PSSnapin “Microsoft.SharePoint.PowerShell” -ea 0

backup-spfarm -BackupMethod full -Directory \\kcdevsqlexch1\backup\SvcApp -item “Farm\Shared Services\Shared Services Applications\Managed Metadata Service Application” -verbose

backup-spfarm -BackupMethod full -Directory \\kcdevsqlexch1\backup\SvcAppProxy -item “Farm\Shared Services\Shared Services Proxies\Managed Metadata Service Application” -verbose

You can  get the “item” path from command:

Backup-SPFarm -ShowTree

image

The names maybe different on your system.

You need to create a network share for the backup data.

3. After that I deleted the service application using the Central Administration. Including the database.

4. Now I run the restore commands in PowerShell:

Restore-SPFarm -Directory \\kcdevsqlexch1\backup\SvcApp -RestoreMethod New  -Verbose

Restore-SPFarm -Directory \\kcdevsqlexch1\backup\SvcAppProxy -RestoreMethod New  -Verbose

5. The next thing was to add the restored service application to the service application proxy groups, in my case only the “Default” proxy group.

image

6. The last step was to check security settings and service application properties. In my case I had to restore the settings and security manually.

That’s it. Managed Metadata Service Application working again. No data lost.

If you want to follow these steps make sure you have tested everything yourself. Make database backups. Note all settings. As always you do it on your own risk!

Get Rid of Orphaned Content Types in SharePoint 2013

One of my customers has a SharePoint 2013 farm with content migrated from SharePoint 2010.

In the past on SharePoint 2010 they have had the Microsoft SQL Server 2008 R2 Reporting Services-Add-In for SharePoint enabled on some sites. Because they did not need it any more they removed it from SharePoint but without deactivating the Report Server feature on each site collection.

Now on SharePoint 2013 this lead to problems with 3 orphaned content types:

  • Report Builder Model
  • Report Builder Report
  • Report Data Source

First I tried to remove the corresponding feature “ReportServer” with ID e8389ec7-70fd-4179-a1c4-6fcb4342d7a0 from the site:

clip_image001

Get-SPFeature : Cannot find an Enabled Feature object with Id: e8389ec7-70fd-4179-a1c4-6fcb4342d7a0 in scope Site Url: https://sp2013.kc-dev.com/sites/reportingservices.

 

Than I tried to remove the content types manually using the web GUI and PowerShell. I got this errors:

clip_image002

and

clip_image003

Same message: “The content type “Report Builder Model” is part of an application feature.”

 

After reading some articles I found two propesed ways:

At last I found another way to get rid of the orphaned site collections.

In the following demo I use the content types of the Microsoft SQL Server 2008 R2 Reporting Services SharePoint Addon. I installed it on a SharePoint 2010 platform and created a site collection “https://sp2010.kc-dev.com/sites/reportingservices” in a seperate content database.

Than I migrated this content database to SharePoint 2013 including site collection upgrade. – New URL: https://sp2013.kc-dev.com/sites/reportingservices

Than I checked the usage of the content types using the static method GetUsage of Microsoft.SharePoint.SPContentTypeUsage.

clip_image004

In my case all 3 content types are used in a single list. It is necessary to remove each usage of each content type!! – In my case I deleted the list. After deletation it need to be removed from the recycle bin too!

clip_image005

… and also from the site collection recycle bin!

clip_image006

Now my site collection is clean. No results when checking the usage again:

clip_image007

After that I created a new folder in the FEATURES sub folder in the SharePoint hive:

image

Than I created the following script to create a dummy feature inside this folder. The dummy feature uses EXACLTY the same feature Id as the missing feature containing the orphaned content types.

clip_image009

Note #1: The feature ID is the same as for the original Reporting Services feature!

Note #2: For this content types it is necessary to remove the XmlDocuments tag and ist content. Otherwise the next step will fail.

With that script I took the cotnent type XML out of SharePoint into a elements.xml file.

Than I was able to install the feature using PowerShell:

clip_image010

At this point the missing feature is back in SharePoint. The system now will not moan if I deactivate the feature.

BEFORE deactivating I made a screenshot of the site content types page:

clip_image011

After this command…

clip_image012

… the site content types page looks like this:

clip_image013

The orphaned content types are gone!

Note: Maybe you get an error during deactivation saying the feature is not active at the scope. In this case you need to activate the feature first and deactivate it afterwards!

The last step is to remove the dummy feature:

clip_image014

That’s it.

Here you download the script if you like: http://bit.ly/OCToWx