GithubHelp home page GithubHelp logo

liveservices / livesdk-for-windows Goto Github PK

View Code? Open in Web Editor NEW
106.0 48.0 183.0 3.91 MB

LiveSDK library for integrating with Live Connect

License: MIT License

C# 88.92% CSS 1.75% ASP 0.04% JavaScript 6.53% HTML 2.38% PHP 0.37%

livesdk-for-windows's Introduction

Annoucement: There's a new OneDrive SDK

The Live SDK has been replaced by the OneDrive API and OneDrive SDK for C#. All new projects should use the OneDrive API to integrate with OneDrive instead of Live SDK.

This Live SDK project will remain available for existing applications to continue to use but new application development should be done using the OneDrive SDK.

LiveSDK for Windows and Windows Phone (legacy)

version 5.6

  1. Introduction

The Live SDK for Windows and Windows Phone library is intended to help developers to easily integrate OneDrive and Outlook.com contacts into their Windows Runtime apps (HTML and XAML).

The Live SDK enables access to users’ identity profile info and allows your apps to:

  • Upload and download photos, videos, documents, and other files in OneDrive
  • Personalize your users’ experience
  • Take advantage of single sign-on using Microsoft Account in Windows 8.1 and Windows Phone 8.1
  • Create, read, and update contacts, calendars, and events in Outlook.com
  1. Reference the SDK

  • Install the Live SDK from the download site
  • Open your app's project in Visual Studio
  • In Solution Explorer, right-click References > Add Reference
  • For Windows Runtime HTML apps: Click Windows > Extension SDKs and select both Live SDK and Windows Library for JavaScript 2.1. Further details available here
  • For Windows Runtime XAML apps: Click Windows 8.1 or Windows Phone 8.1 > Extensions and select Live SDK. Further details available here

To use the SDK in a Windows Store app with single sign-in (the default), you need to register the application with the Windows Store. Failing to register the app will generate a runtime exception when logging in with the SDK. For more information about how to register with the Windows Store, click here

  1. Documentation

Visit: http://dev.onedrive.com.

  1. Sample code

Windows Store App Samples

  • Includes samples for HTML and XAML apps for Windows and Windows Phone

Desktop Samples

  • API Explorer: Authenticates user and uploads and downloads files

Web Samples

  • 3 samples that demonstrate authentication and OAuth with ASP.Net or PHP

Windows Phone 8 Samples

  • 5 samples that demonstrate authentication and core concepts (upload, download, etc)

livesdk-for-windows's People

Contributors

aclev avatar fishofprey avatar ginach avatar gusper avatar jeanine-msft avatar liwa avatar msftjayongg avatar peternied avatar rgregg avatar th3br41n avatar xiaomi7732 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

livesdk-for-windows's Issues

How to add a share link to my shared list

Hi

I want to add a edit link created by my friends to my shared list by using LiveAPI.
But it seems that there is not such API to do it, all I can do is run IE and navigate to that link and then click "Add to my Shared list".

Could you please provide a interface to add a link to my Shared list?

Thanks

Unhandled NullReferenceException due to missing resource

The defect is that while ApiOperation can create a LiveConnectException exception for NoResponseData errors...

https://github.com/liveservices/LiveSDK-for-Windows/blob/master/src/Common/Source/Internal/Operations/ApiOperation.cs#L128

...there is no corresponding NoResponseData resource here (and probably the other resource files/platform targets)...

https://github.com/liveservices/LiveSDK-for-Windows/blob/master/src/WinStore/Source/Resources.resx

...so, the following line blows up as a null ref exception because you're trying to grab a resource that doesn't exist...

https://github.com/liveservices/LiveSDK-for-Windows/blob/master/src/WinStore/Source/Internal/ResourceHelper.cs#L46

...thus, NoResourceData errors result in NullReferenceExceptions, which is incorrect.

Will throw exception when used in a UWP compiled with .net native

