English 中文(简体)
视窗电话进入Sky司机的问题 7
原标题:Problems accessing SkyDrive from Windows Phone 7

我们正在使用LiveLink SDK 5.0,从我们的Windows 7.5申请中检索Sky司机的照片。

The application code (simplified) below used to work until a few days ago. Now when we try to access the imageStream (or any other information captured in a callback) we get a System.Argument exception (HResult = -2147024809, "Value does not fall within the expected range", but as usual the offending value is not mentioned). We checked our code base and there were no code changes in this area of the product recently.

是否发生了任何变化? 是否有办法(Fiddler,但对于非E的申请)检查网络的交通,希望从服务器传送更多的信息? 是否有任何地方价值观可能受到干扰?

Here s the relevant code:

public partial class OptionsPage : PhoneApplicationPage
{
    private LiveConnectClient _liveClient = null;

    public OptionsPage()
    {
        InitializeComponent();
    }

    private void OnSessionChanged(Object sender, LiveConnectSessionChangedEventArgs args)
    {
        if (args != null && args.Session != null && args.Session.Status == LiveConnectSessionStatus.Connected)
        {
            this._liveClient = new LiveConnectClient(args.Session);
        this.GetUserPicture();
        }
    }

    private void GetUserPicture()
    {
        var memoryStream = new MemoryStream();
        _liveClient.DownloadCompleted += new EventHandler<LiveOperationCompletedEventArgs>(this.GetUserPictureCallback);
        _liveClient.DownloadAsync("/me/picture?return_ssl_resources=true", memoryStream, memoryStream);
    }

    private void GetUserPictureCallback(object sender, LiveOperationCompletedEventArgs e)
    {
        _liveClient.DownloadCompleted -= this.GetUserPictureCallback;

        try
        {
            if (e.Error == null)
            {
                MemoryStream imageStream = e.UserState as MemoryStream;
                BitmapImage b = new BitmapImage();
                b.SetSource(imageStream);
            }
            else
            {
                MessageBox.Show(e.Error.Message, "Windows Live Error", MessageBoxButton.OK);
            }

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message, "SkyDrive Exception", MessageBoxButton.OK);
        }
    }
}

签字国的定义如下:

        <live:SignInButton Content="Button" Height="65" HorizontalAlignment="Left" Margin="110,41,0,0"
            Name="signInButton1" VerticalAlignment="Top" Width="215" ClientId="[REAL_CLIENT_ID]" 
            Scopes="wl.offline_access wl.signin wl.basic wl.skydrive wl.skydrive_update"
            RedirectUri="https://oauth.live.com/desktop"
            Branding="Skydrive"
            TextType="SignIn"
            Background="Red"
            SessionChanged="OnSessionChanged" />
最佳回答

It appears that I was using the Beta version of the Live Connect SDK 5.0. Once I upgraded to the RTM version (and made the code changes required) it started working again.

问题回答

暂无回答




相关问题
Why does this exception claim the code doesn t write data?

If you run this code it will throw a WebException. The inner exception is "Content-Length or Chunked Encoding cannot be set for an operation that does not write data." and I do not understand the ...

API for Microsoft OneNote 2010 + SkyDrive Web Services?

I am quite familiar with the Microsoft OneNote 2007 and 2010 APIs, however these interface directly with OneNote itself. In 2010 we have the great facility of syncing OneNote with SkyDrive. This works ...

Access Microsoft Live services from Python application

I need to access microsoft skydrive from my python app. Is there a SOAP or REST service that Microsoft provides for developers? If there is no web service, does any python library that allows to ...

Silverlight and skydrive/dropbox

Can You read/write a file in your Skydrive with Silverlight? Or if that isn t possible, can you dot it with Dropbox? thanks, Filip

Problem connecting to OneDrive File Picker v8

I m trying to integrate the OneDrive File Picker v8 API into a SPA project but I keep getting an error in connecting to the picker which I can t decipher. Here s what the error from the popup window ...

热门标签