我正在使用此 POST 在 DataVerse 中创建多对多关系。
https://mysite.dynamics.com/api/data/v9.0/new_classes(649c332d-ca46-ee11-be6f-00224894adf7)/new_class_new_student/$ref
"body": {"@odata.context":"https://mysite.dynamics.com/api/data/v9.0/$metadata#$ref",
"@odata.id":"new_students(574af921-62f8-ec11-813d-005056893571)"}
效果非常好。不过,我在 Associate 方法上有一个 Dynamics CE 插件,我用它来维护带有附加列的自定义多对多。我想在通话中传递一些附加数据,比如 StartDate。
在插件方面,当它运行时,我会得到一个学生的 EntityReferenceCollection,其 id 是我在上面传递的(尽管我只传递了一名学生)。
EntityReferenceCollection students = (EntityReferenceCollection)context.InputParameters["RelatedEntities"];
调试时,我看到集合中的学生有一个 ExtensionData 属性。
有没有办法在POST中传递ExtensionData?
"body": {"@odata.context":"https://mysite.dynamics.com/api/data/v9.0/$metadata#$ref",
"@odata.id":"new_students(574af921-62f8-ec11-813d-005056893571)",
"ExtensionData":"{"StartDate":"12/12/2023"}"}
一位 MVP 对此写了一篇非常好的文章。您可以在这里找到它:https://carldesouza.com/tag-shared-variable-custom-values-web-api-plugins/