Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We have a SharePoint Server 2007 farm.

In our environment, it is important that users remove office documents’ “Properties and Personal Information” before uploading them to any document library.

I understand that it is possible to erase office document properties by using “Inspect Document” feature in office 2007 and 2010. However, Our users tend to forget doing that.

What are my options to have SharePoint automatically erase document properties before office documents get uploaded to a document library.

Thank you,

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You can use an event receiver in your document library and clean the property values before a document is added. You would create a SP solution with a DLL assembly and a class inherited from SPItemEventReceiver and override the ItemAdding method:

public class PropertyDeletor : SPItemEventReceiver {
    public override void ItemAdding(SPItemEventProperties properties) {
        base.ItemAdding(properties);
        string internalName = ...;
        properties.AfterProperties[internalName] = null;
        ...
    }
}

Event registration is usually bound to a activation of a feature that you pack in the solution. Event receivers can be registered either declaratively or programmatically.

Update: Allan remembered me about a catch - using property promotion/demotion that I suggested needs matching list fields for the document properties you want to modify. The other way round works for every list column - accessed via the property bag - they are written through to document properties. And of course, this feature must be turned on.

--- Ferda

share|improve this answer
    
Hi Freda, How can an event receiver modify an office document's properties? Does the office API accessible in a typical SharePoint installation? We can't install office applications on the SharePoint servers. –  Allan Xu Apr 12 '12 at 12:37
    
An Office document uploaded to a document library is subject to property promotion/demotion. If you have fields in the list that match the document properties SP document parsers will synchronize their values. (And that's also the catch - my answer is not universal.) –  Ferdinand Prantl Apr 12 '12 at 12:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.