Office 365 graph (calendar - specifically first event info)


#1

Hi there,
so I’ve been playing with Morning and nightly reports - which with expressions and sonos speak and resume are so easy to implement. I’ve got weather in my morning report and if the next seahawks game is tomorrow or today remind me the time.

However, it would be great (based on {person}) to query the Office 365 graph for the first appointment tomorrow.

ie an expression that allows me to mention:
{person} " you have " $firstevent.name " starting at " $firstevent.time $firstevent.meridiem

not sure how one can handle 2 people - maybe a smartapp to auth against user 1 and user 2 (i’m now very much out of my depth!)

any thoughts?


#2

Maintaining a preformatted xls file with variables based on formulas there may be easier than doing it in WC if there is a way to pull specific column and cell data.

Interesting idea.

@ady624 what about a custom plugin for onedrive, google drive, or even on a designated machine, always on PC, Rpi, NAS, etc that the user could point to?


#3

Ok, so firstly i’m a Microsoft employee and i’m happy to ask around, BUT in the meantime i did some digging:

  1. The Microsoft graph:
    https://developer.microsoft.com/en-us/graph/docs/concepts/overview

  2. Sample queries:
    https://developer.microsoft.com/en-us/graph/docs/concepts/featured_scenarios

including ‘get my calendar’ :slight_smile: sadly my skills don’t extend to converting this to something useable in WebCoRE


#4

https://graph.microsoft.com/v1.0/me/events?$select=subject,body,bodyPreview,organizer,start,end,location

(i removed attendees as the list is often VERY long)
i don’t want to say it seems simple, but i imagine this makes it easier?
Can you authenticate to the app install (maybe once per person) and then query the data pulling back known response and formatting it?


#5

@ady624


#6

If anyone can share some code from a smartApp authenticating using Node.js authorize and token i’ll start poking around (as i said, not a dev, but can have a go :slight_smile: )

My thought approach (could be wrong) would be to create a ST Smartapp (that can be installed multiple times for multiple users - and then named differently). The app would request authorization from the Microsoft Graph, and (for now) pull down calendar information, which i’m assuming would need to be parsed into a useable format for WebCoRE (possibly usable variables). The graph also can pull down contacts, org structure, files,

Then either push through those variables in to the platform (like surfacing NFL & weather, OR possible build a linkage right in to the app).

Then on triggering good night you could have your sonos speak your (or {allpeople}) first event the next day:
"your first event is at " $firstevent.time " titled " $firstevent.name " at " $firstevent.location

or even arriving home “you have 2 events this evening. First Take the dog for a walk, 2nd push the trash out”

If like me you have people’s birthdays in your calendar (i think syncing from Facebook) it would be kind of cool in the morning to add “and don’t forget it’s Ben smith and Jon Jones’s birthdays today”


#8

Do these work if your Office365 account uses SSO?


#9

Hi! MSFT employeer here too. I have started to use Flow to grab things from my calendar, then send it via http to a WebCoRE piston. It’s a great way to take info in my calendar, and inform my house, as opposed to the house having to obtain the information, then you are challenged with authentication.

I’ve written about it here:

Some of the scenarios I use it for:

When I have an upcoming appointment and I am home, assume I am going on a conference call, stop my roomba, stop Sonos music.

When house is away, and I have an appointment which contains the Subject Line “DCA” (my home airport), it knows I am coming home from a flight, set my AC back to something reasonable to cool the house down.

Flow makes it really easy and because it is already tied to your Office 365 account, there’s no need to worry about authentication to the calendar. BE AWARE, we are bound by our Data Loss/Prevention policies, so there may be certain things in Flow that are disabled. Just use good judgement.