Here I am trying to search for text in context.document.body. I have a loop like this:
var searchList = ['foo','bar'];
while(i < searchList.length){
Word.run(function(context) {
var searchResults = context.document.body.search(searchList[i]);
context.load(searchResults, 'text');
context.trackedObjects.add(searchResults);
return context.sync().then(function() {
It is not working.