I would like to upload files to Microsoft One Drive using c# and shared to some of my friends on weekly basis. I have tried few things but when using Authenticate API, browser shows login prompt.
So I would like to upload them without login, because I am uploading these files through Windows Service, which is running in background.
Please suggest the best way to do that.
You'll need some user interaction to gain initial consent for your application to operate on the user's behalf, however as long as that process gives you a refresh token you'll be able to use that in your service to get current tokens without user interaction. It will eventually expire so you'll need a way to notify, and interact with, the user on occasion.
You'll need to ask for the
offline_accessscope to get the refresh token, see: https://learn.microsoft.com/en-us/onedrive/developer/rest-api/getting-started/msa-oauth?view=odsp-graph-online#authentication-scopes