Andrew, thanks for the BUILD session, very helpful. I found the points in the code that needed changing in order to get the code to run and save the attachment locally.
I am a bit lost on the ClientID and ClientSecret. In order to get the SharePoint integration to work is that necessary in a development environment? Do I have to go through the Reseller Dashboard and create the URLs and actually host it externally just to get
the demo to write to my OneDrive?
Apr 27, 2014 at 9:29 AM
Following from Andrew, just working as a middle man...
Check out this article:
and this blog post:
. You need to register a website app in Azure AD, which will provide you a client id/secret to do oauth and
actually get an access token to call into SharePoint.
The first article will walk you through registering Azure AD for your Office 365 tenant (don’t worry about putting in your credit card info – you won’t be charged). After you have added it, you can skip the step “create organizational account” and instead go
to the step “manually register your web app…”. Once done with those steps, you’ll have a client id and secret, which you can plug into my code sample. For the callback URLs, if you are running the sample out of VS and on your local computer, use this SSL URL
that visual studio provides to your app (you’ll need to add \OAuthRedirect.html to that url – that’s the callback URL).
After that, make sure you specify the right resource id, or just use the discovery API to discover the right id. Finally, note that I use a static class to store the OAuth token in. This work for my demo, but I’m not sure it’ll work when you have multiple users
hitting the system. You need a token cache, but unfortunately HttpSession object is null for Web API, since they’re supposed to be stateless.