none
Problems using outlook addin function getRegExMatches(). RRS feed

  • Question

  • I am trying to develop a add in to retrieve phone number from emails, one way to do this is creating a rule with the regex and then use getRegExMatches(). the problem is when i use it, it comes null. i have copied some examples from the outlook addin msdn library and still I don't have nothing. there is any problem with this?

    the rules I am using:

     
     <Rule xsi:type="RuleCollection" Mode="And">
        <Rule xsi:type="RuleCollection" Mode="And">
          <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/>
        </Rule>
        <Rule xsi:type="RuleCollection" Mode="Or">
          <Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="fruits" RegExValue="apple|banana|coconut" PropertyName="BodyAsPlaintext" IgnoreCase="true" />
          <Rule xsi:type="ItemHasRegularExpressionMatch" RegExName="veggies" RegExValue="tomato|onion|spinach|broccoli" PropertyName="BodyAsPlaintext" IgnoreCase="true" />
        </Rule>
      </Rule>

    The code i am calling

    var allMatches = Office.context.mailbox.item.getRegExMatches();
        console.log(allMatches);

    Friday, September 20, 2019 1:51 PM