I use LiveSDK in a UWP . When I add the lib manually it works nicely. But only if I deactivated .net native. Otherwise it will crash. The exceptions logged aren't really helpful, eg:

at MoneyManager.Windows!<BaseAddress>+0xbd7629
   at MoneyManager.Windows!<BaseAddress>+0xbd7b4d
   at MoneyManager.Windows!<BaseAddress>+0x8311d9
   at MoneyManager.Windows!<BaseAddress>+0x82896d
   at MoneyManager.Windows!<BaseAddress>+0xc23fef
   at MoneyManager.Windows!<BaseAddress>+0xc23e15
   at MoneyManager.Windows!<BaseAddress>+0xc141fb
   at MoneyManager.Windows!<BaseAddress>+0xc140b3
   at MoneyManager.Windows!<BaseAddress>+0xc13bb3
   at MoneyManager.Windows!<BaseAddress>+0xc246d3
   at MoneyManager.Windows!<BaseAddress>+0xa2dcb3
   at System.Dynamic.ConvertBinder.Bind(Dynamic.DynamicMetaObject target, Dynamic.DynamicMetaObject[] args)
   at System.Dynamic.DynamicMetaObjectBinder.Bind(Object[] args, Collections.ObjectModel.ReadOnlyCollection<System.Linq.Expressions.ParameterExpression> parameters, Linq.Expressions.LabelTarget returnLabel)
   at MoneyManager.Windows!<BaseAddress>+0x8c6bc7
   at MoneyManager.Windows!<BaseAddress>+0x8b306f
   at MoneyManager.Windows!<BaseAddress>+0xa2a25f
   at MoneyManager.Windows!<BaseAddress>+0xa2a02d
   at MoneyManager.Windows!<BaseAddress>+0xc31b31
   at MoneyManager.Windows!<BaseAddress>+0xc319d1
   at MoneyManager.Windows!<BaseAddress>+0xc31c71
   at MoneyManager.Windows!<BaseAddress>+0x7ffced
   at MoneyManager.Windows!<BaseAddress>+0x7ffba3
   at MoneyManager.Windows!<BaseAddress>+0x6d5087
   at System.Func<System.Action<System.Runtime.CompilerServices.CallSite,System.Object,System.Object>>.Invoke()
   at MoneyManager.Windows!<BaseAddress>+0x98a017
--- End of stack trace from previous location where exception was thrown ---
   at MoneyManager.Windows!<BaseAddress>+0x775989
   at MoneyManager.Windows!<BaseAddress>+0x775ccd
   at MoneyManager.Windows!<BaseAddress>+0x81da49
   at MoneyManager.Windows!<BaseAddress>+0x81d9e9
   at MoneyManager.Windows!<BaseAddress>+0x81d9cb
   at MoneyManager.Windows!<BaseAddress>+0x98ae4b
--- End of stack trace from previous location where exception was thrown ---
   at MoneyManager.Windows!<BaseAddress>+0x775989
   at MoneyManager.Windows!<BaseAddress>+0x775ccd
   at MoneyManager.Windows!<BaseAddress>+0x98cecd

Custom avatars cannot be loaded, the default one works fine

When I run APIExplorer sample app for Windows 8.1, and my account doesn't have a custom picture, it loads just fine. When I change it to some custom image, it doesn't work anymore. App is associated with windows store application.

I've tried it both ways, first one (that's how it's by default):

            try
            {
                LiveDownloadOperation operation = await this.liveClient.CreateBackgroundDownloadAsync("me/picture");
                LiveDownloadOperationResult result = await operation.StartAsync();
                if (result != null && result.Stream != null)
                {
                    using (IRandomAccessStream ras = await result.GetRandomAccessStreamAsync())
                    {
                        BitmapImage imgSource = new BitmapImage();
                        imgSource.SetSource(ras);
                        this.imgMe.Source = imgSource;
                    }
                }
            }
            catch (LiveConnectException e)
            {
                this.tbResponse.Text = e.ToString();
            }

