使用备用键删除
Delete using alternate key
因为我们可以使用 alternate key 更新实体:
var entity = new Entity("my_entity", "my_alternate_key", "my_value");
entity["my_updated_field"] = "Update";
service.Update(entity);
我原以为可以用同样的方式删除:
var ref = new EntityReference("my_entity", "my_alternate_key", "my_value");
service.Delete(ref);
但是Delete
只能拿一个Guid
有没有办法使用备用键删除记录?
我的意思是之前没有找回
您需要RetrieveMultiple to get the GUIDs that you want to delete, and then call Delete。
您不能使用组织服务通过备用键删除。为此,您需要有相关记录的 GUID(例如,首先检索它)。
可以通过 Web API 使用备用键删除,如 MSDN 所示:
Any time you need to uniquely identify an entity to retrieve, update,
or delete, you can use alternate keys configured for the entity
因为我们可以使用 alternate key 更新实体:
var entity = new Entity("my_entity", "my_alternate_key", "my_value");
entity["my_updated_field"] = "Update";
service.Update(entity);
我原以为可以用同样的方式删除:
var ref = new EntityReference("my_entity", "my_alternate_key", "my_value");
service.Delete(ref);
但是Delete
只能拿一个Guid
有没有办法使用备用键删除记录?
我的意思是之前没有找回
您需要RetrieveMultiple to get the GUIDs that you want to delete, and then call Delete。
您不能使用组织服务通过备用键删除。为此,您需要有相关记录的 GUID(例如,首先检索它)。
可以通过 Web API 使用备用键删除,如 MSDN 所示:
Any time you need to uniquely identify an entity to retrieve, update, or delete, you can use alternate keys configured for the entity