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

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?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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? –  Code Jockey Mar 4 '13 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. –  John Chapman Mar 4 '13 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. –  John Chapman Mar 4 '13 at 20:50
add comment

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.