Skip to main content

Error: A duplicate field name "Name" was found. [Part 2]

Before some time I posted about an error I faced  - "Error: A duplicate field name "xxxx" was found".

This week I have the same problem. The challenge now was that the clients don't have time to rename their custom fields and deploy new code that uses the new internal names. So here is one possible approach.

The problem:  Error “A duplicate field name "Name" was found” when a site collection feature for provisioning custom fields and content types is activated.

The workaround: Edit the Name property of the problematic field(s) in the elements.xml files of the custom fields' module and custom content types' declaration. Deploy the changes with Update-SPSolution. Activate the site collection feature. Deploy the original wsp again with Update-SPSolution.

Explanation: 
This works because the custom fields deployed with module are not created directly in the database. They are alive through their elements.xml files.

So if the original declaration is like this:
you can edit the xml to the following:
The guid of the field is not changed so after the feature is activated and then Update-SPSolution is performed - the field Name will work properly.

In my case I don't have feature upgrade logic. If you have such one in your scenarios - you need to think more about this additional logic.



Comments

Popular posts from this blog

ClientPeoplePicker in SharePoint 2013

Start using SharePoint 2013 I noticed that the way for selecting people or groups is changed. The new way is simple – just ‘Enter name or email address’ without any icons for ‘Check Names’ or ‘Browse’. I guess that the PeoplePicker is changed but NO. PeoplePicker sitll has the same functionality as before. There is a new control called ClientPeoplePicker . How to use it: 1. Add this references <% @ Register TagPrefix ="wssawc" Namespace ="Microsoft.SharePoint.WebControls" Assembly ="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 2. Add the following control declaration       < wssawc : ClientPeoplePicker          Required ="true"          ValidationEnabled ="true"          ID ="peoplePicker"          runat ="server"   ...

SharePoint and List Joins with CAML

This came to me as an issue when I started migrating one project from SharePoint 2010 to SharePoint 2013. The code uses LINQ to SharePoint and it was not written in a clever way. We decide to use CAML queries and optimize the code. The scenario: Create gridview that gathers information from three(or more) lists. The problem: How to create the CAML query joins and projected fields correctly. Explanation : Option 1: Get generated CAML query from LINQ to SharePoint code This doesn’t work. I wrote the LINQ to SharePoint code connected the three lists. When I executed the code the following error was thrown – “ The query uses unsupported elements, such as references to more than one list, or the projection of a complete entity by using EntityRef/EntitySet. ” Here is some explanation about it and why this can’t be used. Option 2: Write the query yourself I found this article in MSDN . Read it ! The second part in it is exactly my scenario. But it takes me a lot of time to un...

SharePoint 2016: High Availability Farm Topology

MinRole concept was introduced in SharePoint 2016 and it aims to simplify the process of designing the farms. However, I still find ambiguous information about the count of servers in SharePoint 2016 farm. Let's ask ourselves the question - What is the minimum number of servers which allow High Availability MinRole farm? According to technet   we have the following options: Small High Availability (HA) MinRole farm 4 Four servers with two shared roles: ·         Two Front-end with Distributed Cache servers ·         Two Application with Search servers Medium High Availability (HA) MinRole farm (Search optimized) 6 Six servers with both dedicated and shared roles: ·         Two Front-end with Distributed Cache servers ·         Two Application servers ·    ...