c# - 从 Dynamics CRM API 返回什么 DateTime

标签 c# dynamics-crm microsoft-dynamics-webapi

从 Dynamics CRM Web API 返回的 DateTime 对象是否始终采用 UTC 格式?记录在何处?

我正在使用 CRM SDK nuget 包。我在几个博客(通过 CRM 商店)上读到,CRM API 总是返回 UTC DateTime 对象,并且我经历过 DateTime.Kind 总是 UTC(根据我的测试),但我需要确定。

如果重要的话,CRM 是 2015 年的。

我正在使用以下代码调用 Dynamics CRM 网络服务。

 var querybyattribute = new QueryByAttribute()
 {
     EntityName = Opportunity.EntityLogicalName,
     ColumnSet = new ColumnSet(true)//all columns
 };

querybyattribute.Attributes.AddRange(attributeName);
querybyattribute.Values.AddRange(attributeValue);

然后调用RetreiveMultiple

EntityCollection entities;
using (var proxy = new ManagedTokenOrganizationServiceProxy(serviceManagement, credentials))
{
    entities = proxy.RetrieveMultiple(query);
}

最佳答案

CRM 中的日期具有三种不同类型的行为。其中只有两个真正具有时区的概念。可以在 MSDN 上找到这三种类型的行为。 , 相关部分复制在这里:

UserLocal(这是 CRM 2015 更新 1 之前唯一可用的)

The retrieve operation returns the UTC value.

仅限日期

For the retrieve and update operations, no time zone conversion is performed, and the time value is always 12 AM (00:00:00).

TimeZoneIndependent

For the retrieve and update operations, no time zone conversion is performed, and actual date and time values are returned and updated respectively in the system regardless of the user time zone.

关于c# - 从 Dynamics CRM API 返回什么 DateTime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38104793/

相关文章:

c# - 带有 .NET Framework 4.0 的 Windows XP SP3 上的 .NET Framework 3.0 应用程序

c# - 检测类属性是否为引用类型

azure - 用于监控的遥测与组织洞察

java - 如何通过Java连接在Azure Cloud上运行的Dynamics CRM 2016实例?

javascript - 在异步 Web API 调用之前保存并关闭退出的 Web 资源

c# - 数据库队列的并行处理

c# - 返回值的方法不能传递给异常处理程序

dynamics-crm - 删除 Dynamics CRM 中的实体

c# - Dynamics C# 插件在运行时失败,但在调试时成功