No two choices should have the same ID

Add from existing site columns results in error. Looking up the Correlation ID in the ULS Logs gave a clue of “System.ArgumentException: No two choices should have the same ID.” You know, Microsoft, it would help to know what ID that was. But I guess that would deny me the fun of looking for it. I tried the advice given by Lars Lynch, but the SharePoint Manager didn’t allow me to sort the field’s information, so didn’t really help me.

Using PowerShell, I got a listing of all the fields, their ID’s and their Internal Names:

$web = Get-SPWeb https://webapp/sites/SITE/WEB 
foreach ($field in $web.Fields){ 
 write-output "$($field.Group) | $($field.Title) | $($field.Id) | $($field.InternalName)" 
}
$web.Dispose() 

This gave me a list I could sort in excel (after some manipulation) to try and find duplicates. Unfortunately that didn’t work. So I starting comparing the list it gave me to the one on the site columns page (_layouts/mngfield.aspx).

There I discovered a field listed twice on the site columns page, but only once in my list (note: the list output shown is the unsorted view):

After ensuring the field wasn’t used anywhere, I modified my script to remove the field:

$findGUID = "75af1e7d-ad81-4566-9edd-a582b2a7de13" 
$web = Get-SPWeb https://webapp/sites/SITE/WEB 
foreach ($field in $web.Fields){ 
 if($field.Id -eq $findGUID){
 write-output "$($field.Group) | $($field.Title) | $($field.Id) | $($field.InternalName)"
 $field.Allowdeletion = $true
 $field.Sealed = $false
 $field.Delete()
 Break
 }
}
$web.Dispose() 

The two instances of the field were removed from the site and I was able to “Add from existing site columns” again without error.

Advertisements

5 Responses to No two choices should have the same ID

  1. Anonymous says:

    Thank you so much!! This was incredibly helpful.

  2. Thank you. My problem was solved. I’ve just deleted the field and it’s possible to add a column type.

  3. Anonymous says:

    Hi,

    I’m having the same issue, but when I try to delete the site column with your PowerShell script I’m having an error:

    “Exception calling “Delete” with “0” argument(s): “Site columns which are included in content types or on lists cannot be deleted. Please remove all instances of this site column prior to deleting it.”

    I already ensure that there’s no remaining references with this other script https://vintentou.wordpress.com/2012/05/01/site-columns-which-are-included-in-content-types-or-on-lists-cannot-be-deleted/

    But is still the same error, I’m not able to delete this site column. Do you know how can I do it?

    Best regards.

  4. JaviCartin says:

    Is there a script in order to know if a column is being use in any library of the site?

  5. Viral Naik says:

    Thank you so much 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: