I have a need to extract arbitrary data from a Word document (docx) that has been uploaded into a SharePoint document library and place it into a column in the document's list record.

As far as data extraction, I intend to use the Open XML library to extract data from particular nodes in the MainDocumentPart - this would require the Open XML dlls - are they already in SharePoint?

Also, for the initiation part of the SharePoint interface, I think I need to use an Event Receiver (on document upload) but am having trouble figuring out how it all should plug together.

Is an event receiver and Open XML the best way to accomplish this and what are some sources (examples/tutorials) I can use to understand all the pieces? Would it be better to make a workflow action?

1 Answer 1


I think the path your are considering would work. You would want to create an event receiver in Visual Studio that runs on item additions and changes. Microsoft has a lot of examples on using Open XML with Word: http://msdn.microsoft.com/en-us/office/ee358826.aspx and http://msdn.microsoft.com/en-us/library/cc850833.aspx.

Microsoft also has a lot of examples on how to create event receivers. I'd start here if you haven't done them before: http://msdn.microsoft.com/en-us/library/gg252010(v=office.14).aspx and http://msdn.microsoft.com/en-us/library/gg749858(v=office.14).aspx.

  • These are good sources, thanks! Do you know of any sources combining the two? I'm hard pressed, even looking through books available at Safari Books - though I can't imagine why it seems this topic is practically not discussed !? I really want to know about including the OpenXML dll along with the event receiver - what is the impact, if any? Mar 4, 2013 at 20:43
  • In your Visual Studio project, you can tell the project to include the DLL when you deploy the solution. (You can open the Package item in VS and add the DLL to goto the GAC there). In your event receiver you would use the SharePoint object model to get the file binary and then use the OpenXML code samples to work with it. Mar 4, 2013 at 20:49
  • Once you have the file binary, you can use the OpenXML samples like you would in a non-SharePoint project. Its just what you do with to get the file binary and then what you do with it afterward that is SharePoint-specific. Mar 4, 2013 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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