Another one:

            LiveOperationResult operationResult = await liveClient.GetAsync("me/picture");
            dynamic result = operationResult.Result;
            BitmapImage image = new BitmapImage(new Uri(result.location, UriKind.Absolute));
            this.imgMe.Source = image;

The cause might be that when I have no avatar, location (returned by me/picture) is https://js.live.net/static/img/DefaultUserPicture.png. But when I change it to something, it changes to some redirect link (it looks like this): https://cid-xxxxxx.users.storage.live.com/users/xxxxx/myprofile/expressionprofile/profilephoto:UserTileStatic. This Url actually gives a "Log In" page html code.

Why LiveAuthRequestUtility.RefreshTokenAsync() is not public?

Hi,
Why LiveAuthRequestUtility.RefreshTokenAsync() is not public?
Here http://msdn.microsoft.com/en-us/library/dn631817.aspx (Windows desktop apps documentation) says "Tip If the wl.offline_access scope is specified, a refresh token is also provided.
Your app can read the authorization code from the returned URL, and use it to retrieve an access token by making a call that passes a URL similar to this one."
The SDK is doing it, in LiveAuthRequestUtility.RefreshTokenAsync() but this class is internal.
Why it is not public? It will allow custom code to simply call LiveAuthRequestUtility.RefreshTokenAsync() to get a fresh valid session object.
Thanks

You have to register your app with the Windows (Phone) Store

If you create a new app from scratch and try to use the Live SDK, you're going to get an unhandled exception when you try to authenticate. This is because you have to register your app with the Windows/Windows Phone store. This is easy to do in Visual Studio 2013 by right clicking your Project > Store > Associate app with the store... and following the wizard.

I wasted a couple of hours trying to figure this out, because as far as I can tell it's not actually documented anywhere, and the SDK samples "just work" with no indication that this is a prerequisite.

Lack of login_hint param

I have realized that the sdk doesn't implement the login_hint param, however if I build the oAuth URL and concat the login_hint param in the query string It works.

Are you working on this feature? is there a way to implement it?

With SDK I mean the JavaScript API

Nuget Package is still using custom IProgress<T> in .NET 4.5

I use Nuget Package in my .NET 4.5 app, and the Microsoft.Live.dll seems to still reference to assembly System.Runtime, Version=2.5.19.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a because of the IProgress<T> that is absent in .NET 4.0. Would it be possible to update the Nuget Package to include special version for .NET 4.5 that would get rid of the no-longer-required dependencies, so I can use IProgress<T> from the .NET 4.5 mscorlib?

OneDrive SDK does not support notifications (toast+tile) for background transfers

I would suggest to trigger an event just after the creation of a Background task (download and/or upload). This could allow developers to set advanced options for the just-created background task (e.g., FailureTileNotification, SuccessTileNotification).

For example in the file CreateBackgroundDownloadOperation.cs, the method OnExecute() could be:
protected async override void OnExecute()
{
[...]
var downloader = new BackgroundDownloader();
if (this.LiveClient.OnCreateBackgroundDownloader!=null) {
this.LiveClient.OnCreateBackgroundDownloader(this.LiveClient, this.Url, downloader);
}
[...]
}

System.Windows.FrameworkElement.Style

Hi

Getting the following error when I drop a SignInButton onto a wp8 xaml form:

Error 5 Failed to assign to property 'System.Windows.FrameworkElement.Style'. [Line: 65 Position: 16]

NullReferenceException at Microsoft.Live.ResourceHelper.GetString()

Hi, I've created an empty windows phone 8.1 application and trying to make Live auth.

I getting error:

   "An exception of type 'System.NullReferenceException' occurred in Microsoft.Live.DLL" 

with following stack ('Show Parameter Values' is turned on in Visual Studio call stack):

