从skydrive读取文件不会返回任何内容 [英] Reading file from skydrive returns nothing

查看:77
本文介绍了从skydrive读取文件不会返回任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一个文本文件上传到Skydrive,现在我正在尝试阅读它,但结果完全是空的。这是我的代码:

I uploaded a text file into Skydrive, and now I'm trying to read it but the result is completely empty. This is my code:

private void downloadNote(String noteId)
        {
            liveClient.DownloadCompleted += new EventHandler<LiveDownloadCompletedEventArgs>(liveClient_DownloadCompleted);
            Stream stream = new MemoryStream();
            liveClient.DownloadAsync(noteId + "/content", stream);
        }

        void liveClient_DownloadCompleted(object sender, LiveDownloadCompletedEventArgs e)
        {
            liveClient.DownloadCompleted -= liveClient_DownloadCompleted;

            if (e.Error == null)
            {
                var memoryStream = e.UserState as MemoryStream;
                memoryStream.Seek(0, SeekOrigin.Begin);
                byte[] bytes = new byte[1000];
                int numbytes = memoryStream.Read(bytes, 0, (int)memoryStream.Length);
                System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
                //TextBlock a = new TextBlock();
                infoTextBlock.Text = "Downloaded note (" + numbytes + " bytes)";
                a.Text = enc.GetString(bytes, 0, numbytes);
                //MessageBox.Show(a.Text);
            }
            else
            {
                MessageBox.Show("Error");
                //infoTextBlock.Text = e.Error.Message;
            }
            this.busyIndicator.IsRunning = false;
        }

推荐答案

这是否如果您通过SkyDrive UI下载文件,该文件是否包含文本?
Does this file contain text if you download it via the SkyDrive UI?


这篇关于从skydrive读取文件不会返回任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