【发布时间】:2018-10-08 21:03:02
【问题描述】:
我无法将 CSOM 代码作为 Azure 函数计时器作业执行,并且在执行 Execute query 语句后出现 400 bad request 错误。该代码作为控制台应用程序执行,没有任何错误
这里我不是通过 Visual Studio 创建和部署应用程序。我在文件 run.csx 中的计时器函数中直接执行 Azure 本身中的代码,这里我通过传递硬编码的用户名和安全字符串密码并面临问题,在不传递访问令牌和使用 SharePoint 在线凭据语句的情况下进行正常身份验证。
堆栈跟踪
2018-10-08T20:56:17 Welcome, you are now connected to log-streaming service.
2018-10-08T20:56:38.007 [Information] Executing 'Functions.ExpiredSLAIdentifier' (Reason='This function was programmatically called via the host APIs.', Id=36f36c56-ac48-4220-bcc4-040658d77fa2)
2018-10-08T20:56:42.685 [Information] Azure Function Exception: at System.Net.HttpWebRequest.GetResponse()
at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()
at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate()
at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest()
at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery()
at Submission#0.Run(TimerInfo myTimer, ILogger log) in D:\home\site\wwwroot\ExpiredSLAIdentifier\run.csx:line 25
2018-10-08T20:56:42.702 [Information] Executed 'Functions.ExpiredSLAIdentifier' (Succeeded, Id=36f36c56-ac48-4220-bcc4-040658d77fa2)
【问题讨论】:
-
可能的修复:将 Azure 函数版本运行时设置为 V2
-
感谢您回复@Hackerman。它已经在使用运行时 V2。运行时版本:2.0.12115.0 (~2)
标签: azure sharepoint