Good idea ...
using (SPSite site = new SPSite("http://intranet-live"))
{
using (SPWeb web = site.OpenWeb())
{
List<SPField> fieldCollection = new List<SPField>();
foreach (SPField field in web.Fields)
{
bool exists = false;
foreach (SPField tempField in fieldCollection)
{
if (tempField.Id == field.Id)
{
exists = true;
break;
}
}
if (!exists)
{
fieldCollection.Add(field);
//Console.WriteLine("ADDING: " + field.Id.ToString() + " " + field.Title);
}
else
{
Console.WriteLine("EXISTS: " + field.Id.ToString() + " " + field.Title);
}
}
}
}
But.......there is no conflicting IDs...the ELSE statement is never called. :(
I'll keep digging...for the time being I still can't find what the problem is.
________________________________
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ishai Sagi [EMAIL
PROTECTED]
Sent: Wednesday, 17 September 2008 9:45 AM
To: [email protected]
Subject: [OzMOSS] RE: Error on Adding Content Types to List
Hmmm. Dump it to excel?
Personally, I’d just write a bit of code to report to me on screen the ID of
each site column.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tommy Segoro
Sent: Wednesday, 17 September 2008 11:36 AM
To: [email protected]
Subject: [OzMOSS] RE: Error on Adding Content Types to List
Yeh I think that's the best way...on oh..I have to be able to translate this
HTML here :)
<input id="ctl00_PlaceHolderMain_ctl00_Picker"
name="ctl00$PlaceHolderMain$ctl00$Picker" type="hidden" value></input><input
id="ctl00_PlaceHolderMain_ctl00_Picker_data"
name="ctl00$PlaceHolderMain$ctl00$Picker$data" type="hidden"
value="d2311440-1ed6-46ea-b46d-daa643dc3886|t%
Complete|tNone<br><br>Group: Core Task and Issue Columns|tAll
Groups|t90fd652f-9c20-4d41-9cfb-16367e81347c|tAccess
Url|tNone<br><br>Group: Microsoft Office InfoPath|tAll
Groups|t909d03da-7464-44e5-a595-6c27ed054607|tAccount
Name|tNone<br><br>Group: Microsoft Office InfoPath|tAll
Groups|t985c5183-664b-4168-a2d4-5cf08a96fe33|tAccount
Name|tNone<br><br>Group: Microsoft Office InfoPath|tAll
Groups|tb0b3407e-1c33-40ed-a37c-2430b7a5d081|tActual
Work|tNone<br><br>Group: Core Task and Issue Columns|tAll
Groups|tfc2e188e-ba91-48c9-9dd3-16431afddd50|tAddress|tNone<br><br>Group:
Core Contact and Calendar Columns|tAll
Groups|te6b3d512-2e64-41e9-a6b5-0300c2bd13f9|tAlternative Document
ID|tNone<br><br>Group: CP Mining|tAll
Groups|t9d76802c-13c4-484a-9872-d7f9641c4672|tAnniversary|tNone<br><br>Group:
Core Contact and Calendar Columns|tAll
Groups|t6df9bd52-550e-4a30-bc31-a4366832a87e|tAppend-Only
Comments|tNone<br><br>Group: Base Columns|tAll
Groups|t71316cea-40a0-49f3-8659-f0cefdbdbd4f|tArticle
Date|tNone<br><br>Group: Publishing Columns|tAll
Groups|t53101f38-dd2e-458c-b245-0c236cc13d1a|tAssigned
To|tNone<br><br>Group: Core Task and Issue Columns|tAll
Groups|t2aea194d-e399-4f05-95af-94f87b1f2687|tAssistant's
Name|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|tf55de332-074e-4e71-a71a-b90abfad51ae|tAssistant's
Phone|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|t246d0907-637c-46b7-9aa0-0bb914daa832|tAuthor|tThe primary
author<br><br>Group: Core Document Columns|tAll
Groups|t96226eed-ec6f-4f0e-add5-9cfe66a441a0|tAuto Update|tWhether to fetch the
backend data every time<br><br>Group: Key Performance
Indicators|tAll Groups|t4f03f66b-fb1e-4ed2-ab8e-f6ed3fe14844|tBilling
Information|tNone<br><br>Group: Core Task and Issue Columns|tAll
Groups|tc4c7d925-bc1b-4f37-826d-ac49b4fb1bc1|tBirthday|tNone<br><br>Group:
Core Contact and Calendar Columns|tAll
Groups|tfd630629-c165-4513-b43c-fdb16b86a14d|tBusiness
Phone|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|t6547d03a-76d3-4d74-9d34-f51b837c0879|tBusiness Phone
2|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|t5da08e1c-36ea-4e95-9a6b-cc21ef563cf5|tBusiness Process
Code|tNone<br><br>Group: CP Mining|tAll
Groups|tabf2896c-3324-458b-a968-7c4d36629811|tBusiness Process
Owner|tNone<br><br>Group: CP Mining|tAll
Groups|tcbf32d36-3c98-4b3e-a799-f4d2f24d4287|tBusiness Process
Parent|tNone<br><br>Group: CP Mining|tAll
Groups|td3429cc9-adc4-439b-84a8-5679070f84cb|tByline|tNone<br><br>Group:
Page Layout Columns|tAll
Groups|t344e9657-b17f-4344-a834-ff7c056bcc5e|tCallback
Number|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|t92a011a9-fd1b-42e0-b6fa-afcfee1928fa|tCar
Phone|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|t9ebcd900-9d05-46c8-8f4d-e46e87328844|tCategories|tNone<br><br>Group:
Base Columns|tAll
Groups|t0fc9cace-c5c2-465d-ae88-b67f2964ca93|tCategory|tNone<br><br>Group:
Core Document Columns|tAll
Groups|t3525861c-2b8f-44c7-9ac5-2447a44dbc8e|tCategory
Code|tNone<br><br>Group: CP Mining|tAll
Groups|t58cac861-5c52-4c0d-9f4f-3e89b6f46adc|tCategory
Name|tNone<br><br>Group: CP Mining|tAll
Groups|t46066c21-35bb-4831-982c-dcba294b7001|tCEO Message|tPlease enter in the
message from the CEO<br><br>Group: CP Mining|tAll
Groups|t6440b402-8ec5-4d7a-83f4-afccb556b5cc|tChildren's
Names|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|t6ca7bd7f-b490-402e-af1b-2813cf087b1e|tCity|tNone<br><br>Group:
Core Contact and Calendar Columns|tAll
Groups|t52578fc3-1f01-4f4d-b016-94ccbcf428cf|tComments|tA summary of this
resource<br><br>Group: Core Document Columns|tAll
Groups|t038d1503-4629-40f6-adaf-b47d1ab2d4fe|tCompany|tNone<br><br>Group:
Core Contact and Calendar Columns|tAll
Groups|t27cb1283-bda2-4ae8-bcff-71725b674dbb|tCompany Main
Phone|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|t034aae88-6e9a-4e41-bc8a-09b6c15fcdf4|tCompany
Phonetic|tNone<br><br>Group: Extended Columns|tAll
Groups|t86a78395-c8ad-429e-abff-be09417b523e|tComputer Network
Name|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|taea1a4dd-0f19-417d-8721-95a1d28762ab|tContact|tNone<br><br>Group:
Publishing Columns|tAll Groups|tc79dba91-e60b-400e-973d-c6d06f192720|tContact
E-Mail Address|tNone<br><br>Group: Publishing Columns|tAll
Groups|t7546ad0d-6c33-4501-b470-fb3003ca14ba|tContact
Name|tNone<br><br>Group: Publishing Columns|tAll
Groups|t1020c8a0-837a-4f1b-baa1-e35aff6da169|tContact
Photo|tNone<br><br>Group: Core Contact and Calendar Columns|tAll
Groups|tdc47d55f-9bf9-494a-8d5b-e619214dd19a|tContact
Picture|tNone<br><br>Group: Publishing Columns|tAll
Groups|t370b7779-0344-4b9f-8f2d-dc1c62eae801|tContributor|tOne or more people
or organizations that contributed to this resource<br><br>Group:
Core Document Columns|tAll
Groups|t3f3a5c85-9d5a-4663-b925-8b68a678ea3a|tCountry/Region|tNone<br><br>Group:
Core Contact and Calendar Columns|tAll
Groups|t3b1d59c0-26b1-4de6-abbd-3edb4e2c6eca|tCoverage|tThe extent or
scope<br><br>Group: Core Document Columns|tAll
Groups|t05b35b6e-d276-49cb-858e-bedc4a51b9a7|tCPM
Department|tNone<br><br>Group: CP Mining|tAll
Groups|tb81fb0ca-05a3-4efa-9d83-dd40523e2f2a|tCPM
Revision|tNone<br><br>Group: CITIC Pacific Mining Content
Types|tAll Groups|te112177f-b36e-4588-9d01-8f3037013413|tCurrent
Status|tNone< ...................................
Above is the HTML that is spit out by the picker control....and I have to find
GUI that is conflicting :)
But that's ok if I can resolve this I'll let you know...coz there is no
documentation at all in Google.
Thanks very much for your help people especially you Ishai...appreciate the
immediate response. Thanks mate.
Tommy
________________________________
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ishai Sagi [EMAIL
PROTECTED]
Sent: Wednesday, 17 September 2008 9:31 AM
To: [email protected]
Subject: [OzMOSS] RE: Error on Adding Content Types to List
This is what I am saying – there are two site columns already created with
conflicting Ids. The picker crashes when you try to select a site column.
Note- you are not “creating a site column in a list level” – you are opening a
picker (like you said) to select from the existing ones.
I wonder – can you check the columns to see where the conflicting Ids are and
delete them?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tommy Segoro
Sent: Wednesday, 17 September 2008 11:25 AM
To: [email protected]
Subject: [OzMOSS] RE: Error on Adding Content Types to List
This is what I'm confused. I can create a new site column on the master site
level but not on a list level.
On site level, it works beautifully but when I tried on a list, it returned me
with that error.
I told you something more scary: NOT EVEN ONE list throughout the site (in
root, sub site, etc etc etc) will allow you to add a new column ANY list
anymore (not just the custom list, but even the OOTB list will return the same
error) :( :( :(
My guess is, it's an error with the field picker control. Don't you think?
This is the first time I'm getting this error. I mean if it's a backup, how can
it happen in Prod while Prod has always been the actual Sharepoint site and has
never been restored from?
I can't find any answers in Google...
________________________________
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ishai Sagi [EMAIL
PROTECTED]
Sent: Wednesday, 17 September 2008 9:15 AM
To: [email protected]
Subject: [OzMOSS] RE: Error on Adding Content Types to List
I wonder...I can’t see any documentation to
“Microsoft.SharePoint.ApplicationPages.ChoiceComparerWithDefaultGroup” and that
does not exist in Reflector, and nothing under
“Microsoft.SharePoint.ApplicationPages” is obsufecated.
Regardless, I suspect that the problem is that in the database for that web
application, somehow, two site columns managed to get the same ID – probably
because of a backup-restore operation. Did you try on a different site
collection?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tommy Segoro
Sent: Wednesday, 17 September 2008 10:52 AM
To: [email protected]
Subject: [OzMOSS] RE: Error on Adding Content Types to List
Correct. Will that cause problem? I tried to restore Prod on my dev machine so
that I every changes I make, I can see it working before deploying to Test and
Prod.
The same problem happens at Prod, too though.
Any ideas?
________________________________
From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ishai Sagi [EMAIL
PROTECTED]
Sent: Wednesday, 17 September 2008 6:49 AM
To: [email protected]
Subject: [OzMOSS] RE: Error on Adding Content Types to List
Is this site a restore from backup?
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tommy Segoro
Sent: Tuesday, 16 September 2008 5:17 PM
To: [email protected]
Subject: [OzMOSS] Error on Adding Content Types to List
I got this error when clicking on Add from Existing Site Columns to add a
custom field to a list, any ideas?
No two choices should have the same ID at
Microsoft.SharePoint.ApplicationPages.ChoiceComparerWithDefaultGroup.Compare(PickerItem
c1, PickerItem c2)
at
System.Collections.Generic.ArraySortHelper`1.SwapIfGreaterWithItems[TValue](T[]
keys, TValue[] values, IComparer`1 comparer, Int32 a, Int32 b)
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com
- to unsubscribe from this list, send a message back to the list with
'unsubscribe' as the subject.
Powered by mailenable.com