0

Within 'R' there is a neat new package named Microsoft365R - the only issue with this package I have personally had so far is trying to read in emails and pull off the attachments based on either system date, subject name or both of these factors.

It is possible to pull attachments using the package and to read emails and to dictate i.e. the 4th email etc. but if I was to receive a number of emails, I would want it to pull off this data based on system date and the subject name (as previously mentioned) i.e.:

I get permit data for SW KPI1 and SW KPI2 (named accordingly) on the 1st of the month - then I want the system to run and look for any emails that have SW KPI in the name that were sent on the same system-date and either download them to a set folder or to 'R' directly of which I can then transform and email out.

If anyone is aware of how to do this (either this package or another that is in version-ish), it'd be greatly appreciated.

Phil
  • 7,287
  • 3
  • 36
  • 66

1 Answers1

0

You can filter your e-mails by subject name with an OData expression Like so:

email <- my_outlook$list_emails(filter = "startswith(sender/emailAddress/address,'example@outlook.com')", n = 1)

The Sys.time() and Sys.Date() functions don't work within the filter method

iago nunes
  • 56
  • 9
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 01 '23 at 11:27