Office 365 Calendar Access

I got it working again. MSFT has updated the native client URL. If you add https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize to your list of valid URL redirects everything starts working again.

Do you know if this is a recent change? Iā€™m trying to create a fork of Patrickā€™s repository with the relevant changes (version, tzlocal, etc) so that it is ā€˜easilyā€™ installable. Iā€™ve just tried using the url from the Readme, and it does still seem to work (to at least I get my two calendars). I think you should only need it for initial authentication, after that I donā€™t think it is required (not 100% sure).

If you have MFA then you need tge uodated URL too.

OK, Iā€™ll try and add some words to the readme. I donā€™t have MFA switched on (I probably should do), so maybe difficult for me to test.

I just tested the above URL for non-MFA and it works with that too. It probably would be useful to fork this so it can be maintained by the community.

My fork is as below.

The challenge for me is that I only use the calendar, so have have never tried the email aspect of it. Iā€™m happy for anyone to take on the code, but for now I have submitted a ā€˜Wheelā€™ based on my repository to HA and also submitted a Logo to the branding repository. In addition Iā€™ve fixed the manifest, plus changed code based on recommendations from VS Studio (there was some invalid YAML in services.yaml), Codefactor, Depndabot and some outstanding Sourcery pull requests. Iā€™m currently waiting on an update to the O365 pypi module so include the tzlocal change, so I can back that out of the manifest since it doesnā€™t really belong there.

My current release is v2.2.4

1 Like

I assume from this that you have both MS URLs set as Redirect URIs? If I just use ā€˜Sign in to your accountā€™ it wonā€™t complete (mismatch uri error).

I do have both in my redirects.

And is this only if you are using the alternate authentication path, or for both authentication paths?

Thanks for all the work on this. I use Outlook for email/calendar and do not like the lag between outlook and google when using the ics calendar. I think Iā€™ve got most of it up and running, but one problem Iā€™m having is with all-day events. The start time is always 4 hours earlier than expected. Assuming this is because outlook bases everything off of GMT and thereā€™s something not working correctly to adjust the time (offset). Standard events (non-all-day) work fine. Any thoughts on how to correct?

I would suspect that is the case. If you can raise an issue on my GitHub (not ptstā€™s) then I will try to take a look. I have a certain amount of experience with calendars in my programming past, but not with O365, so no promises. Iā€™m away for a week, so wonā€™t look at it for 10 days.

Thank you. Will do. Safe travels.

1 Like

I have posted a potential fix here. Please note it is a beta version, so please treat as such and report on the issue @BigMal raised.

Thanks Roger. I just updated to the beta and it appears to be functioning correctly. I will continue to use and will let you know if I see any issues. Thanks so much for all your efforts on this. Itā€™s very useful to O365 users!

Thanks, Iā€™ll release fully in a couple of days.

1 Like

I just moved over to your fork. Appreciate you taking this on for at least hosting. I will contribute accordingly too.

1 Like

Thanks so much for maintaining this! Iā€™m using it right now to play the Fox NFL theme on the echo and turn the lights to green and gold when a packer game is on. But I want it to do it 30 minutes prior to kickoff. Is the ā€œoffsetā€ option meant for this? Iā€™ve tried to get it to work, but Iā€™m starting to think Iā€™m not understanding the true intention of the option. If this isnā€™t what it is meant for, is there another way I can trigger 30 minutes prior to a calendar event?

If you mean the start_offset and end_offset, that is just the period of time from now that it will return events for so they are available in the HA calendar.

So this is part of my confusion. If I have start offset at 0 and end offset at 24, then Iā€™m expecting it would pull 1 dayā€™s worth of appointments. But when I click on the calendar icon on the left hand side of the screen, it pulls in seemingly every single appointment for months out. What am I not correctly understanding?

Given that I have only taken this code on recently, just to keep it going, Iā€™m having to do some digging to figure out how it works.

It looks like the start and end offsets are what populate the calendar entity that is shown in Developer Tools.

The Calendar tab is not controlled by those values. When I do a query now, I can see it passes 23:00 last night to midnight on the 8th November as the query, which is enough to fill the visible portion of the calendar. If I page forward a month, it then queries for start of month to 13th December which again covers the visible calendar.

I canā€™t quite see where it gets the content prior to today from, I suspect it will be cached somewhere.