Oh, lookup fields, how I hate you.
I just realized that it is not possible in the user inteface to set a default value for a lookup field. Is it that hard to do an interface that will show the user creating the field the options from the looked-up list and allow him to select a default value?
Apperantly it is. I guess Microsoft were worried about what happens if someone deletes the looked-up value.
Not content with my findings, I tried looking in the object model and discovered that you can set up a default value for a lookup field using the following code:
SPList docs = w.Lists["Documents"]; SPFieldLookup fl = (SPFieldLookup)docs.Fields["City"]; fl.DefaultValue = "1;#Mexico City"; fl.Update();
I will add this option to my Utility Pack when possible.
Using the above code solves the issue almost totaly. When you use the web interface to add a list item or upload a document, the default value comes up in the lookup box. However (and this is the big one), from the office applications (both 2003 and 2007) the default value is ignored and the lookup box always begins at the "blank" option.
Should I waste one of my MSDN support calls on this and ask MS for a fix? or should I just learn to live with it?