I had error to delete dependencies of attribute. First of all I have retrieved all dependencies using RetrieveDependenciesForDeleteRequest
RetrieveDependenciesForDeleteRequest dependencyRequest = new RetrieveDependenciesForDeleteRequest
{
ComponentType = componentType,
ObjectId = retrieveResponse.AttributeMetadata.MetadataId.Value,
};
and program retrieves every dependence correctly. Then I would like to delete them using
foreach (var component in dependencyResponse.EntityCollection.Entities)
{
DeleteRequest deleteRequest = new DeleteRequest
{
Target = new EntityReference(component.LogicalName, component.Id)
};
service.Execute(deleteRequest);
But program gave me error The 'Delete' method does not support entities of type 'dependency'. MessageProcessorCache returned MessageProcessor.Empty. '. Maybe I did it with wrong method. I would like to ask if there is method to delete dependencies not records?
the dependency can be of different types, for example the attribute can be inside a form, inside a view, as a part of another calculated attribute.
The RetrieveDependenciesForDeleteRequest
will help you to find the Dependencies but you can't delete them with a single call, based on the dependency type you will need to perform a specific action (editing the form or the view following my previous example)