将文件上传到OneDrive时触发Java代码以从OneDrive下载文件 [英] Trigger java code to download file from onedrive when file is uploaded to onedrive

查看:351
本文介绍了将文件上传到OneDrive时触发Java代码以从OneDrive下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想触发一个驻留在Azure容器注册表或docker hub中作为图像驻留的Java代码.此代码用于在文件上传到onedrive时从onedrive下载/读取文件.

I want to trigger a java code residing as an image in Azure container registry or docker hub. This code is to download/read file from onedrive when file is been uploaded to onedrive.

我尝试了Azure逻辑应用程序之类的Azure服务,但是没有触发Java代码的操作. 我尝试使用restapi,但无法识别用于GET请求的URL. 我读了有关Microsoft graph api的文章,但我不必使用它,因为将来将文件路径从onedrive更改为任何其他驱动器时,必须将其设为通用.

I tried azure services like Azure logic apps but there is no action to trigger java code. I tried using restapi but couldnt identify the URL to use for GET request. I read about microsoft graph api but I dont have to use it as I have to make it generic in case in future file path changes from onedrive to any other drive.

推荐答案

简单的解决方案是在Azure Functions中使用External file trigger,如下图所示,请参考正式文档

The simple solution is using External file trigger in Azure Functions, as the figures below, please refer to the offical document Microsoft Graph bindings for Azure Functions to know how to do.

例如,使用JavaScript.

For example, using JavaScript.

但是由于不支持Azure Functions上的Java触发器,因此只能使用C#/F#,JavaScript/Node.js来实现.

But due to not support this trigger for Java on Azure Functions, you can only use C#/F#, JavaScript/Node.js to realize it.

如果必须使用Java进行操作,一种解决方法是将Azure函数与HttpTrigger或WebHook与Azure Logic App的OneDrive触发器集成.

If you must have to do in Java, a workaround way is to integrate Azure Functions with HttpTrigger or WebHook with the OneDrive trigger of Azure Logic App.

Azure Logic App的代码是用于定义逻辑流的json数据块,如下所示,您可以在Azure门户的选项卡Logic app code view中看到它.

The code of Azure Logic App is a json data block to define the logic flow, as below, you can see it in the tab Logic app code view of Azure portal.

这篇关于将文件上传到OneDrive时触发Java代码以从OneDrive下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