To avoid a lot of unnecessary details, our system is made up of several unmanaged solutions. When migrating these solutions, we frequently run into conflicts with certain fields, such as if a field OptionSet was changed to use a Global OptionSet, etc. Because we're using unmanaged solutions, most import tools/scripts don't deal with these conflicts automatically, so we end up having to manually remove the field's dependencies then deleting the field from the target environment in order to load our solutions.
As a result, we're looking for a way to query a field's dependencies in order to automate the process of removing these dependencies.
I've gotten as far as querying the Entity Metadata, which does contain information about our entities and their fields. Unfortunately, I can't quite figure out how to link that to the ObjectId field on the RetrieveDependenciesForDeleteRequest, which appears to be what we're looking for.
I've tried feeding the MetadataId from a field into a RetrieveDependenciesForDeleteRequest, but this throws an exception so it's clearly not the right GUID.
Any suggestions?