【问题标题】:How do I store temp data from an Azure Function?如何存储来自 Azure 函数的临时数据?
【发布时间】:2021-11-14 11:50:27
【问题描述】:

我编写了一个 Azure 函数来将数据发送到 Zoho CRM SDK。 SDK 在使用时需要一个文件路径来写入一些元数据(称为“resourcePath”)。在我的本地开发时,我使用的是我的文档,它工作正常。我需要找到一个可以在 Azure 环境中使用的位置。
根据我读过的文章,我尝试了System.IO.Path.GetTempPath()context.FunctionAppDirectory'. 两者都抛出了权限错误。错误来自 SDK {{ "code": "OAUTH_SCOPE_MISMATCH", "status": "error", "message": "invalid oauth scope to access this URL" }} 我被告知这是文件位置的权限错误。我应该为 Azure 函数使用什么位置?

**回复@HariKrishnaRajoli-MT **

我更改了路径,现在我在CreateRecords() 中获得了Object reference not set to an instance of an object.。 RecordOperations、moduleApiName 和 bodyWrapper 都是有效的。没有什么是空的。

at Com.Zoho.Crm.API.Util.Utility.GetFieldsInfo(String moduleAPIName) at Com.Zoho.Crm.API.Util.Utility.GetFields(String moduleAPIName) at Com.Zoho.Crm.API.Record.RecordOperations.CreateRecords(String moduleAPIName, BodyWrapper request) at Zoho_CRM_Feed.feed_app.Lead.CreateNewLead(List1 leads) in C:\Users\xxxxxxxx\source\repos\Zoho_CRM_Feed\Zoho_CRM_Feed\feed_app\Lead.cs:line 75

有什么建议吗?

【问题讨论】:

    标签: c# sdk azure-functions zoho


    【解决方案1】:

    您可以使用
    System.IO.Path.GetTempFileName(),这将创建一个%userprofile%\Local\Temp\tmpE128.tmp 文件

     System.IO.Path.Combine(System.IO.Path.GetTempPath(),  
        System.IO.Path.GetRandomFileName()) 
    

    如果您收到错误 INVALID_TOKEN,请生成](https://www.zoho.com/crm/developer/docs/api/v2/access-refresh.html) "https://www.zoho.com/crm/developer/docs/api/v2/access-refresh.html)") 新访问令牌并检查您是否仍然遇到相同的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-22
      • 2011-12-22
      • 1970-01-01
      • 2018-03-09
      • 1970-01-01
      • 2022-01-02
      • 2018-02-27
      • 1970-01-01
      相关资源
      最近更新 更多