具有约束的 Dynamics 365 搜索资源可用性

Posted

技术标签:

【中文标题】具有约束的 Dynamics 365 搜索资源可用性【英文标题】:Dynamics 365 Search Resource Availability With Constraints 【发布时间】:2021-11-28 18:34:40 【问题描述】:

我一直在尝试在此页面之后向我的搜索资源可用性 API 调用添加过滤器:Search resource availability API 无论我做什么,我似乎都无法按组织单位进行过滤。 这是我的 http 调用正文:


    "Version": "3",
    "IsWebApi": true,
    "Requirement": 
        "msdyn_fromdate": "2021-11-01T00:00:00Z",
        "msdyn_todate": "2021-11-30T23:59:00Z",
        "msdyn_remainingduration": 60,
        "msdyn_duration": 60,
        "@odata.type": "Microsoft.Dynamics.CRM.msdyn_resourcerequirement"
    ,
    "Settings": 
        "ConsiderSlotsWithProposedBookings": false,
        "MovePastStartDateToCurrentDate": true,
        "@odata.type": "Microsoft.Dynamics.CRM.expando"
    ,
    "ResourceSpecification":
       "@odata.type": "Microsoft.Dynamics.CRM.expando",
        "ResourceTypes@odata.type": "Collection(Microsoft.Dynamics.CRM.expando)",
        "ResourceTypes": [
            
                "@odata.type": "Microsoft.Dynamics.CRM.expando",
                "value": "3"
            
        ],
        "Constraints": 
            "@odata.type": "Microsoft.Dynamics.CRM.expando",
            "OrganizationalUnits@odata.type": "Collection(Microsoft.Dynamics.CRM.expando)",
            "OrganizationalUnits":[
                
                    "@odata.type": "Microsoft.Dynamics.CRM.expando",
                    "value": "b2054232-a114-ec11-b6e7-000d3a842ab8"
                
            ]
        
    

这是我得到的回复:


    "@odata.context": "https://orga215da53.api.crm3.dynamics.com/api/data/v9.2/$metadata#Microsoft.Dynamics.CRM.msdyn_SearchResourceAvailabilityResponse",
    "TimeSlots": [],
    "Resources": [],
    "Related": 
        "@odata.type": "#Microsoft.Dynamics.CRM.expando",
        "TimeSlots@odata.type": "#Collection(Microsoft.Dynamics.CRM.crmbaseentity)",
        "TimeSlots": [],
        "Resources@odata.type": "#Collection(Microsoft.Dynamics.CRM.crmbaseentity)",
        "Resources": []
    ,
    "Exceptions": 
        "@odata.type": "#Microsoft.Dynamics.CRM.expando"
    

但我知道该组织单元存在于 CRM 中。 我尝试将 odata.type 更改为实际的组织单位 CRM 类型 (msdyn_organizationalunit),但这只会给我一个错误 (An error occurred while validating input parameters: System.ArgumentNullException: Value cannot be null) 我做错了什么? 谢谢!

【问题讨论】:

【参考方案1】:

早安,

我不确定,但也许“约束”应该在“资源规范”之外,例如:


"Version": "3",
"IsWebApi": true,
"Requirement": 
    "msdyn_fromdate": "2021-11-01T00:00:00Z",
    "msdyn_todate": "2021-11-30T23:59:00Z",
    "msdyn_remainingduration": 60,
    "msdyn_duration": 60,
    "@odata.type": "Microsoft.Dynamics.CRM.msdyn_resourcerequirement"
,
"Settings": 
    "ConsiderSlotsWithProposedBookings": false,
    "MovePastStartDateToCurrentDate": true,
    "@odata.type": "Microsoft.Dynamics.CRM.expando"
,
"ResourceSpecification":
   "@odata.type": "Microsoft.Dynamics.CRM.expando",
    "ResourceTypes@odata.type": "Collection(Microsoft.Dynamics.CRM.expando)",
    "ResourceTypes": [
        
            "@odata.type": "Microsoft.Dynamics.CRM.expando",
            "value": "3"
        
    ]        
,
"Constraints": 
        "@odata.type": "Microsoft.Dynamics.CRM.expando",
        "OrganizationalUnits@odata.type": "Collection(Microsoft.Dynamics.CRM.expando)",
        "OrganizationalUnits":[
            
                "@odata.type": "Microsoft.Dynamics.CRM.expando",
                "value": "b2054232-a114-ec11-b6e7-000d3a842ab8"
            
        ]
    
 

【讨论】:

以上是关于具有约束的 Dynamics 365 搜索资源可用性的主要内容,如果未能解决你的问题,请参考以下文章

在Dynamics 365中修改统一云接口的命令栏

Dynamics 365 设置Postman environment For WebAPI

Dynamics 365 设置Postman environment For WebAPI

Dynamics 365 N:N子网格添加现有Inline Lookup筛选

Dynamics 365 for Sales:轻松搭建自己的企业门户

Dynamics 365 App for Outlook 与 Dynamics 365 for Outlook(已被弃用)