Microsoft.Live.DLL!Microsoft.Live.ResourceHelper.GetString(string name = "UrlInvalid")  
Microsoft.Live.DLL!Microsoft.Live.LiveAuthClient.LiveAuthClient(string redirectUri = "0000000048087CFD")    

It seems that some internal resource string "UrlInvalid" is missing and exception with another type should be raised. I use latest verson from nuget, that is Live SDK 5.6.1

My code looks like this:

    private void InitializePage()
    {
        try
        {
            this.authClient = new LiveAuthClient("0000000048087CFD"); // <-- Exception here
             // other code
        }
        catch (LiveAuthException authExp)
        {
            this.tbResponse.Text = authExp.ToString();
        }
    }

Numerous examples but little documentation on where to put clientid and secret. Errors running each sample

I searched with in the code to find string locations for ClientId and ClientSecret and found them and put my ClientId and ClientSecret strings but in both the desktop sample and the Web sample, problems occurred and I could not figure out how to get past them. There is no help in getting started with these samples.

"We're unable to complete your request
Microsoft account is experiencing technical problems. Please try again later."

It looks like an error in the string.

https://login.live.com/oauth20_authorize.srf?00000000441236CC=00000000441236CC&redirect_uri=https%3A%2F%2Flogin.live.com%2Foauth20_desktop.srf&scope=wl.skydrive&response_type=code&display=windesktop&locale=en-US&state=&theme=win7

I noticed my ClientId is repeated twice in the string above..

Here is another piece of code that does not seem correct:
///

    /// Initializes an instance of LiveAuthClient class.
    /// </summary>


    /// <param name="clientId">The client Id of the app.</param>
    /// <param name="clientSecret">The client secret of the app.</param>
    public LiveAuthClient(string clientId)
        : this(clientId, null)
    {
    }

There are two param names but only one parameter is used...

Import email contact to websie

I have not tried it. I want to know if this script can be used to get/import user email? This will be used for website. Thanks in advance!

How to keep access token valid or refresh it?

Once authenticated, I can build a url to a resource by doing the following, where item is a file object from a GetAsync call, and client is an instance of LiveConnectClient.

string.Format(@"https://apis.live.net/v5.0/{0}/content?access_token={1}", item.Id, client.Session.AccessToken);

However, after about 60 minutes, a request for the resource returns the following json. I say 'about' 60 minutes, because I wasn't able to find any documentation stating how long the access tokens are valid for, so this is a guess based on experimentation.

{
   "error": {
      "code": "request_token_expired", 
      "message": "The access token that was provided has expired."
   }
}

Using this LiveSDK for windows, how can a new access token be generated? Also, is there a way to do the same via the REST API? I didn't see any documentation on how to refresh the token. Looking at the source in this repo was also unclear. It seems as LiveAuthClient.TryRefreshToken creates a new session? Is this something I should be doing in my own code?

Server is always offline when moving non-existent file

This is a little corner case and I am afraid it's not really a problem of this library (but rather server-side bug), but hopefully the issue could get delegated to the proper department.

  • Let's say I create 2 folders in the OneDrive root, whose IDs are stored in folder1 and folder2 variables.
  • I upload new file to folder1, and store the file's ID in file1 variable
  • I delete the file and both folders on the OneDrive storage
  • I try to move file1 to folder2, despite the fact that neither of them exists

Now, I would expect the library to throw an exception pretty soon (as the request hits the server and response returns) stating that file1 and folder2 do not exist, but instead I have to wait for a timeout and then I get the following exception:

image

WinStore: Crash at Microsoft.Live.ResourceHelper.GetString(String name)

WinStore: Crash at Microsoft.Live.ResourceHelper.GetString(String name)

