Using graph to open all workbooks in all sub folders

Andrew Melbourne 1 Reputation point
2022-10-07T00:09:43.277+00:00

I am new to graph. Previously I used VBA to open all files in 12 subfolders to copy data into my master workbook with a second macro to then process the combined data. Now all the files are held in sharepoint so my macro is limited because it is unable to access the files in subfolders.

I am comfortable with coding with APIs and so it looks like graph gives me the capability to repeat the macros roll of opening all workbooks in all sub folders but is there a good tutorial to show me how to create this the first time? Thanks

Developer technologies | Visual Basic for Applications
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,876 Reputation points
    2022-10-07T10:00:59.713+00:00

    Hi @Andrew Melbourne , if you‘re worried about how to open files in subfolders in SharePoint, there are two endpoints you can use:

    First, you can list all the files in the subfolder by:
    https://graph.microsoft.com/v1.0/sites/{site-id}/drive/root:/Folder/subfolder:/children

    And you can use get files in subfolders by:
    https://graph.microsoft.com/v1.0/sites/{site-id}/drive/root:/Folder/subfolder/{item-path}

    If this suggestion does not meet your needs, you can also comment below and we can continue to investigate the issue. Best Wishes.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.