Javascript 使用CRM WebAPI执行GetAllTimeZones with DisplayName函数

Javascript 使用CRM WebAPI执行GetAllTimeZones with DisplayName函数,javascript,dynamics-crm,dynamics-crm-365,Javascript,Dynamics Crm,Dynamics Crm 365,我试图执行getAllTimeZones with DisplayName函数来检索当前用户的时区;但是我有一些困难 我一直在关注这一点,但似乎有些事情发生了变化。根据作者的说法,我应该能够: /api/data/v8.2/GetAllTimeZonesWithDisplayName(LocaleId=1033) 但这会导致如下错误: { "error": { "code":"", "message":"Resource not found for the seg

我试图执行
getAllTimeZones with DisplayName
函数来检索当前用户的时区;但是我有一些困难

我一直在关注这一点,但似乎有些事情发生了变化。根据作者的说法,我应该能够:

/api/data/v8.2/GetAllTimeZonesWithDisplayName(LocaleId=1033)
但这会导致如下错误:

{   
  "error":
  {
    "code":"",
    "message":"Resource not found for the segment 'GetAllTimeZonesWithDisplayName'.",
    "innererror":{
      "message":"Resource not found for the segment 'GetAllTimeZonesWithDisplayName'.",
      "type":"Microsoft.OData.Core.UriParser.ODataUnrecognizedPathException"
      ,"stacktrace":...
    }
  } 
}
所以我查看了元数据(
/api/data/v8.2/$metadata
),发现这个方法需要两个参数(我想)



但是我不知道entityset参数需要什么,而且它似乎没有列在

中。根据元数据,函数绑定到entityset
参数Name=“entityset”Type=“Collection(mscrm.timezonedefinition)”Nullable=“false”/>
意味着您应该从集合启动它。而且,我不知道为什么,使用绑定函数需要完整的函数名,因此结果将是:


/api/data/v8.2/timezonedefinitions/Microsoft.Dynamics.CRM.GetAllTimeZonesWithDisplayName(LocaleId=1033)

当你说“你应该从集合开始”时,我真的不明白你的意思。你能再详细一点吗?哦,我理解:
/api/data/v8.2/timezonedefinitions/Microsoft.Dynamics.CRM.GetAllTimeZonesWithDisplayName(LocaleId=1033)
正确,这正是我在回答页中发布的URL,当我最初阅读您的答案时,我没有注意到区别。再次感谢!
<Function Name="GetAllTimeZonesWithDisplayName" IsBound="true">
  <Parameter Name="entityset" Type="Collection(mscrm.timezonedefinition)" Nullable="false"/> 
  <Parameter Name="LocaleId" Type="Edm.Int32" Nullable="false"/> 
  <ReturnType Type="Collection(mscrm.crmbaseentity)" Nullable="false"/> 
</Function>