When you say "components" are you referring to deleting Attributes within Entities?
If that is the case, it is a relatively easy thing to do to set up a Console Application in Visual Studio and iterate through a list of Attributes and delete them.
I tend to like reading from an Excel File, but you can set up lists within the Application, or even iterate through ColumnSets.
// Delete all attributes created for this sample.
foreach (attributeRow in addedAttributes) // <-- This is a poorly constructed for loop without proper naming
{
DeleteAttributeRequest deleteAttribute = new DeleteAttributeRequest {
EntityLogicalName = (string)attributeRow[TableName],
LogicalName = (string)attributeRow[AttributeSchemaName]
};
svc.Execute(deleteAttribute); // Execute the request
}
As a clearer example, I will set up a Request for a custom field in the "account" entity:
DeleteAttributeRequest deleteAttribute = new DeleteAttributeRequest {EntityLogicalName = "account", LogicalName = "new_region"};
svc.Execute(deleteAttribute); // Execute the request
I would put a try-catch around "svc.Execute" to capture misnamed attributes or attributes that still have dependencies on them. I would also output the results to a text file within a "Using" Method by inserting Console.WriteLine("") statements within the foreach loop to document each Delete. I didn't include all of the logic to try to keep the concept fairly simple.
You can read more information in the Sdk Documentation here:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.deleteattributerequest?view=dynamics-general-ce-9
------------------------------
Gerry Yurko
CRM Developer
Crown Castle Fiber Networks
Boxborough MA
------------------------------
Original Message:
Sent: Jan 11, 2022 12:53 PM
From: Grace Jensen
Subject: Synchronization Between Dev, Test and Production environments
We have the following environments. We are in the process of consolidating our solutions into a master solution and creating patches for any future enhancements. In the effort to consolidate our solutions we are deleting unused components. In our managed environments this is happening as part of deleting the base solution where the component was created. However, in our unmanaged development environment, my understanding is we have to delete the solution and then find and delete the component from the default solution. Has anyone else solved this scenario? We have close to 1,000 components that need to be deleted and are trying to find the most efficient way to accomplish this. Thanks in advance for any advice!
Development: unmanaged
Test: managed
Production: managed
------------------------------
Grace Jensen
Section Manager
Burns & McDonnell
------------------------------