An entry with the same key already exists in SharePoint 2013

In this post, we will explain how to solve “An entry with the same key already exists” that you may face when creating a new service application in SharePoint 2016 and 2013.

You might also like to read Install and Configure Project Server 2016 step by step


SharePoint 2013: An entry with the same key already exists

In SharePoint and Project Server 2013, I have removed a PWA Instance in Project Server Application Service using Central Administration that has been deleted successfully.

But when I tried to recreate a new one with the same details of the previously deleted instance. I got the below error:

Sorry, something went wrong An entry with the same key already exists.

Sorry, something went wrong An entry with the same key already exists.

Cause

The “Sorry, something went wrong An entry with the same key already exists.” usually occurs because the configuration details of the PWA instance that have been deleted are still stored in Project Server Application Service configuration.

Therefore, you can’t create a new PWA Instance with the same details of the previously deleted instance till removing and clearing the existing orphaned.

Delete orphaned sites sharepoint 2013

In this section, we will show how to delete orphaned sites SharePoint 2013 using PowerShell.

Steps

  • Run SharePoint Management Shell as administrator,
SharePoint 2013 Management Shell
  • Run the below cmdlet to get the Project Server application service details assigned to $serviceapp object.
$serviceapp = get-spserviceapplication | ? {$_.TypeName –like "*Project*"}
  • Call object $serviceapp to list all PWA application services with its related id.
$serviceapp
Get PWA Service ID In Project Server
  • If you have configured more than one PWA application services. In this case, you should get the PWA Application service ID that hosted the deleted PWA instance using the below cmdlet.
$serviceapp = get-spserviceapplication | ? {$_.Id –eq "Service ID"}
  • Define a new object to hold all Site Collections/instances related to Project Server application service.
$pwainst = $serviceapp.Sitecollection
$pwainst
Get PWA Service site collections In Project Server
  • After calling “$pwainst” object, the output should show all instances details within the Project Server application service as shown below.
Remove PWA Instance ORPHANED In Project Server Application Service.

Although I didn’t provision any PWA instances yet, I got instance details, and that means the configuration details of the deleted PWA instance is still stored in the Project Server application service configuration.

  • Copy the Site Id, then paste it to the following command to remove its orphaned.
$siteid = $pwainst | ? {$_.siteId –eq ""}
$siteid
$siteid.Delete()
  • Again, Call “$pwainst” object to ensure that all orphaned has been cleared.
  • Go back to provision a new PWA instance that should be now worked properly.
Provision PWA Instance In Project Server

Applies To
  • SharePoint 2016.
  • SharePoint 2013.
See Also

7 thoughts on “An entry with the same key already exists in SharePoint 2013”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top