"To save to the server, correct the invalid or missing required properties"

I’ve been working on a custom field for, well, a while now, and after making some changes I started to get the error “To save to the server, correct the invalid or missing required properties” when trying to edit a document and save the changes back in Word 2007. This was a little strange, as I’d already sorted out hiding the custom field from the document information panel, and things had been working fine since then.

New documents seemed to be alright, but the older ones weren’t. So, maybe the problems were all the old documents, rather than my field.

Eventually, I came across this knowledgebase article – so I “inspected” the document, removed any of it’s custom data, and resaved it – and it worked fine.

What I think happened here was, I was testing different settings for Content Approval and Versioning on my document libraries. I think the troublesome documents were created when one of those was set to be ‘on’, and I subsequently turned it ‘off’. This meant that the document actually had extra data that referred to a column that no longer existed (I think) – which probably means this is related to Content Approval.

But I’d be curious if anyone else has managed to cause this error, and how they did so.

"To save to the server, correct the invalid or missing required properties"

WSS Practice: Checking in/out Documents, and Versioning

Well, for the WSS application developer exam, you’re supposed to know about programmatically checking in and out documents:

//*** Check out a document
Console.WriteLine("Check out {0}", myItem["Name"]);
myItem.File.CheckOut();
Console.ReadLine();
//*** Check in a Document (Minor Check in)
myItem.File.CheckIn("Checked in Programmatically", SPCheckinType.MinorCheckIn );
Console.WriteLine("Item Checked in");
Console.ReadLine();

One should also be able to list all versions of a document:

//*** List all versions of a document
Console.WriteLine(myItem.Name);
foreach (SPFileVersion ver in myItem.File.Versions)
{
Console.WriteLine(" - v{0} ({1})", ver.VersionLabel, ver.CheckInComment);
}
Console.ReadLine();

And restore a version:

//*** Restore to version 1.0
myItem.File.CheckOut();
myItem.File.Versions.RestoreByLabel("1.0");
myItem.File.CheckIn("Restored by Program to v1.0");
Console.WriteLine("{0} restored to v1.0", myItem.Name);

All pretty straight forward.

WSS Practice: Checking in/out Documents, and Versioning