I have a large document library of many thousands of Word docs.

Each Word doc contains a number of standard fields including the name of the person each document is about eg "Name: John Smith".

In SharePoint, I want a column called "Person Name" or some such. It would take a very long time to go through each document and pull out the name to add to the metadata.

Is there any way of speeding up the process? Going into the doc and returning what the value is after "Person Name: "?


I would go about this in the following way:

  1. Write a script that gets a list (exported to CSV) of some value to uniquely identify each document (the ID is probably best)

  2. For each entry in the list, use the Word COM object within Powershell or C# to do a regex check for 'Name: " inside the doc and extract the value between that and whatever the end identifier is (a new line I'm guessing)

  3. I would record each extracted value to a CSV list with the associated document ID so you know which value is from which doc

  4. Use a second script to iterate the CSV list and upload the extracted value into a field against the document

Once you've done the documents you have now the approach can be made permanent and automatic using either a Powershell script ran as a scheduled task, or a C# event reciever (if you want the exciting option...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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