Logo 
Search:

MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Orphaned Column?

  Asked By: Arturo    Date: Feb 18    Category: MOSS    Views: 2426

MOSS 2007 Enterprise SP1. This may be a classic content type problem, but a definitive solution or at least recommended plan of attack eludes:

Client added ~15,000 documents under an incorrect content type to a document library. This incorrect content type is currently NOT hidden nor sealed (yet). We would like to manually (via SharePoint UI) edit some properties of these documents, however saving returns, “Failed to get value of the "OLD Order Number" column from the "Business data" field type control. See details in log. Exception message: Value does not fall within the expected range.”

We think this is due to the mysterious, orphaned column "OLD Order Number" which no content type uses, nor shows up in any view definition (ViewEdit.aspx). However, it appears in the EditForm.aspx for every record/document. We think this was a mistake at some time in the long, turbulent history of this document library. We would just like to delete "OLD Order Number" and move on, but it appears in none of the content types, site columns.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Paola Mcmahon     Answered On: Feb 18

well, first start from this code (C# console app, you need to add Microsoft.SharePoint.dll reference from 12\ISAPI), trying to remove orphaned  column programmatically:


using System.Collections;
using Microsoft.SharePoint;

namespace DLFixScript {
class Programm {
private const string siteUrl = "http://localhost";
private const string webUrl = "http://localhost";
private const string srcListName = "Shared%20Documents";

private const string OrphanedColumnName = "OrphanedColumnName";

private static string CorrectContentType {
get {
return "NewContentType";
}
}

public static void Main() {
using(var site = new SPSite(siteUrl)) {
using (var web = site.OpenWeb(webUrl)) {
web.AllowUnsafeUpdates = true;
var sourceList = web.Lists[srcListName] as SPDocumentLibrary;
UpdateCT(sourceList);
}
}
}

private static void UpdateCT(SPList list) {
var CT = list.ContentTypes[CorrectContentType];
CT.ReadOnly = false;
CT.Fields.Delete(OrphanedColumnName);
CT.FieldLinks.Delete(OrphanedColumnName);
CT.Update();
}

}
}

if not successfull, please let me know I'll send you migration code

 
Didn't find what you were looking for? Find more on Orphaned Column? Or get search suggestion and latest updates.




Tagged: