O365公共IC日历下载停止工作
当问题无缘无故发生时,我真的很讨厌它(?),但是我有一些我需要帮助的人。 我们将共享的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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有一个类似的问题,我试图使用相同的网络客户下载多个日历,并遇到了错误的请求错误。使用新的网络客户下载每个日历已经解决了。它可能与野生标头有关。
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.