I'm trying to execute the GetAllTimeZonesWithDisplayName
function to retrieve the current user's timezone; however I'm having some difficulties
I've been following this blog but something seems to have changed. According to the author I should be able to go:
/api/data/v8.2/GetAllTimeZonesWithDisplayName(LocaleId=1033)
but this results in an error like:
{
"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":...
}
}
}
So I had a look in the metadata (/api/data/v8.2/$metadata
) and I can see that this method requires two parameters (I think)
<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>
But I don't know what is required for the entityset
parameter and it doesn't seem to be listed in the MSDN documentation
The function, according to a metadata, is bound to an entityset Parameter Name="entityset" Type="Collection(mscrm.timezonedefinition)" Nullable="false"/>
means you should start it from the set. And, I don't know why, usage of bound functions requires full function name so the result will be:
/api/data/v8.2/timezonedefinitions/Microsoft.Dynamics.CRM.GetAllTimeZonesWithDisplayName(LocaleId=1033)