开发者

Lookup site column not saving/storing metadata for Office 2007 documents?

开发者 https://www.devze.com 2022-12-28 14:00 出处:网络
I\'m having this issue on several server environments. We have a list at the site collection root.There is a site column created as a multi-value lookup on that list\'s Title field.This site column i

I'm having this issue on several server environments.

We have a list at the site collection root. There is a site column created as a multi-value lookup on that list's Title field. This site column is used in document libraries in subsites as a required field. When we upload anything but an Office 2007 document, the user is presented with the document metadata fill-in screen (EditForm.aspx?Mode=Upload), the user fills in the appropriate data (including picking a value(s) for this lookup), and clicks "check in" - the document is checked in as expected, with the lookup field's value filled in.

With an Office 2007 document, this fails. 开发者_JS百科The user selected values for the lookup field do not ever make it to the server - no errors are thrown, but the field is not saved with the document. We have an event listener on these document libraries, and if we inspect the incoming SPListItem on the event listener method before a single line of our code has run, we see that the value for the lookup field is null.

It smells like a SharePoint bug to me - but before I go calling Microsoft, has anyone seen this & worked around it?

Edit: the only entry I see in the SP trace logs relating to the problem:

CMS/Publishing/8ztg/Medium/Got List Item Version, but item was null


Wound up having to open a ticket with Microsoft for this one, and found a bug in the MSDN documentation to boot.

In order to get a multiselect lookup, we had been setting the "Mult" attribute in our lookup field CAML to "true" in the XML we passed to SPFieldCollection.AddFieldAsXml. However, even though the API will throw no errors & appear to work in the UI, this clashes with how Office 2007 & 2010 documents & their SharePoint integration works.

The official, supported way to add a multiselect lookup field is to use the LookupMulti field type in the Field CAML. Doing this, and setting the "Mult" attribute to "true" gives the result I was looking for.

The MSDN documentation for "Mult" has still not been updated for the SP 2007 documentation, and can safely be ignored as it is completely wrong.

0

精彩评论

暂无评论...
验证码 换一张
取 消