Ms office Office 365 API:使用客户端库的Windows 8应用程序

Ms office Office 365 API:使用客户端库的Windows 8应用程序,ms-office,preview,office365,Ms Office,Preview,Office365,我正在尝试使用上提供的客户端库运行Windows 8应用程序示例,但出现以下错误 值不能为null。参数名称:serviceContext 已创建专用异步任务 { var authenticator = new Authenticator(); var result = await authenticator.AuthenticateAsync("MyFiles", ServiceIdentifierKind.Capability); // Cr

我正在尝试使用上提供的客户端库运行Windows 8应用程序示例,但出现以下错误

值不能为null。参数名称:serviceContext

已创建专用异步任务 {

        var authenticator = new Authenticator();
        var result = await authenticator.AuthenticateAsync("MyFiles", ServiceIdentifierKind.Capability);

        // Create a client proxy:
        this.client = new SharePointClient(result.ServiceUri, result.GetAccessToken);
        this.client.Context.IgnoreMissingProperties = true;
    }

    /// <summary>
    /// Populates the page with content passed during navigation. Any saved state is also
    /// provided when recreating a page from a prior session.
    /// </summary>
    /// <param name="sender">
    /// The source of the event; typically <see cref="NavigationHelper"/>
    /// </param>
    /// <param name="e">Event data that provides both the navigation parameter passed to
    /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
    /// a dictionary of state preserved by this page during an earlier
    /// session. The state will be null the first time a page is visited.</param>
    private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
    {
        Exception exception = null;

        try
        {
            this.DefaultViewModel["Items"] = new[] { new { Primary = "Loading...", Secondary = "Please wait..." } };

            IOrderedEnumerable<IFileSystemItem> files = await GetOneDriveFiles();

            if (files == null)
            {
                this.DefaultViewModel["Items"] = null;
            }
            else
            {
                this.DefaultViewModel["Items"] = files.Select(file => new
                {
                    Primary = file.Name,
                    Secondary = "Last modified on " + ToLocalTimeString(file.TimeLastModified)
                });
            }
        }
        catch (Exception ex)
        {
            exception = ex;
        }

        if (exception != null)
        {
            await ShowErrorMessageAsync(exception.Message);
        }
    }

    private async Task<IOrderedEnumerable<IFileSystemItem>> GetOneDriveFiles()
    {
        await EnsureClientCreated();

        // Obtain data:
        var filesRequest = await this.client.Files["Shared with Everyone"].ToFolder().Children.ExecuteAsync();
        var files = filesRequest.CurrentPage.OrderBy(e => e.Name);
        return files;
    }

有什么想法吗?

您可以尝试使用当前的工具版本,可以在这里找到:
如果这不能解决问题,那么查看导致问题的特定API调用的HTTP跟踪将很有帮助。

我按照您的链接连接到sharepoint online。但仍然会收到该错误。