Deleting teams in Dynamics CRM 4.0

In CRM version 4.0, the web application does not provide an option for deleting teams. However, teams can be deleted using the web services.

You’ll need to know the GUID of the team record. Here is sample code:

           // Set up the CRM Service.
            CrmAuthenticationToken token = new CrmAuthenticationToken();
            token.AuthenticationType = 0;
            token.OrganizationName = "AdventureWorksCycle";

            CrmService service = new CrmService();
            service.Url = "http://crm/mscrmservices/2007/crmservice.asmx";
            service.CrmAuthenticationTokenValue = token;
            service.Credentials = System.Net.CredentialCache.DefaultCredentials;

            // Create the target object for the request.
            TargetDeleteTeam target = new TargetDeleteTeam();
            // EntityId is the GUID of the record being deleted.
            target.EntityId = new Guid("60F77BF5-6764-DF11-81DD-0003FF7E73B4");

            // Create the request object.
            DeleteRequest delete = new DeleteRequest();
            delete.Target = target;

            // Execute the request.
            DeleteResponse deleted = (DeleteResponse)service.Execute(delete);

Leave a Comment

Your email address will not be published. Required fields are marked *