0

Having a problem with access to "OneDrive for business" using this api https://msdn.microsoft.com/EN-US/library/office/dn531433.aspx

First we're using https://msdn.microsoft.com/en-us/library/azure/dn645542.aspx to get access and refresh tokens.

Second step is we making request to discovery resource
ht tps://api.office.com/discovery/v1.0/me/services
to get resources available to user using access token from first step. In response we have two items - 'MyFile' and 'RootSite'. Some pieces of response listed below:

[{u'@odata.editLink': u"services('MyFiles@O365_SHAREPOINT')",
  u'serviceResourceId': u'ht tps://[our_tenant]-my.sharepoint.com/',
  ...},
 {u'@odata.editLink': u"services('RootSite@O365_SHAREPOINT')",
  u'serviceResourceId': u'h ttps://[our_tenant].sharepoint.com/',
  ...}]

Third step we making refresh_token request for MyFiles resource to get access and refresh token that could be used to communicate with current resource.

Finally with new set of tokens we're making request to
ht tps://[our_tenant]-my.sharepoint.com/_api/web/lists It returns me list that looks like this:

  • Form Templates
  • Organization Logos
  • Style Library
  • User Photos

But when I accessing
ht tps://[our_tenant]-my.sharepoint.com/
from web using browser content is completely different:

  • My Custom Folder
  • Shared With Everyone
  • screens

When using api v2 for discovery request and api v2 resource from discovery response and this api
ht tps://dev.onedrive.com/drives/default.htm content that returned is correct.

So the question is next - is it possible to use api from first link(accessing items with such endpoints ht tps://[our_tenant]-my.sharepoint.com/_api/web/lists) to work with "OneDrive for business"?

2

It is possible to use https://[our_tenant]-my.sharepoint.com/_api/web/lists endpoints with OneDrive. But you cannot do it through a site or site collection, you need to write this code in a SharePoint App(SharePoint hosted also works) with tenant permissions. and deploy it from app catalog, does not work from an app deployed to a developer site through VS. Here is what I followed and Succeeded. MSDN Forum

  • Thanks for answer. But because I'm newbie in SharePoint ecosystem want to ask further questions. We developing service which is going to communicate with different SP customers. Communication is going to be using SP api I've mentioned(_api/web/lists...). In short calling api from our server using python language. So to be able to get 'onedrive for b.' content through lists api some actions needed to be done on customer side(application)? No way to use it as easy as v2 api but in '_api/web/lists' way? Sorry if questions sound stupid) – Kirill Skryaga Sep 16 '15 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.