我已经在网络上公开分享了一些文档。有什么方法可以在不登录的情况下使用 Google API 检索这些文档吗?
最佳答案
你会做的是
// http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx
WebClient wc = new WebClient();
// http://msdn.microsoft.com/en-us/library/ms144200.aspx
string priceList=wc.DownloadString(
new Uri(
"https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0Aic3jYFcLTrldEhQU1dDTzdTdFBhaVA4OGtPX2FUMUE&single=true&gid=0&output=txt");
// http://msdn.microsoft.com/en-us/library/3cc9y48w.aspx
wc.Dispose(); // Free resources
// http://msdn.microsoft.com/en-us/library/tabh47cf.aspx
string[] lines = priceList.Split(
new string[] {
"\r\n",
"\n\r", // Rarely ever used, but be prepared
"\n" // Match this and
"\r" }, // this last
StringSplitOptions.None);
关于c# - 如何在不使用 API 登录的情况下检索公共(public) Google 文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10842950/