My WinStore app's UnhandledException handler received exception from LiveSDK (version 5.6.2.0, see full stack trace below). It happens when no internet exception. I can't use try/cath to catch it since TryRefreshToken is async VOID method and my app crashes.
Similar problem: https://social.msdn.microsoft.com/Forums/en-US/e897a135-52c7-45c3-bab9-2ee94803d876/systemnullreferenceexception-while-calling-c-runtime-component-from-javascript?forum=winappswithcsharp
and here: http://stackoverflow.com/questions/15656966/nullreferenceexception-while-calling-loginasync
and here: https://social.msdn.microsoft.com/Forums/onedrive/en-US/756926c9-6bdb-4336-913e-b3a05bd686d9/liveauthclient-initializeasync-exception?forum=messengerconnect
and more...

Why resources are missing?

UNHANDLED EXCEPTION: Object reference not set to an instance of an object.
at Microsoft.Live.ResourceHelper.GetString(String name)
at Microsoft.Live.Operations.ApiOperation.CreateOperationResultFrom(WebResponse response)
at Microsoft.Live.Operations.ApiOperation.OnWebResponseReceived(WebResponse response)
at Microsoft.Live.Operations.WebOperation.OnGetResponseCompleted(IAsyncResult ar)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CaptureOrComplete(ExecutionContext& cachedContext, Boolean returnContext)
at System.Net.ContextAwareResult.FinishPostingAsyncOp()
at System.Net.HttpWebRequest.BeginGetResponse(AsyncCallback callback, Object state)
at Microsoft.Live.Operations.ApiOperation.OnExecute()
at Microsoft.Live.Operations.Operation.InternalExecute()
at Microsoft.Live.Operations.ApiOperation.OnRefreshTokenOperationCompleted(LiveLoginResult result)
at Microsoft.Live.LiveAuthClient.d__e.MoveNext()

download / upload windows phone 8.1

I try to use the Live SDK to upload a file to OneDrive.
All the methods I tried on the Windows Phone result in "this method is not implemented"

and the examples on the internet mainly describe "UploadAsync" but this method is gone in the latest version of the SDK

Secret keys list was hard-coded when decoding authentication token

The issue is in currently the latest commit, version 5.4: 90604b5

When Windows Live returns me the authentication code, running

liveLoginResult = await liveAuthClient.ExchangeAuthCodeAsync(HttpContext);

throws exception

Could not find key with id 1

After that I looked into the code, and I found that in function DecodeAuthenticationToken, secret keys list was hard-coded (see here). The key of the only item was hard-coded to 0.

But when validating the token (see here), there is a Envelope.KeyId, which indicates the version number of the client secret key. This number could be increased as you click Create a new client secret in API Settings of Live Connect Developer Center.

As the hard-coded 0 and Envelope.KeyId mismatches, the exception was thrown. But I don't think the token is invalid.

Possibly null ref exception after remote tos update

I was working on my app tonight, using a VM that had been open for several days, using an account that had previously been working fine to connect to OneDrive.

Tonight, attempting to authenticate with that account threw a null reference exception. I thought maybe live services was down, but everything was green. I logged in with another account and noticed that there was a mandatory TOS update acceptance screen.

I killed the VM and logged in to the same (problem) account on a fresh VM... and got an updated TOS screen during authentication. Then everything was fine.

Therefore, I'm guessing there's an edge case around this, where maybe an account already has an auth token and it's now invalid due to updated TOS, or another scenario where the new TOS hasn't yet been accepted but the SDK can't handle the rejected auth.

newbie unable to clone repository to local disk

I've installed git, git bash, GitHub and god knows what else in trying to download a git repository from GitHub. Help would be most appreciated!
Error cloning sample:

C:\Users\W.Mark\Documents\Source\livesdksamples [master]> git clone https://github.com/liveservices/LiveSDK-for-Windows/tree/master/src/WP8/Samples LiveSamples
Cloning into 'LiveSamples'...
fatal: repository 'https://github.com/liveservices/LiveSDK-for-Windows/tree/master/src/WP8/Samples/' not found
C:\Users\W.Mark\Documents\Source\livesdksamples [master]>

Subscribe calendar in windows phone

