Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Duplicate Field Error #1022

Closed
NPrice99 opened this issue Jul 7, 2015 · 29 comments
Closed

Duplicate Field Error #1022

NPrice99 opened this issue Jul 7, 2015 · 29 comments

Comments

@NPrice99
Copy link

NPrice99 commented Jul 7, 2015

Applying a template to a site, you get an error "Field Already Exists". In my case it is the "Attendees" field. I delete the field out of the Provisioning Template, and point the Attendees FieldRef to the GUID of the existing "Attendees" field and it all works.

@erwinvanhunen
Copy link
Member

A few questions:

What is the underlying site template of the site you created the template from? (like STS#0, etc.)
Can you extract the template again from the site and post the XML snippet of the Attendees field here?

@NPrice99
Copy link
Author

NPrice99 commented Jul 7, 2015

Hi Erwin

BLANKINTERNET#0

Regards

Nigel

From: Erwin van Hunen [mailto:notifications@github.com]
Sent: Tuesday, July 7, 2015 1:48 PM
To: OfficeDev/PnP
Cc: Nigel Price
Subject: Re: [PnP] Duplicate Field Error (#1022)

A few questions:

What is the underlying site template of the site you created the template from? (like STS#0, etc.)
Can you extract the template again from the site and post the XML snippet of the Attendees field here?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1022#issuecomment-119193386.

@NPrice99
Copy link
Author

NPrice99 commented Jul 7, 2015

Don't forget I am On-Premises

@NPrice99
Copy link
Author

NPrice99 commented Jul 7, 2015

Don't forget I am On-Premises - I don't know what Tobias is ?

@erwinvanhunen
Copy link
Member

In this case, the attendees field is a field you added yourself to the userinfo list before applying the template? As part of a solution?

@NPrice99
Copy link
Author

NPrice99 commented Jul 7, 2015

No – It was generated when I did a Get-ProvisioningTemplate

From: Erwin van Hunen [mailto:notifications@github.com]
Sent: Tuesday, July 7, 2015 2:23 PM
To: OfficeDev/PnP
Cc: Nigel Price
Subject: Re: [PnP] Duplicate Field Error (#1022)

In this case, the attendees field is a field you added yourself to the userinfo list before applying the template? As part of a solution?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1022#issuecomment-119201308.

@erwinvanhunen
Copy link
Member

Sorry, I meant the field was already there, otherwise Get-SPOProvisioningTemplate cannot add the field to the template. How did that field end up in that list? Given that the field is added to an (to me) unknown group "DH Columns" I assume it's a custom field that has been provisioned one way or the other to the site, or has been added to the BLANKINTERNET#0 site definition or is being introduced in the site through feature stapling.

@NPrice99
Copy link
Author

NPrice99 commented Jul 7, 2015

It is a Group /Person field created using the GUI. “UserInfo” list is an OOTB (hidden) list.

From: Erwin van Hunen [mailto:notifications@github.com]
Sent: Tuesday, July 7, 2015 2:32 PM
To: OfficeDev/PnP
Cc: Nigel Price
Subject: Re: [PnP] Duplicate Field Error (#1022)

Sorry, I meant the field was already there, otherwise Get-SPOProvisioningTemplate cannot add the field to the template. How did that field end up in that list? Given that the field is added to an (to me) unknown group "DH Columns" I assume it's a custom field that has been provisioned one way or the other to the site, or has been added to the BLANKINTERNET#0 site definition or is being introduced in the site through feature stapling.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1022#issuecomment-119203080.

@erwinvanhunen
Copy link
Member

Okay, and has that field also been added to the user info list in the target site before you to applied the template to it? I'm trying to figure out if the engine tried to update an existing field, or that it thought it had to create it because it couldn't find it.

@NPrice99
Copy link
Author

NPrice99 commented Jul 7, 2015

On this farm we were using a Content Type Hub which, as soon as a site is created, dives in and creates all of the site columns and Content Types. Apply-ProvisioningTemplate comes in later and tries and create all of the site columns and Content Types it thinks that the site needs. This is probably the only field which is in both. I will check both definitions.

@braegelno5
Copy link
Contributor

What I not understand, in the field object handler we check if field with field-id from template exists not on context web fields collection.
Why this check is not able to find this existing field, any suggestions?
Is it a time race, because Nigel you mentions the field will published by ct hub?

@braegelno5
Copy link
Contributor

My suggestion here would be, that we double check in CreateField if field with id not exist in web.Fields, so we are prepared for a race with ct hub job or feature stapler closer to the AddFieldfAsXml, and if exist we call the FieldUpdate from there also.
And for this check we use a caml query, so we have not so many objects delivered over the network witch is time consuming?

@braegelno5
Copy link
Contributor

Another idea, before we save the ct definition to the template, would it be possible to check if this ct comes from an ct hub; but i think if the ct comes from a stapler we have no chance for detection

@NPrice99
Copy link
Author

I don't user feature stapling. So this should be fine.

@braegelno5
Copy link
Contributor

On the other side in o365 we have found that the provision of ct from ct hub to a new sc, depends not on the creation tooling - UI or csom.. In worst case after hours the job will finishing..

@prbnsn
Copy link

prbnsn commented Jul 15, 2015

I get the "field already exists" error in SPO with taxonomy fields. Scenario: taxonomy site column created manually on site; site column added to a custom list with test item created; site saved as template using the provisioning engine; new site collection created and template applied, resulting in this error.
Removing the Note field from the SiteFields collection works as a workaround.

@GavinHaak
Copy link

Yep, same issue, resolved as per prbnsn.

Now have an issue with a duplicate content type error I assume because we are also using a CT hub.

@paulpascha
Copy link

Same issue here happening as soon as I Get/ApplyProvisioningTemplate on a Web in which I created a Managed Metadata site column (in a Team Site, just using the browser interface)

@erwinvanhunen
Copy link
Member

@paulpascha, @GavinHaak : are you running both on-prem? It almost sounds like the on-prem CSOM SDK behaves differently from the O365 version, where the on-prem version creates the corresponding note field (hidden field, used to store the guids of the terms picked in the taxonomy field) automatically.

@paulpascha
Copy link

In my case it's an Office 365 (Developer) Subscription...

@erwinvanhunen
Copy link
Member

Okay, I've pinpointed down the issue. If the note field is before the taxonomy field in the template, no issue occurs. I've found however that omitting the note field at all indeed creates the note field too (this is new from my understanding in the SDK and I wasn't aware of this until now). I will work on a fix in the engine to tackle this specific issue (won't happen today though)

@erwinvanhunen erwinvanhunen self-assigned this Jul 17, 2015
@NPrice99
Copy link
Author

Thanks Erwin

@erwinvanhunen
Copy link
Member

I merged a fix and it's available in the dev branch now. Please test and report back if this solves the issue for you. If all good I will close this issue. The PR can be found at #1054

Notice that it requires that you extract/generate a new template. Existing templates with the note defined after the taxonomy field will still fail.

@GavinHaak
Copy link

O365 unfortunately.

On Fri, 17 Jul 2015 at 22:55 Erwin van Hunen notifications@github.com
wrote:

@paulpascha https://github.com/paulpascha, @GavinHaak
https://github.com/GavinHaak : are you running both on-prem? It almost
sounds like the on-prem CSOM SDK behaves differently from the O365 version,
where the on-prem version creates the corresponding note field (hidden
field, used to store the guids of the terms picked in the taxonomy field)
automatically.


Reply to this email directly or view it on GitHub
#1022 (comment).

@patrick-rodgers
Copy link
Member

Closing this issue due to age. If you believe this is still an issue in the latest release please re-open and let us know.

@keerthimushini
Copy link

Hi.. I am facing the same issue as I am working on SharePoint 2013 on premises, the site Field of Type Taxonomy in the template file has been saved with the Hidden column of Type Note.
As a result I am facing an issue with Applying or provision Template to any new publishing Site. Please can you let me know if there is update on the OfficeDevPnp.core dll (Office Dev PnP Core library for SharePoint 2013).
Thanks
Keerthi

@sergiorru
Copy link

Same issue here guys, i noticed that in list has a pnp:Field, this field has the StaticName filled with the same name of the StatusFieldName attribute of pnp:WorkflowSubscription node, after the provision finishes on the list settings I can see two fields with the same display name.

This issue ocorrs on SharePoint OnPremisses Farm Build Version: 15.0.4841.1000

@NPrice99
Copy link
Author

NPrice99 commented May 5, 2017

I have a similar problem - when apply-spoprovisioningtemplate I get error Duplicate Field Name XXXX Found SharePoint Online April 2017 PowerShell version

@AlexandraKosa
Copy link

Hi we have a similar issue. we have activated the content center feature on the root site and we are getting field with the same name exists.. the affected field is Model name.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants