Reputation: 105
I have an Azure Function that triggers on OneDrive files being saved to a certain folder in my OneDrive account using the "External File (Preview) trigger" from the Azure Portal.
Now I also want to delete the processed file from OneDrive in the same function. Is this possible, and if so how do I do it?
Upvotes: 1
Views: 261
Reputation: 1358
This is not currently supported by the OneDrive binding. If this is a feature you desire, you can request it here.
Note that you can make the size of the file 0 bytes by making the direction of your binding out
and by making the parameter it is bound to an out string
. If you set this parameters value to an empty string, then the content of the file will be replaced by that string, and the file will no longer take up any space, but will still be present.
If you still want to use exclusively functions to delete the binding, you can still use the Token binding to get an AAD token for Microsoft Graph, and use that token for authorization for one of these SDKs (probably the .NET and JavaScript ones would be the easiest to use within a Function). These SDKs should provide you with most of the capabilities of the MS Graph API, including OneDrive file deletion.
Upvotes: 1
Reputation: 35134
I don't think it's possible with Functions bindings.
We are using Logic App to do that: it reads OneDrive, calls Azure Function and then deletes the file on OneDrive. External File trigger is using Logic App behind the scenes, so my approach is more-or-less extension of yours.
Upvotes: 2