i have looked at here https://msdn.microsoft.com/en-us/library/hh826523.aspx i want to subscribe my outlook calendar in my app by user i have added wl.calendars_update scope. i dont know where to put my subscribe url of calendar. i have replaced my url of calendar with this webcal://ical.mac.com/fredduck/Anime47Game32Birthdays.ics url as showed in code
Here is code:
private async void btnSubscribe_Click(object sender, RoutedEventArgs e)
{
try
{
LiveConnectClient liveClient = new LiveConnectClient(this.session);
var calendar = new Dictionary<string, object>();
calendar.Add("name", "Anime/Game Character Birthdays");
calendar.Add("subscription_url", "webcal://ical.mac.com/fredduck/Anime47Game32Birthdays.ics");
LiveOperationResult operationResult = await liveClient.PostAsync("me/calendars", calendar);
this.infoTextBlock.Text = "Calendar subscribed.";
}
catch (LiveConnectException exception)
{
this.infoTextBlock.Text = "Error subscribing to calendar: " + exception.Message;
}
}

it subscribe only name of calendar. it doesnt subscribe the all agenda and events of my calendar please help me. sorry for my bad english. simply i just want to subscribe my calendar with my app users.

UploadOperation is using unnecessary GetUploadLinkOperation

After going through the code of UploadOperation.cs and GetUploadLinkOperation.cs, is it actually necessary to issue a separate web request to get the upload link? According to MSDN, it is perfectly valid to generate the upload link client-side, by simply using the following format:

https://apis.live.net/v5.0/{ID}/files/

Where {ID} is folder ID, such as folder.ca1234567ad234c2.

Constructing the upload link in code (instead of issuing a dedicated request to the server) would be much faster and also cleaner solution.

Server does not seem to be 100% consistent

So over the last few days I was doing a lot of testing and debugging, including uploading over 10 000 files to OneDrive (all pretty much into a single directory). However, at 8 occasions the server replied that the directory does not exist, even though it clearly 100% does exist (since I uploaded thousands of files to that very directory before and after...). To upload all those files, I always had about 100 outstanding requests, but these "folder does not exist" errors were almost always completely isolated instances. Twice, I got 2 of these error in succession.

I have no idea what could be the cause of such issue and it is very hard to reproduce, but it worries me greatly because whenever I get a response that "directory does not exist", I can no longer be 100% sure that it really does not exist... So should I always check 2 or 3 times whether the folder really does not exist, so the probability of error is super low? That would inflate the request count a lot...

Not possible to add to a PCL or Universal App component

When creating either of these types of projects, and installing the LiveSDK via nuget, the package shows as installed successfully and shows up in packages.config, but Microsoft.Live does not show up in the project references list, not is it accessible in code.

LiveAuthClient.ExchangeAuthCodeAsync doesn't seem to handle errors properly

In the Microsoft.Live.Desktop.Samples.ApiExplorer, when I modify MainForm.OnAuthCompleted line

LiveConnectSession session = await this.AuthClient.ExchangeAuthCodeAsync(result.AuthorizeCode);

to

// Use garbage code to test error handling
LiveConnectSession session = await this.AuthClient.ExchangeAuthCodeAsync("j93r0293kr0293kr");

The line after await never executes. If I rewrite the line to:

LiveConnectSession session = this.AuthClient.ExchangeAuthCodeAsync("j93r0293kr0293kr").Result;

the code throws a TargetInvocationException in Program.cs on the line:

Application.Run(new MainForm());

How to get additional audio metadata properties?

Using the SDK to get Onedrive file properties, I see that there are several pieces of metadata missing compared to what's available on the Onedrive website.

For example, while the SDK returns album, albumArtist, artist, duration, genre, and title, an ajax call on the Onedrive website shows that the returned json there has these properties as well as composers, copyright, disc, discCount, track, year.

