none
Reading the contents of a file using Microsoft Graph via the O365 REST API for O365 Groups RRS feed

  • General discussion

  • Hi,

    I'm looking for an endpoint that will allow me to read the contents of a set of files within O365 Group document folders via Microsoft Graph so that I can copy the contents in a "transfer" to a third-party REST-enabled platform. I've already tried '/content' and '$value', which '$value' doesn't work since I'm not using Sharepoint's REST API and it's also not usable in Microsoft Graph and the '/content' endpoint parameter gives me the following errored response from Microsoft Graph:

    Failure - Status Code 0,
    
    {
        "isTrusted": true
    }

    This isn't the only error I've received as the third-party platform also attempting to access the files receive other forms of error messages instead of the actual file contents themselves as the Microsoft documentation indicates. How do I proceed?

    Related issue



    • Edited by Dave-1 Tuesday, July 23, 2019 7:51 PM
    Tuesday, July 23, 2019 7:33 PM

All replies

  • Hi

    To get file contents, you need to get driveitem. Below thread for your reference.

    https://stackoverflow.com/questions/43240319/access-files-of-document-library-site-through-microsoft-graph-api

    https://docs.microsoft.com/en-us/graph/api/resources/onedrive?view=graph-rest-1.0


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Wednesday, July 24, 2019 3:30 AM
  • But Justin, will this work with O365 Groups as opposed to actual Sharepoint sites themselves? Because I'm referring to O365 Groups, not Sharepoint sites.

    Thursday, July 25, 2019 2:38 PM
  • Hi

    Do you mean the group related modern site's document library and the classic site's document library?

    They all work.


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Friday, July 26, 2019 2:40 AM
  • Yes, but O365 Groups don't work using the standard Sharepoint endpoints. Sharepoint endpoints use suffixes such as '/sites/' where as O365 Groups use '/groups/' in the REST URL call.

    You can see the differences here:

    https://docs.microsoft.com/en-us/graph/api/driveitem-list-children?view=graph-rest-1.0&tabs=http

    In that documentation there's no reference to pulling the actual contents of files nor are there explicit directions on how to traverse Document sub-folders using the Graph API.

    • Edited by Dave-1 Friday, July 26, 2019 2:44 PM
    Friday, July 26, 2019 2:21 PM
  • Hi Dave,

    Please consider the group as site too.


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Monday, July 29, 2019 8:53 AM