简体   繁体   中英

Saving a file in OneDrive from Azure Functions

What's the simplest way for an Azure Functions to save a file into OneDrive? How does authentication work from a deployed Azure Function? To make this discussion simpler, we have a string var content = "This is the file content" which needs to be saved as sample.txt file.

What if OneDrive folder is shared with an URL (real shared OneDrive link, will be removed - https://1drv.ms/f/s!Ak7ywxppmRtB8uRKhvT1FLmNBwXNwQ ) and no authentication is required?

I'd recommend taking a look at the Microsoft Graph APIs for managing files stored in OneDrive.

They have great C# examples using the Microsoft.Graph NuGet package. You will need to implement a mechanism of authentication however and I don't think there is a way around this. For the Graph, I'd recommend looking at these implementations for getting authenticated for a user .

Once you've authenticated in your Function app, you should be able to get to where you need to be using the Graph APIs for OneDrive available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM