1) -, , , , MOSS 2007 MOSS 2013. MOSS 2013, , . , , , MOSS 2013, , .
2) . , , .
3) I wrote a web forms page to solve the problem with the appearance of the field several times in view, new and edit forms. You just need to change the code to indicate the list you want to check. This version will remove the first instance of fieldref and save the second instance:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using System.Text;
using System.Collections.Generic;
public partial class FixDuplicateFieldIssue : Microsoft.SharePoint.WebControls.LayoutsPageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (SPContext.Current.Web.CurrentUser == null)
{
Response.Write("You must be logged in to view this page.");
Response.End();
return;
}
if (!SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.ManageWeb))
{
Response.Write("You do not have permissions to view this page.");
Response.End();
return;
}
lblOutput.Text = "";
StringBuilder sbOutput = new StringBuilder();
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb web = site.OpenWeb(SPContext.Current.Web.ID))
{
try
{
hlBack.NavigateUrl = web.Url;
SPList spList = web.Lists["LISTNAME"];
if (spList != null)
{
sbOutput.Append("<table border='1'>");
foreach (SPContentType ct in spList.ContentTypes)
{
sbOutput.Append("<tr>");
sbOutput.Append("<td>" + ct.Name + "</td>");
sbOutput.Append("<td>");
Dictionary<string, Guid> GuidDictionary = new Dictionary<String, Guid>();
List<Guid> RepeatList = new List<Guid>();
foreach (SPFieldLink spfl in ct.FieldLinks)
{
if (!GuidDictionary.ContainsKey(spfl.Name.ToLower()))
{
GuidDictionary.Add(spfl.Name.ToLower(), spfl.Id);
}
else if (GuidDictionary[spfl.Name.ToLower()].ToString().ToLower()!=spfl.Id.ToString().ToLower())
{
RepeatList.Add(GuidDictionary[spfl.Name.ToLower()]);
sbOutput.Append("<span style='color:red;'>*</span>");
}
sbOutput.Append(spfl.Name + "," + spfl.Id + "," + spfl.DisplayName +"<br />");
}
sbOutput.Append("</td>");
sbOutput.Append("<td>");
sbOutput.Append("Repeats found: " + RepeatList.Count + "<br />");
foreach (Guid idToDelete in RepeatList)
{
sbOutput.Append("Deleting FieldRef with ID= " + idToDelete.ToString() + "<br />");
web.AllowUnsafeUpdates = true;
ct.FieldLinks.Delete(idToDelete);
ct.Update();
web.AllowUnsafeUpdates = false;
}
sbOutput.Append("</td>");
sbOutput.Append("</tr>");
}
sbOutput.Append("</table>");
}
}
catch (Exception ex)
{
sbOutput.Append("Error Occurred: " + ex.ToString());
}
}
}
lblOutput.Text = sbOutput.ToString();
}
}
source
share