0
votes

My (first) android app is working quite nicely but i am left with 1 very major issue i am trying to solve for several days now

I am trying to use Graph to access an Excel document in my OneDrive from another account. This file is declared public to all by a sharing link.

I am using the next GET to retrieve the file

https://graph.microsoft.com/v1.0/drives/MY_DRIVE/MY_EXCEL_FILE/workbook/worksheets/Data/tables/TableData/rows

The only problem is that the file must be on the user shared folder which i would like to avoid for security reasons.

I am using onedrive for business but if that is a problem, i can use a personal account, though the users of the app must use business since i grant access only to a certain organization.

[UPDATE Sep-27 2018]

With regards to the file shouldn't need to be in a shared folder, the following is the why I think this (I hope I'm wrong):

  1. while in my business onedrive account, i share the file as public and retrieve the sharing link:

    https://MY_ORGANIZATION.sharepoint.com/:x:/g/personal/MY_USER/Eabkxa2md3JEsW0qQEuYRK4BKnnnHeJqNuspeZ6TEdkWsQ
    
  2. I enter Graph Explorer and run the command to retrieve same file as excel JSON:

    https://graph.microsoft.com/v1.0/drives/MY_DRIVE/MY_EXCEL_FILE/workbook/worksheets/Data/tables/TableData/rows
    
  3. Graph explorer replys with an HTTP 200 and the correct JSON (as noted, also working correctly on my android app).

  4. I log out from Graph Explorer and OneDrive and make sure the shared link is still working.

  5. I connect Graph Explorer using a different account (same organization) and run the same command to retrieve excel JSON:

    https://graph.microsoft.com/v1.0/drives/MY_DRIVE/MY_EXCEL_FILE/workbook/worksheets/Data/tables/TableData/rows
    
  6. This time i get "Failure - Status Code 404":

    {
        "error": {
            "code": "itemNotFound",
            "message": "The resource could not be found.",
            "innerError": {
                "request-id": "6d095277-fa07-40ba-bfcb-c93e96660fdc",
                "date": "2018-09-27T15:43:28"
            }
        }
    }
    
  7. If I enter the shared link using my browser, the file is shown in the shared list (below "Recent" and above "Discover" folders on browser):

     https://MY_ORGANIZATION.sharepoint.com/:x:/g/personal/MY_USER/Eabkxa2md3JEsW0qQEuYRK4BKnnnHeJqNuspeZ6TEdkWsQ
    
  8. When I return to Graph Explorer and run the command again, I get an HTTP 200 response.

    https://graph.microsoft.com/v1.0/drives/MY_DRIVE/MY_EXCEL_FILE/workbook/worksheets/Data/tables/TableData/rows
    

My conclusion is that file must be inthe shared folder. Please correct me if I am missing something.

ps: After file appears on the 2nd account's "shared" folder, looking at the OneDrive "Manage Access", I now see the 2nd account's inisitals. This is probably to indicate file officially accessed and shared. Deleting the file from his shared folder, keeps its initials and proper response from Graph explorer. Only canceling the share link seems to cancel the share.

[UPDATE Sep-27 2018 - 2]

Since another comment from Mr. Marc, i modified the question a bit and would like to point out i also tried the next link using the my actual sharing link. This had similar response (not sure the exact error code) + other issue in getting the actual excel.

Accessing shared DriveItems

1
It isn't clear what problem you're running into. Why do you believe this file needs to be in a shared folder? This isn't a requirement.Marc LaFleur
Hi Marc and thank you for your quick response. i edit my original question to reflect why i think so. Will appreciate any help. I am really frustrated :(epic
I'm clearly missing something in the scenario. Are you using Graph to access an Excel document in your OneDrive from another account?Marc LaFleur
Dear Marc - exactly right. This file is used as settings files to all app users and it is located on my personal onedrive.epic
That won't work. OneDrive will only show items that were either explicitly shared or otherwise accessed (i.e. opening the shared doc in Excel). This is also not the intended purpose of this API or a good way of delivering config/data to applications. You're going to run into all sorts of performance and throttling issues.Marc LaFleur

1 Answers

1
votes

You need to send the link to the user or send the invite mail to the user, both are recommended way.

If the file contains sensitive information, you need to segregate the content from the original file, so it can compliance GDPR. Currently, the sharing is for item/file level not the worksheet/excel-rows level.

You can use createLink action to share a DriveItem via a sharing link.