我无法将CSOM代码作为Azure函数计时器作业执行,并且在执行Execute查询语句后出现400错误的请求错误。该代码已作为控制台应用程序执行,没有任何错误
这里,我不是通过Visual Studio创建和部署应用程序。我直接在Azure本身的run.csx文件中的计时器函数中执行代码,在这里我进行常规身份验证,而无需传递访问令牌,而通过传递硬编码的用户名和安全字符串密码来使用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)
答案 0 :(得分:2)
创建Function App时,运行时版本默认设置为〜2。那不应该被使用。应该是V1。
Runtime version: 1.0.11959.0 (~1)
这已解决了该问题。