Outlook/Office iCal feed 400 bad request error with C# WebClient

Updated on Tuesday, June 21, 2022

400

Just in case it helps someone else I was able to fetch an Outlook iCal feed using C#'s WebClient for years until it stopped working in June, 2022 with a 400 / bad request error. I was downloading a set of calendars and the fix was just to use a new WebClient for each calendar so it must be some kind of state thing in WebClient.

To regain around 1% of sanity I have a task that pulls the various calendars that life throws at me and combines them into a single, de-duplicated calendar. The Google Calendar on my phone is gorgeous as a result. My primary calendar is orange and then all of the miscellanea are teal and unique. It would be great if Google Calendar could do this without help, but it was worth the effort not to have some random soccer match repeated five times in different colors.

Last week one calendar, an Outlook feed, started failing with 400 bad request.

Naturally I assumed that the server had started to suddenly care about some header or other and I started playing around with setting User-Agent and various Accept headers without any luck. To make debugging slightly easier I moved the Outlook calendar out of a loop (where I was iterating through a list of iCal feeds that I need to be aware of) and then it magically started working. The magic in this case must be a fresh WebClient and so the fix was to use a new WebClient for each calendar instead of reusing a single instance. It looks like WebClient is deprecated in .NET 6 and one is supposed to start using HttpClient instead so that's probably another fix but not one I'm going to wrestle with today.

Add your comment...

Related Posts

You Might Also Like

(All Code Posts)

(Published to the Fediverse as: Outlook/Office iCal feed 400 bad request error with C# WebClient #code #c# #outlook How to fix a 400 / bad request error with the C# WebClient when downloading an Office iCal feed. )

Why Microsoft is Likely Doomed Based on one Email Folder

Updated on Thursday, August 5, 2021

Close up of the useless Junk folder in Microsoft Outlook

When you get a piece of spam in Outlook you move it to Junk or block the sender. And then, even if that junk mail is marked as read, the Junk folder has a BOLD MESSAGE COUNT. It's the only folder that does this. I cannot do any other work while I have a bold message count and so I have to switch to the Junk folder and delete the message to get rid of it.

Regular email: read, file, done.

Junk email: recognize as spam, click block sender, confirm that I really want to block the sender, switch to Junk folder, mark as read, delete.

Something is really wrong with this workflow. It's a lens through which you can view the ultimate demise of the company. Sure, Office isn't going away soon and Azure is growing like crazy and SQL Server runs on Linux. But somewhere in Redmond 5,000 people designed a Junk email folder that is the MOST IMPORTANT folder in Outlook. The rest were presumably too busy making Windows Update worse to stop this.

My Google experience is that I really don't get much spam. The spam that I do get is hidden from me unless I actually need to rifle through it for some reason. On the occasion I actually get legitimate junk I just flag it as such and never have to touch it or it's ilk again.

Add your comment...

Related Posts

You Might Also Like

(All Marketing Posts)

(Published to the Fediverse as: Why Microsoft is Likely Doomed Based on one Email Folder #marketing #outlook #microsoft The Junk folder in Microsoft Outlook is a lens through which you can view the ultimate demise of the company. )

Full Outlook Web Access on Chromebook

Updated on Monday, April 26, 2021

Outlook Web Access

When trying to load the Outlook Web App on a Chromebook you'll find that you can only access the 'light' version. It's pretty easy to fix, you just need to spoof the user agent. 

On a regular desktop computer launch Chrome and type chrome://version in the address bar. Find and copy the user agent string. 

On your Chromebook install the User-Agent Switcher extension. After this installs click the icon and choose Settings. Enter a new customer user agent - name something like 'Chrome Desktop', the user agent string is the one you copied from a desktop PC above, group is Chrome, type is replace and enter a character or two for the indicator flag.

Next click the Permanent Spoof list tab (still in User-Agent Switcher) and enter the domain of your outlook site (i.e. outlook.mycorp.com) and choose the user agent we just created from the drop down list (i.e. 'Chrome Desktop').

Finally log out of Outlook Web Access. You should now be able to uncheck the 'light' experience and get the full version of the Outlook Web App.

(Read the full Chromebook adventure: Part 1: Going Chrome, Part 2: Staying Chrome? and Part 3: Leaving Chrome)

 

Add your comment...

Read the full Chromebook Adventure

(All Etc Posts)

(Published to the Fediverse as: Full Outlook Web Access on Chromebook #etc #chromebook #outlook How to spoof your user agent to get full Outlook web access working on Chromebook, including the browser extension and user agent. )