Showing posts with label Upgrade. Show all posts
Showing posts with label Upgrade. Show all posts

Monday, 19 December 2011

One or more field types are not installed properly, SharePoint 2010 Upgrade

Whilst working on a recently upgraded SharePoint 2010 site (database attach upgrade) I attempted to modify an existing web part. As soon as the page went into edit mode I was presented with the following SharePoint error: “One or more field types are not installed properly. Go to the list settings page to delete these fields.”

This appears to be a random bug which seems to occur with some sites after they have been upgraded and is related to a list called ‘Relationships List’.

To fix this de-activate the SharePoint Server Publishing Infrastructure Feature in the sites settings, delete the Relationships List and re-activate the feature.

Upgrade .doc to .docx in-place in a doc library

using Microsoft.SharePoint.Client; 
....
using(var ctx = new ClientContext("http://yoursharepoint/web_containing_library/"))
{    
var lib = ctx.Web.Lists.GetByTitle("Title of your library");    
var files = lib.RootFolder.Files;    
ctx.Load(files);    
ctx.ExecuteQuery();    
foreach(var file in files)    
{        
if(file.Name.ToLower().EndsWith(".doc")        
{            
string newFilename = file.Name + "x"; //dirty hack :)            
file.MoveTo(newFilename, MoveOperations.Overwrite);            
ctx.ExecuteQuery();            
//not sure if you need this, try without first            
ctx.Load(file);            
ctx.ExecuteQuery();            
 //convert DOC content to DOCX            
var fi = File.OpenBinaryDirect(ctx, file.ServerRelativeUrl);            
//get content using fi.Stream and convert it            
//save it            
File.SaveBinaryDirect(ctx, file.ServerRelativeUrl, streamWithDOCX, true);        
}    
}
}