views:

1449

answers:

4

I have a simple event handler with a ItemAdding event that changes a column value that I need in the ItemUpdated method. After uploading a word 2007 document (*.docx, *.pptx or xlsx) the value of the column is changed, but when I protect the document the value of the column disappears in the ItemUpdated method. This only happens for office 2007 documents, other files don't clear the value.

The event handler runs in a document library in MOSS 2007.

Thanks

A: 

When you upload an Office document into SharePoint, it tries to extract column from the document and promote them to the list.

Do, check if your doc has any attribute set. If this is the case, it can explain what you see.

Note: open advance document properties and delete all custom properties to be sure

Nico
+3  A: 

We have the same issue. It appears that the properties from the list are added to the office 2007 doc, but only with the default values for the field on upload/creation. Once the item is edited we are experiencing that the office documents values are overriding the values set in our event handler.

We do not experience this when using an asynchronous event handler, but the asynchronous event handler has conflicts with updates on other threads with certain types of updates.

We have a support call active with Microsoft about this very issue. They acknowledge this is not No results yet.

Try using an asychronous event handler (it runs a little bit later than the code that updates from the office document), but with caution.

UPDATE:

A workaround is setting the SPWeb.ParserEnabled to FALSE will remove the connection to the document properties which will stop the above behaviour. It prevents the list properties from being added to the office document.

Nat
A: 

I resolve the issue putting the SPWeb.ParserEnabled = false in the ItemUpdating method.

code:

properties.ListItem.Web.ParserEnabled = false;

Thanks all for help

Esteban Lalinde
A: 

Setting SPWeb.ParserEnabled = false does work, but there are effects! One very noticeable one is that it will break site and list templates. If SPWeb.ParserEnabled = false, and you save a list or site template, it's meta data is not set (Feature ID, Product Version, etc) and it will not be available in the list of templates to choose from. You might be able to get around this by resetting SPWeb.ParserEnabled=true during the itemUpdated event, but I haven't fully tested whether this will resolve all issues yet...