- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试创建一个使用存储队列触发器执行 PowerShell 的 Azure 函数。出于测试目的,我希望此函数能够操作我的 OneDrive for Business 帐户中的文件。将 aapdftoimage/ThreePages.pdf
处的文件复制到 aapdftoimage/output_ThreePages.pdf
。
当 OneDrive for Business 作为输入集成时,每当队列中的新消息触发该函数时,我都会收到错误。如果我断开 OneDrive 作为输入,我不会收到任何错误,并且 $triggerInput
包含该消息。
错误是:
2017-05-25T22:24:38.484 Function started (Id=a0c37fdf-ed3c-473c-9c79-236d63531e7e)
2017-05-25T22:24:38.499 Function completed (Failure, Id=a0c37fdf-ed3c-473c-9c79-236d63531e7e, Duration=1ms)
2017-05-25T22:24:38.562 Exception while executing function: Functions.QueueTriggerPowerShell1. Microsoft.Azure.WebJobs.Host: No value for named parameter 'file'.
这是我的 PowerShell:
$inData = Get-Content $triggerInput
$inFile = Get-Content $inputFile
Write-Output "PowerShell script processed queue message '$inData'"
Write-Output "inFile: $inFile"
这是 function.json:
{
"bindings": [
{
"name": "triggerInput",
"type": "queueTrigger",
"direction": "in",
"queueName": "samples-powershell-pdftoimage",
"connection": "<storageaccount>_STORAGE"
},
{
"type": "apiHubFile",
"name": "inputFile",
"path": "aapdftoimage/{file}",
"connection": "onedriveforbusiness1_ONEDRIVEFORBUSINESS",
"direction": "in"
}
],
"disabled": false
}
在撰写本文时,我认为我的部分困惑在于 OneDrive for Business 的输入和输出(在我的测试中未连接)集成。
我知道$triggerInput
是什么。这是消息的内容。但是$inputFile
是什么? {file}
来自哪里?
我想也许我会执行以下操作,但它也不起作用(相同的错误):
$file = Get-Content $triggerInput
我认为这可能会将 $inputFile
定义为“aapdftoimage/$file”,但它没有执行任何此类操作。
不用说,我处于停滞状态。谁能给我一些指导并纠正我的错误?
最佳答案
@Henry Hamid Safi 是正确的。使用 C#,您可以利用 Binder 对象来动态命名文件。
在您的用例中,动态提供文件名的唯一方法是将其作为触发器负载中的 JSON 对象传递。这是一个对我有用的示例设置。
function.json:
{
"bindings": [
{
"name": "triggerInput",
"type": "queueTrigger",
"direction": "in",
"queueName": "samples-powershell",
"connection": "AzureWebJobsStorage"
},
{
"type": "apiHubFile",
"name": "inputFile",
"path": "aapdftoimage/{file}",
"connection": "onedriveforbusiness_ONEDRIVEFORBUSINESS",
"direction": "in"
},
{
"type": "apiHubFile",
"name": "outputFile",
"path": "aapdftoimage/output_{file}",
"connection": "onedriveforbusiness_ONEDRIVEFORBUSINESS",
"direction": "out"
}
],
"disabled": false
}
run.ps1:
$in = Get-Content $triggerInput
Write-Output "PowerShell script processed queue message '$in'"
Copy-Item $inputFile $outputFile
请求正文(如果在门户中使用测试 Pane )或队列触发器负载:
{
"file":"ThreePages.pdf"
}
日志条目:
2017-05-26T22:27:53.984 Function started (Id=032c4469-8378-44ce-af9e-5a941afb0d82)
2017-05-26T22:27:54.875 PowerShell script processed queue message '{ "file":"ThreePages.pdf" }'
2017-05-26T22:27:54.891 Function completed (Success, Id=032c4469-8378-44ce-af9e-5a941afb0d82, Duration=899ms)
关于具有 PowerShell、存储队列触发器和 OneDrive for Business 的 Azure Function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44191163/
我知道使用 https://www.skype.com/en/developer/create-contactme-buttons/ 添加 Skype 链接很容易.但是可以为 SkypeForBusi
Closed. This question is opinion-based。它当前不接受答案。 想改善这个问题吗?更新问题,以便editing this post用事实和引用来回答。 上个月关闭。
Closed. This question is off-topic。它当前不接受答案。 想改善这个问题吗? Update the question,所以它是用于堆栈溢出的on-topic。 已关闭8
我们使用一个持久的 Skype for Business 聊天室,并用它来广播每天在特定项目上完成的工作。我想在每个工作日早上启动 Skype for Business 并将其打开到这个聊天室。我想使
我在本地和远程(通过 VPN)与 GUI 应用程序交互。当我在本地使用它时,大多数操作发生得非常快,而且我的 sikuli 脚本执行得很好。但是,当我远程使用它时,操作需要更长的时间才能完成。 也就是
如何在业务催化剂中编辑模板?我可以从用户界面执行此操作还是需要 Dreamweaver 或其他一些产品? 我用谷歌搜索,但找不到答案...... 当我登录时,在网站选项卡下,有站点编辑器、网页、博客和
我刚开始使用 Google My Business API,并且能够执行获取操作只是为了验证我的 Oauth 设置是否正确。现在我想使用 GMB 添加位置 API 的 post 方法添加一个位置,但在
我们在我们的应用程序中使用 Skype for Business Web SDK 来显示联系人的存在。 当联系人是用户组织内部的某个人(因此与用户在同一个 AD 实例)时,我们在联系人的状态 onCh
有没有办法使用 GMB API 获取评论的链接? 最接近我需要的是这个: https://www.google.com/maps/contrib/113400145807499011881/place
{ "error": { "code": 429, "message": "Quota exceeded for quota metric'Requests' and limit 'Requests
有很多为 Skype 创建 HTML 链接的解决方案(href="skype:username"),但我找不到任何适用于 Skype for Business 的解决方案。 (引用=“啜饮: 有关如何
对于给定的 n 态 busy beaver game , 是 busy beaver function是唯一的,还是可能有多个功能具有相同的最高分?也许这两种方式都没有得到证明? 最佳答案 是的,是的
也许我在当前的 Google MyBusiness API 迁移中遗漏了一些东西。 我们有在 Google My Business API 上运行的脚本,该 API 将于 2022 年 4 月结束,取
在 Business Objects XI Web Intelligence 中,Rank 函数返回密集结果。例如,当按“金额”排名时,我只想返回前十名记录。然而,三项记录在“金额”上并列第五。结果总
我正在按照本指南 ( https://msdn.microsoft.com/en-us/skype/ucwa/authenticationusingazuread ) 尝试和验证并创建 Skype 应
由于我一直在努力学习 Angular,所以这几天我一直在与这个 ng-busy 作斗争。 我有一个 plunker 页面,它可以工作,但不是我想要的。该页面正在显示加载动画,但我想让它在按钮内显示加载
我正在运行关于 svn 的 java 代码,它是这样的 http://code.google.com/p/justcodingforfun/source/browse/MagicMissile/src
请帮助我理解。我是一名技术专家,并试图确定在使用WhatsApp Cloud API执行分配给我的业务任务时是否会有任何限制。。在WhatsApp Business Account文档中,我看到了许多
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
我正在尝试为我的大型 ASP.NET MVC 应用程序创建业务和数据层。因为这是我第一次尝试这种规模的项目,所以我正在阅读一些书籍,并努力小心地将事情正确地分开。通常我的应用程序混合了业务逻辑和数据访
我是一名优秀的程序员,十分优秀!