#Is it possible to use Graph API to access/modify personal files

1 messages · Page 1 of 1 (latest)

sullen swift
#

Hi all, I am just a regular user with a personal microsoft account, I don't have a tenant related to an organization or anything like that. I'm a bit confused on how this works because the documentation seems to be mostly geared towards people developing apps designed for use within an organization or a tenant.

But I just want to use the API to access/modify my own personal files stored in my onedrive. Can anyone help me get set up or point me in the right direction? I know this is a vague question but I honestly don't know where to look, every resource I find seems to not be geared for my use case. Thanks!

grim vine
sullen swift
#

I checked into power automate a bit but it looked like recently in the past few months they disabled the free version of it or something. If I have to pay some monthly fee to accomplish what I'm trying to do that's fine as long as it's not exorbitant or anything

Basically what I'm trying to do is have my homegrown discord bot read from/write to an excel file. Today I access this file both from my desktop pc and from my mobile phone. I'm not necessarily married to the idea of doing it through the API but I would prefer to continue being able to manually access this file on both desktop/mobile as well as my bot being able to access it.

I've done a bit of development for my job within an organization/tenant workflow so I have somewhere between a novice-intermediate level of familiarity with app registrations and all that. But I don't necessarily know how it translates to a personal account.

And of course thank you so much for your time!

grim vine
grim vine
# sullen swift I checked into power automate a bit but it looked like recently in the past few ...

https://entra.microsoft.com

register your app for personal account
Add a redirect URI to get your auth token
Make a secret and store it
Add permissions for your app like read/write, offline access

Then hit that oauth url to get your token. Either with bash or python, postman is dedicated for that and can be downloaded for free.

Like oauth/v2/authorize? url

You’ll receive the code in your redirect uri with ?code= …

Then you can add this code to your next payload to get tokens at the right url

oauth2/v2/token

finally you use that token in your payload header when you call the API

#

API stuff always sounds complicated, it’s not that straightforward but it’s very logical. If you pass the right variables at the right time you’ll be fine.

I’d recommend using postman really to avoid having to write those intermediate steps altogether, but do it in the GUI instead. Just to get the authorisation token I mean

sullen swift
#

Ok first off thank you so much, I really appreciate the detailed answer. Apologies for the delayed response, I've been a bit busy lately and haven't had time to sit down and try this until today.

I went ahead and tried to log in to the entra portal with my personal account but it seems that maybe you can't log in to the entra portal with a personal account (?). I'm getting error AADSTS160021: Application Requested a User Session That Does Not Exist and it won't let me log in.

Do I need to join a developer program of some kind? I found they have a Microsoft 365 developer program but I'm a bit confused as to what that all entails and if it would accomplish what I'm trying to do. It seems like overkill to me that I would need to register and create an entire tenant just to use the API but I'm new to all this. Thanks again!

sullen swift
#

Another thought I had: is it possible to download a copy of my excel file locally to the machine my bot is running on, and then simply use a python library to read/modify the file, and let microsofts own sync carry the changes to the online version?

grim vine
sullen swift
#

I've been running my bot from a raspberry pi on linux. A quick google search seems to show that there is no official onedrive client from microsoft meant for use on linux but there are some unofficial ones. I'll look further into this, does anyone have any experience with any of these or does that seem safe in general?

grim vine
#

You can potentially just download transform upload. No need to sync.