0

OK so I have now spent hours trying to figure this out on my own with research but cannot seem to figure out what I'm doing wrong. I have a VBA program to call MS Graph API and find a specific folder id then use that id to create a share link and put it into my Access DB. I have my App-only Auth token working and all my permissions set in Azure AD. I have reviewed every post I could find on the subject and nothing has helped. from what I understand I am following the correct syntax and my folder does exist, but I still get the 404 error. Here is my code.

strPathProj = "https://graph.microsoft.com/v1.0/users/{user-id}/drive/root:/path-to-folder/

Any help will be much appreciated.

  • There should be an end " btw and which API use case are you following in the guidance? And have you got it working with any other language/POSTMAN etc? – QHarr Dec 09 '20 at 18:37
  • Thank you. Yes that was a typo on my part copying it over, there is an end ". I have tested this in Graph Explorer, but I have not setup POSTMAN to test there yet. As far as use case I am not completely sure what you are asking for. I have been following the Microsoft Docs help pages to try and figure all this out. – Spenser Taylor Schafer Dec 09 '20 at 19:42
  • (1) HTTP 404 is telling that the resource that you look for is not available. Have you checked in Onedrive the file/folder do exists and you can access it (2) Share the detailed error info along with timestamp, requestid that you received – Dev Dec 09 '20 at 19:46
  • I am new to HTTP requests so I am not sure how to get the details you are asking from the request with VBA. As I mentioned in my initial comment the folder does exist and I can access it. – Spenser Taylor Schafer Dec 09 '20 at 19:50
  • By use case I mean which page of the guidance are you using for your syntax please? – QHarr Dec 09 '20 at 21:55
  • Here are some places I got info from. https://stackoverflow.com/questions/35878044/ms-graph-api-onedrive-resource-not-found/35880712#35880712 https://learn.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-1.0&tabs=http – Spenser Taylor Schafer Dec 09 '20 at 23:07
  • @SpenserTaylorSchafer Let me know if this helps. As you are trying to get the folder item using path, if you have a folder name 'New Folder' in your root directory then the call should be `https://graph.microsoft.com/v1.0/users/{userid}/drive/root:/New Folder` and make sure you have the permissions specified [here](https://learn.microsoft.com/en-us/graph/api/driveitem-get?view=graph-rest-1.0&tabs=http#permissions) in your access token, you can check the permissions in access token by putting your access token in jwt.ms. – Shiva Keshav Varma Dec 10 '20 at 12:29
  • @Shiva-MSFTIdentity Thank you. yes that is what I am doing as far as I can tell. All permissions are set plus more since I wanted to make sure it was good on that. How is your path different from the one I showed. I don't see any differences so I just want to make sure I'm not missing anything. – Spenser Taylor Schafer Dec 10 '20 at 16:47
  • I was able to get the driveitem using the same call, please check on your end if you are missing something. Try with max role sites.readwrite.all permission as I used it. – Shiva Keshav Varma Dec 10 '20 at 17:00
  • @Shiva-MSFTIdentity Are you trying this through VBA? or are you using Graph Explorer? I am able to get the call to work in Graph Explorer, but the same call does not work in VBA. If you are able to get it in VBA, can you send some example code to help me figure out what I am doing wrong. Thank you. – Spenser Taylor Schafer Dec 10 '20 at 17:49
  • Ok. I am using POSTMAN and testing it. Just use fiddler and see how the request is going to Graph server and compare with graph explorer call. – Shiva Keshav Varma Dec 11 '20 at 16:01
  • OK and just to confirm you are doing the call as App only not on behalf of user, correct? – Spenser Taylor Schafer Dec 11 '20 at 19:16
  • Yes, I did it with App-only token. – Shiva Keshav Varma Dec 14 '20 at 13:09

0 Answers0