1

I'm really not experienced in this subject, and I can't seem to find out where to quite start.

I'm trying to read data from a list on SharePoint 13 (365 Preview) into a WinRT App. I added a Service Reference to mysite.sharepoint.com/_vti_bin/listdata.svc and it added correctly. From there I built this wrapper for getting the a list asynchronously:

private Task<IEnumerable<MyListItems>> GetMyListAsync()
{
    var tcs = new TaskCompletionSource<IEnumerable<MyListItems>>();
    var sharepointContext =
        new WelcomescreentestTeamSiteDataContext(
            new Uri("https://mysite.sharepoint.com/_vti_bin/listdata.svc"))
        {
            Credentials = new NetworkCredential("user.name", "pass.word", "mysite.onmicrosoft.com")
        }; ;
    try
    {
        sharepointContext.MyList.BeginExecute(asyncResult =>
        {
            try
            {
                var result = sharepointContext.MyList.EndExecute(asyncResult);
                tcs.TrySetResult(result);
            }
            catch (OperationCanceledException ex)
            {
                tcs.TrySetCanceled();
            }
            catch (Exception ex)
            {
                if (!tcs.TrySetException(ex))
                {
                    throw;
                }
            }
        }, new object());
    }
    catch (Exception ex)
    {
        tcs.TrySetException(ex);
        tcs.SetCanceled();
    }

    return tcs.Task;
}

I've changed the username / domain around quite a bit, but nothing seems to work.

What's the right approach here?

I've built in a SAML-based security approach which works, but I'm still wondering why this isn't working.

4

0 回答 0