O365公共IC日历下载停止工作

发布于 2025-02-07 05:11:25 字数 1476 浏览 3 评论 0原文

当问题无缘无故发生时,我真的很讨厌它(?),但是我有一些我需要帮助的人。 我们将共享的ICS日历从公共URL下载到我们的应用程序中,该应用程序在Gmail和O365工作了几年,直到上周O365链接开始投掷400(不良请求错误)。

谁能阐明Google为什么工作和O365不阐明吗?

我怀疑这是O365的问题,但我需要真正证明这一点

using System;
using System.IO;
using System.Net;

namespace ICS_Test
{
    internal class Program
    {
        static void Main(string[] args)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            string myGmail = "https://calendar.google.com/calendar/ical/smilecrmtesting1%40gmail.com/public/basic.ics";
            string myOutlookRaw = "https://outlook.office365.com/owa/calendar/[email protected]/fa89bfda91684ed28ed3cb6708c6fb1a13982551512168918431/calendar.ics";
            string fileName = "calendar.ics";

// this bit works
            Uri myUriGmail = new Uri(myGmail);
            using (var client = new WebClient())
            {
                client.DownloadFile(myUriGmail, "C:/Temp/" + fileName);
            }

// this fails with 400 error - BUT if you drop the link into a browser it works 
            Uri myUriO365 = new Uri(myOutlookRaw);
            using (var client = new WebClient())
            {
                client.DownloadFile(myUriO365, "C:/Temp/" + fileName);
            }

        }
    }
}

I really hate it when problems happen for no reason (?), but I have one that I need some help with.
We download shared ICS calendars from a public URL into our application, which was working for both Gmail and O365 for several years, until last week when the O365 link started throwing 400 (bad request errors).

Can anyone shed any light on why Google works and O365 doesnt ?

I suspect this is problem with O365 but I need to really prove it

using System;
using System.IO;
using System.Net;

namespace ICS_Test
{
    internal class Program
    {
        static void Main(string[] args)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            string myGmail = "https://calendar.google.com/calendar/ical/smilecrmtesting1%40gmail.com/public/basic.ics";
            string myOutlookRaw = "https://outlook.office365.com/owa/calendar/[email protected]/fa89bfda91684ed28ed3cb6708c6fb1a13982551512168918431/calendar.ics";
            string fileName = "calendar.ics";

// this bit works
            Uri myUriGmail = new Uri(myGmail);
            using (var client = new WebClient())
            {
                client.DownloadFile(myUriGmail, "C:/Temp/" + fileName);
            }

// this fails with 400 error - BUT if you drop the link into a browser it works 
            Uri myUriO365 = new Uri(myOutlookRaw);
            using (var client = new WebClient())
            {
                client.DownloadFile(myUriO365, "C:/Temp/" + fileName);
            }

        }
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

指尖上得阳光 2025-02-14 05:11:25

我也有一个类似的问题,我试图使用相同的网络客户下载多个日历,并遇到了错误的请求错误。使用新的网络客户下载每个日历已经解决了。它可能与野生标头有关。

I had a similar issue, I was trying to download multiple calendars using the same WebClient and got that bad request error. Downloading each calendar with a new WebClient resolved that. It may be related to the keep-alive header.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文