I'm afraid this may be a limitation of the SDK and the only way to get these properties will be to scrape the Onedrive website or fabricate my own json call and then deserialize the results myself, but I'd love to be shown wrong or to get some guidance on how to acquire these additional properties. For example, is there any kind of "extended metadata" query string parameter?

Request throttling

I have the need to upload many (thousands) small files to OneDrive, to various folders. I also need to achieve high throughput/bandwidth.

Since the LiveSDK API is all asynchronous, I was hoping that I could get reasonable performance by executing dozens of requests (upload/create folder) at the same time, and adding more as soon as some finish.

However, it seems that the server is throttling the clients a lot. It seems to add all the requests into a single sequential queue and respond to the requests at a rate of about 1 response per second (not counting the time it takes to actually upload the files). For example, if I want to create 20 folders, I execute 20 LiveConnectClient.PostAsync at once and then await all the Tasks, but I have to wait for about 20 seconds because the requests become sequential at the server.

What also happens is that some of my asynchronous operations begin to time out, since the server does not respond in timely fashion (since the queue is too large). Furthermore, I start getting LiveConnectException stating that:

ErrorCode: request_throttled
Message: The request wasn't made because the same type of request was repeated too many times. Wait X seconds and try again.

The server increases X if I do not actually wait at least X. Now, since all my requests are asynchronous, when I am told to wait X, some other request is just hitting the server and increasing the X at the server to Y (Y > X). So after waiting X, the server tells me to wait Z (Z > Y; because I did not wait Y), and the cycle repeats over and over again, basically having the client wait indefinitely. I guess this could be solved by having some layer built on top of LiveSDK that would handle the request_throttled exceptions on all requests and keeping track of what the actual wait time should be, but the error text says that:

because the same type of request was repeated too many times

So I would like to ask, what does qualify as the "same type of request"? If I get "request_throttled" while uploading a file, does this "wait" apply to all "upload" requests, or just for that particular file, folder, etc.?? How coarse-grained is this criterion?

I understand why these "wait" mechanisms are in place, but it does make the development significantly more complicated. So I would like to ask, what is the recommended solution for this issue? How to achieve high throughput when I need to upload thousands of small files? How to keep the server happy so it does not to mark my client as rogue/DDoS?

And finally, it would be REALLY good if the SDK supported something like "request coalescing". I would like to bundle uploading of dozens of files into a single request. It could easily work by specifying all the uploaded files in the request header, along with an "offset" and "length" of the file contents in the request data stream. And the request data stream would just contain concatenated file contents of all the files to upload. This would bring the number of requests to minimum, and also achieve very high bandwidth.


Issues described in this post do not relate in any way to my previous issue Server is always offline when moving non-existent file. They are completely separate instances.

Bug with the embedded resources

When for instance there is a network problem (timeout) the code tries to get a resource ("ConnectionError"), but that fails (see below). Seems to have something todo with the Custom Tool NameSpace on de resources.resc file. If I remove the namespace it works.

Exception:

An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in System.dll

Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Microsoft.Live.Resources.resources" was correctly embedded or linked into assembly "Microsoft.Live.Web" at compile time, or that all the satellite assemblies required are loadable and fully signed.

Max results for search query?

When I construct a search query

int offset = ...
int limit = ...
var operation = await client.GetAsync(string.Format("/me/skydrive/search?offset={0}&limit={1}&q=txt", offset, limit));

I get results as expected within per the offset and limit parameters (the client is authenticated, connect, and has the appropriate scopes for OneDrive access).

However, when I increment offset to 500, I no longer get ANY results. I know that I have more than 500 files matching the search term in my OneDrive account. If I drop offset to 499, I'll get results. But >= 500, nothing.

Similarly, if I keep offset low, but then set limit to something over 500, I still get < 500 results (eg, offset = 100, limit = 500, result count = 400)

Again... I know there are greater than 500 exactly this many files, because I put them in there.

What the heck is going on? How can I get results past number 500? How could I get file number 501 via search?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.