1
我上传文档,XLS文件,但我不明白如何上传HTML文件。此代码上传文件但不预览文件。它说 - “我们道歉预览不可用”。什么是我必须设置的MIME类型?谷歌Apis V2的HTML MIME /类型
if (extension == ".htm" || extension == ".html")
{
File body = new File();
body.Title = Path.GetFileNameWithoutExtension(item);
//body.Description = "A test document";
body.MimeType = "text/HTML";
byte[] byteArray = System.IO.File.ReadAllBytes(item);
System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream,
"application/vnd.google-apps.file");
request.Convert = true;
什么是电子邮件?包含什么? – mehelta 2014-10-07 16:33:38
对不起,我从我的实施中复制。你的情况不是'email'是'byteArray'。我会编辑我的答案。 – 2014-10-08 09:10:30
和你在“myme/type”中设置了什么? – mehelta 2014-10-13 14:53:57