public List <Entity> RetrieveDependentComponents(Guid workflowId, string workflowName)
        {
            var request = new RetrieveDependentComponentsRequest
            {
                ObjectId      = workflowId,
                ComponentType = 29
            };

            var response = (RetrieveDependentComponentsResponse)Service.Execute(request);
            var result   = (EntityCollection)response.Results["EntityCollection"];

            return(result.Entities.ToList());
        }
        public static DataCollection <Entity> RetrieveDependentComponents(Guid workflowId, string workflowName)
        {
            RetrieveDependentComponentsRequest request = new RetrieveDependentComponentsRequest
            {
                ObjectId      = workflowId,
                ComponentType = 29
            };

            RetrieveDependentComponentsResponse response = (RetrieveDependentComponentsResponse)Context.Service.Execute(request);
            EntityCollection result = (EntityCollection)response.Results["EntityCollection"];

            return(result.Entities);
        }
        private List <Dependency> GetDependentComponents(int componentType, Guid metadataId)
        {
            var request = new RetrieveDependentComponentsRequest
            {
                ComponentType = componentType,
                ObjectId      = metadataId
            };

            var response = (RetrieveDependentComponentsResponse)_service.Execute(request);

            var listComponent = response.EntityCollection.Entities.Select(e => e.ToEntity <Dependency>()).ToList();

            return(listComponent);
        }
        public static IEnumerable <Dependency> GetDependencies(
            IOrganizationService orgSvc,
            componenttype componentType,
            Guid objectId)
        {
            var dependentComponentsRequest = new RetrieveDependentComponentsRequest
            {
                ComponentType = (int)componentType,
                ObjectId      = objectId
            };

            var dependentComponentsResponse = (RetrieveDependentComponentsResponse)orgSvc.Execute(dependentComponentsRequest);

            return(dependentComponentsResponse.EntityCollection.Entities.Select(e => e.ToEntity <Dependency>()));
        }
Example #5
0
        [STAThread] // Added to support UX

        static void Main(string[] args)
        {
            CrmServiceClient service = null;

            try
            {
                service = SampleHelpers.Connect("Connect");
                if (service.IsReady)
                {
                    #region Sample Code
                    #region Set up
                    SetUpSample(service);
                    #endregion Set up
                    #region Demonstrate
                    // Grab all Solution Components for a solution.
                    QueryByAttribute componentQuery = new QueryByAttribute
                    {
                        EntityName = SolutionComponent.EntityLogicalName,
                        ColumnSet  = new ColumnSet("componenttype", "objectid", "solutioncomponentid", "solutionid"),
                        Attributes = { "solutionid" },

                        // In your code, this value would probably come from another query.
                        Values = { _primarySolutionId }
                    };

                    IEnumerable <SolutionComponent> allComponents =
                        service.RetrieveMultiple(componentQuery).Entities.Cast <SolutionComponent>();

                    foreach (SolutionComponent component in allComponents)
                    {
                        // For each solution component, retrieve all dependencies for the component.
                        RetrieveDependentComponentsRequest dependentComponentsRequest =
                            new RetrieveDependentComponentsRequest
                        {
                            ComponentType = component.ComponentType.Value,
                            ObjectId      = component.ObjectId.Value
                        };
                        RetrieveDependentComponentsResponse dependentComponentsResponse =
                            (RetrieveDependentComponentsResponse)service.Execute(dependentComponentsRequest);

                        // If there are no dependent components, we can ignore this component.
                        if (dependentComponentsResponse.EntityCollection.Entities.Any() == false)
                        {
                            continue;
                        }

                        // If there are dependencies upon this solution component, and the solution
                        // itself is managed, then you will be unable to delete the solution.
                        Console.WriteLine("Found {0} dependencies for Component {1} of type {2}",
                                          dependentComponentsResponse.EntityCollection.Entities.Count,
                                          component.ObjectId.Value,
                                          component.ComponentType.Value
                                          );
                        //A more complete report requires more code
                        foreach (Dependency d in dependentComponentsResponse.EntityCollection.Entities)
                        {
                            DependencyReport(service, d);
                        }
                    }

                    //Find out if any dependencies on a  specific global option set would prevent it from being deleted
                    // Use the RetrieveOptionSetRequest message to retrieve
                    // a global option set by it's name.
                    RetrieveOptionSetRequest retrieveOptionSetRequest =
                        new RetrieveOptionSetRequest
                    {
                        Name = _globalOptionSetName
                    };

                    // Execute the request.
                    RetrieveOptionSetResponse retrieveOptionSetResponse =
                        (RetrieveOptionSetResponse)service.Execute(
                            retrieveOptionSetRequest);
                    _globalOptionSetId = retrieveOptionSetResponse.OptionSetMetadata.MetadataId;
                    if (_globalOptionSetId != null)
                    {
                        //Use the global OptionSet MetadataId with the appropriate componenttype
                        // to call RetrieveDependenciesForDeleteRequest
                        RetrieveDependenciesForDeleteRequest retrieveDependenciesForDeleteRequest = new RetrieveDependenciesForDeleteRequest
                        {
                            ComponentType = (int)componenttype.OptionSet,
                            ObjectId      = (Guid)_globalOptionSetId
                        };

                        RetrieveDependenciesForDeleteResponse retrieveDependenciesForDeleteResponse =
                            (RetrieveDependenciesForDeleteResponse)service.Execute(retrieveDependenciesForDeleteRequest);
                        Console.WriteLine("");
                        foreach (Dependency d in retrieveDependenciesForDeleteResponse.EntityCollection.Entities)
                        {
                            if (d.DependentComponentType.Value == 2)//Just testing for Attributes
                            {
                                String attributeLabel = "";
                                RetrieveAttributeRequest retrieveAttributeRequest = new RetrieveAttributeRequest
                                {
                                    MetadataId = (Guid)d.DependentComponentObjectId
                                };
                                RetrieveAttributeResponse retrieveAttributeResponse = (RetrieveAttributeResponse)service.Execute(retrieveAttributeRequest);

                                AttributeMetadata attmet = retrieveAttributeResponse.AttributeMetadata;

                                attributeLabel = attmet.DisplayName.UserLocalizedLabel.Label;

                                Console.WriteLine("An {0} named {1} will prevent deleting the {2} global option set.",
                                                  (componenttype)d.DependentComponentType.Value,
                                                  attributeLabel,
                                                  _globalOptionSetName);
                            }
                        }
                    }

                    #region Clean up
                    CleanUpSample(service);
                    #endregion Clen up

                    //DeleteRequiredRecords(promptForDelete);
                }
                #endregion Demonstrate
                #endregion Sample Code

                else
                {
                    const string UNABLE_TO_LOGIN_ERROR = "Unable to Login to Dynamics CRM";
                    if (service.LastCrmError.Equals(UNABLE_TO_LOGIN_ERROR))
                    {
                        Console.WriteLine("Check the connection string values in cds/App.config.");
                        throw new Exception(service.LastCrmError);
                    }
                    else
                    {
                        throw service.LastCrmException;
                    }
                }
            }
            catch (Exception ex)
            {
                SampleHelpers.HandleException(ex);
            }

            finally
            {
                if (service != null)
                {
                    service.Dispose();
                }

                Console.WriteLine("Press <Enter> to exit.");
                Console.ReadLine();
            }
        }
        /// <summary>
        /// Shows how to detect dependencies that may cause a managed solution to become
        /// un-deletable.
        /// 
        /// Get all solution components of a solution
        /// For each solution component, list the dependencies upon that component.
        /// </summary>
        /// <param name="serverConfig">Contains server connection information.</param>
        /// <param name="promptForDelete">When True, the user will be prompted to delete all
        /// created entities.</param>
        public void Run(ServerConnection.Configuration serverConfig, bool promptForDelete)
        {
            try
            {

                // Connect to the Organization service. 
                // The using statement assures that the service proxy will be properly disposed.
                using (_serviceProxy = new OrganizationServiceProxy(serverConfig.OrganizationUri, serverConfig.HomeRealmUri,serverConfig.Credentials, serverConfig.DeviceCredentials))
                {
                    // This statement is required to enable early-bound type support.
                    _serviceProxy.EnableProxyTypes();

                    // Call the method to create any data that this sample requires.
                    CreateRequiredRecords();
                    //<snippetGetSolutionDependencies1>

                    // Grab all Solution Components for a solution.
                    QueryByAttribute componentQuery = new QueryByAttribute
                    {
                        EntityName = SolutionComponent.EntityLogicalName,
                        ColumnSet = new ColumnSet("componenttype", "objectid", "solutioncomponentid", "solutionid"),
                        Attributes = { "solutionid" },

                        // In your code, this value would probably come from another query.
                        Values = { _primarySolutionId }
                    };

                    IEnumerable<SolutionComponent> allComponents =
                        _serviceProxy.RetrieveMultiple(componentQuery).Entities.Cast<SolutionComponent>();

                    foreach (SolutionComponent component in allComponents)
                    {
                        // For each solution component, retrieve all dependencies for the component.
                        RetrieveDependentComponentsRequest dependentComponentsRequest =
                            new RetrieveDependentComponentsRequest
                            {
                                ComponentType = component.ComponentType.Value,
                                ObjectId = component.ObjectId.Value
                            };
                        RetrieveDependentComponentsResponse dependentComponentsResponse =
                            (RetrieveDependentComponentsResponse)_serviceProxy.Execute(dependentComponentsRequest);

                        // If there are no dependent components, we can ignore this component.
                        if (dependentComponentsResponse.EntityCollection.Entities.Any() == false)
                            continue;

                        // If there are dependencies upon this solution component, and the solution
                        // itself is managed, then you will be unable to delete the solution.
                        Console.WriteLine("Found {0} dependencies for Component {1} of type {2}",
                            dependentComponentsResponse.EntityCollection.Entities.Count,
                            component.ObjectId.Value,
                            component.ComponentType.Value
                            );
                        //A more complete report requires more code
                        foreach (Dependency d in dependentComponentsResponse.EntityCollection.Entities)
                        {
                            DependencyReport(d);
                        }
                    }
                    //</snippetGetSolutionDependencies1>

                 //Find out if any dependencies on a  specific global option set would prevent it from being deleted
                    //<snippetGetSolutionDependencies8>
                    // Use the RetrieveOptionSetRequest message to retrieve  
                    // a global option set by it's name.
                    RetrieveOptionSetRequest retrieveOptionSetRequest =
                        new RetrieveOptionSetRequest
                        {
                         Name = _globalOptionSetName
                        };

                    // Execute the request.
                    RetrieveOptionSetResponse retrieveOptionSetResponse =
                        (RetrieveOptionSetResponse)_serviceProxy.Execute(
                        retrieveOptionSetRequest);
                    _globalOptionSetId = retrieveOptionSetResponse.OptionSetMetadata.MetadataId;
                    if (_globalOptionSetId != null)
                    { 
                     //Use the global OptionSet MetadataId with the appropriate componenttype
                     // to call RetrieveDependenciesForDeleteRequest
                     RetrieveDependenciesForDeleteRequest retrieveDependenciesForDeleteRequest = new RetrieveDependenciesForDeleteRequest 
                    { 
                     ComponentType = (int)componenttype.OptionSet,
                     ObjectId = (Guid)_globalOptionSetId
                    };

                     RetrieveDependenciesForDeleteResponse retrieveDependenciesForDeleteResponse =
                      (RetrieveDependenciesForDeleteResponse)_serviceProxy.Execute(retrieveDependenciesForDeleteRequest);
                     Console.WriteLine("");
                     foreach (Dependency d in retrieveDependenciesForDeleteResponse.EntityCollection.Entities)
                     {

                      if (d.DependentComponentType.Value == 2)//Just testing for Attributes
                      {
                       String attributeLabel = "";
                       RetrieveAttributeRequest retrieveAttributeRequest = new RetrieveAttributeRequest
                       {
                        MetadataId = (Guid)d.DependentComponentObjectId
                       };
                       RetrieveAttributeResponse retrieveAttributeResponse = (RetrieveAttributeResponse)_serviceProxy.Execute(retrieveAttributeRequest);

                       AttributeMetadata attmet = retrieveAttributeResponse.AttributeMetadata;

                       attributeLabel = attmet.DisplayName.UserLocalizedLabel.Label;
                      
                        Console.WriteLine("An {0} named {1} will prevent deleting the {2} global option set.", 
                       (componenttype)d.DependentComponentType.Value, 
                       attributeLabel, 
                       _globalOptionSetName);
                      }
                     }                 
                    }

                    //</snippetGetSolutionDependencies8>

                    DeleteRequiredRecords(promptForDelete);
                }
            }

            // Catch any service fault exceptions that Microsoft Dynamics CRM throws.
            catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
            {
                // You can handle an exception here or pass it back to the calling method.
                throw;
            }
        }
        /// <summary>
        /// Deletes any entity records that were created for this sample.
        /// <param name="prompt">Indicates whether to prompt the user to
        /// delete the records created in this sample.</param>
        /// </summary>
        public void DeleteRequiredRecords(bool prompt)
        {
            bool deleteRecords = true;

            if (prompt)
            {
                Console.WriteLine("\nDo you want these entity records deleted? (y/n)");
                String answer = Console.ReadLine();

                deleteRecords = (answer.StartsWith("y") || answer.StartsWith("Y"));
            }

            if (deleteRecords)
            {
                #region How to delete a option from a option set
                // Use the DeleteOptionValueRequest message
                // to remove the newly inserted label.
                DeleteOptionValueRequest deleteOptionValueRequest =
                    new DeleteOptionValueRequest
                {
                    OptionSetName = _globalOptionSetName,
                    Value         = _insertedOptionValue
                };

                // Execute the request.
                _serviceProxy.Execute(deleteOptionValueRequest);

                Console.WriteLine("Option Set option removed.");
                #endregion How to delete a option from a option set

                #region How to delete attribute
                // Create the request to see which components have a dependency on the
                // global option set.
                RetrieveDependentComponentsRequest dependencyRequest =
                    new RetrieveDependentComponentsRequest
                {
                    ObjectId      = _optionSetId,
                    ComponentType = (int)componenttype.OptionSet
                };

                RetrieveDependentComponentsResponse dependencyResponse =
                    (RetrieveDependentComponentsResponse)_serviceProxy.Execute(
                        dependencyRequest);

                // Here you would check the dependencyResponse.EntityCollection property
                // and act as appropriate. However, we know there is exactly one
                // dependency so this example deals with it directly and deletes
                // the previously created attribute.
                DeleteAttributeRequest deleteAttributeRequest =
                    new DeleteAttributeRequest
                {
                    EntityLogicalName = Contact.EntityLogicalName,
                    LogicalName       = "sample_examplepicklist"
                };

                _serviceProxy.Execute(deleteAttributeRequest);

                Console.WriteLine("Referring attribute deleted.");
                #endregion How to delete attribute

                #region How to delete global option set

                // Finally, delete the global option set. Attempting this before deleting
                // the picklist above will result in an exception being thrown.
                DeleteOptionSetRequest deleteRequest = new DeleteOptionSetRequest
                {
                    Name = _globalOptionSetName
                };

                _serviceProxy.Execute(deleteRequest);
                Console.WriteLine("Global Option Set deleted");
                #endregion How to delete global option set
            }
        }
        /// <summary>
        /// Shows how to detect dependencies that may cause a managed solution to become
        /// un-deletable.
        /// 
        /// Get all solution components of a solution
        /// For each solution component, list the dependencies upon that component.
        /// </summary>
        /// <param name="serverConfig">Contains server connection information.</param>
        /// <param name="promptForDelete">When True, the user will be prompted to delete all
        /// created entities.</param>
        public void Run(ServerConnection.Configuration serverConfig, bool promptForDelete)
        {
            try
            {

                // Connect to the Organization service. 
                // The using statement assures that the service proxy will be properly disposed.
                using (_serviceProxy = new OrganizationServiceProxy(serverConfig.OrganizationUri, serverConfig.HomeRealmUri,serverConfig.Credentials, serverConfig.DeviceCredentials))
                {
                    // This statement is required to enable early-bound type support.
                    _serviceProxy.EnableProxyTypes();

                    // Call the method to create any data that this sample requires.
                    CreateRequiredRecords();
                    //<snippetGetSolutionDependencies1>

                    // Grab all Solution Components for a solution.
                    QueryByAttribute componentQuery = new QueryByAttribute
                    {
                        EntityName = SolutionComponent.EntityLogicalName,
                        ColumnSet = new ColumnSet("componenttype", "objectid", "solutioncomponentid", "solutionid"),
                        Attributes = { "solutionid" },

                        // In your code, this value would probably come from another query.
                        Values = { _primarySolutionId }
                    };

                    IEnumerable<SolutionComponent> allComponents =
                        _serviceProxy.RetrieveMultiple(componentQuery).Entities.Cast<SolutionComponent>();

                    foreach (SolutionComponent component in allComponents)
                    {
                        // For each solution component, retrieve all dependencies for the component.
                        RetrieveDependentComponentsRequest dependentComponentsRequest =
                            new RetrieveDependentComponentsRequest
                            {
                                ComponentType = component.ComponentType.Value,
                                ObjectId = component.ObjectId.Value
                            };
                        RetrieveDependentComponentsResponse dependentComponentsResponse =
                            (RetrieveDependentComponentsResponse)_serviceProxy.Execute(dependentComponentsRequest);

                        // If there are no dependent components, we can ignore this component.
                        if (dependentComponentsResponse.EntityCollection.Entities.Any() == false)
                            continue;

                        // If there are dependencies upon this solution component, and the solution
                        // itself is managed, then you will be unable to delete the solution.
                        Console.WriteLine("Found {0} dependencies for Component {1} of type {2}",
                            dependentComponentsResponse.EntityCollection.Entities.Count,
                            component.ObjectId.Value,
                            component.ComponentType.Value
                            );
                        //A more complete report requires more code
                        foreach (Dependency d in dependentComponentsResponse.EntityCollection.Entities)
                        {
                            DependencyReport(d);
                        }
                    }
                    //</snippetGetSolutionDependencies1>

                 //Find out if any dependencies on a  specific global option set would prevent it from being deleted
                    //<snippetGetSolutionDependencies8>
                    // Use the RetrieveOptionSetRequest message to retrieve  
                    // a global option set by it's name.
                    RetrieveOptionSetRequest retrieveOptionSetRequest =
                        new RetrieveOptionSetRequest
                        {
                         Name = _globalOptionSetName
                        };

                    // Execute the request.
                    RetrieveOptionSetResponse retrieveOptionSetResponse =
                        (RetrieveOptionSetResponse)_serviceProxy.Execute(
                        retrieveOptionSetRequest);
                    _globalOptionSetId = retrieveOptionSetResponse.OptionSetMetadata.MetadataId;
                    if (_globalOptionSetId != null)
                    { 
                     //Use the global OptionSet MetadataId with the appropriate componenttype
                     // to call RetrieveDependenciesForDeleteRequest
                     RetrieveDependenciesForDeleteRequest retrieveDependenciesForDeleteRequest = new RetrieveDependenciesForDeleteRequest 
                    { 
                     ComponentType = (int)componenttype.OptionSet,
                     ObjectId = (Guid)_globalOptionSetId
                    };

                     RetrieveDependenciesForDeleteResponse retrieveDependenciesForDeleteResponse =
                      (RetrieveDependenciesForDeleteResponse)_serviceProxy.Execute(retrieveDependenciesForDeleteRequest);
                     Console.WriteLine("");
                     foreach (Dependency d in retrieveDependenciesForDeleteResponse.EntityCollection.Entities)
                     {

                      if (d.DependentComponentType.Value == 2)//Just testing for Attributes
                      {
                       String attributeLabel = "";
                       RetrieveAttributeRequest retrieveAttributeRequest = new RetrieveAttributeRequest
                       {
                        MetadataId = (Guid)d.DependentComponentObjectId
                       };
                       RetrieveAttributeResponse retrieveAttributeResponse = (RetrieveAttributeResponse)_serviceProxy.Execute(retrieveAttributeRequest);

                       AttributeMetadata attmet = retrieveAttributeResponse.AttributeMetadata;

                       attributeLabel = attmet.DisplayName.UserLocalizedLabel.Label;
                      
                        Console.WriteLine("An {0} named {1} will prevent deleting the {2} global option set.", 
                       (componenttype)d.DependentComponentType.Value, 
                       attributeLabel, 
                       _globalOptionSetName);
                      }
                     }                 
                    }

                    //</snippetGetSolutionDependencies8>

                    DeleteRequiredRecords(promptForDelete);
                }
            }

            // Catch any service fault exceptions that Microsoft Dynamics CRM throws.
            catch (FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>)
            {
                // You can handle an exception here or pass it back to the calling method.
                throw;
            }
        }
Example #9
0
        /// <summary>
        /// Deletes any entity records that were created for this sample.
        /// <param name="prompt">Indicates whether to prompt the user to 
        /// delete the records created in this sample.</param>
        /// </summary>
        public void DeleteRequiredRecords(bool prompt)
        {
            bool deleteRecords = true;

            if (prompt)
            {
                Console.WriteLine("\nDo you want these entity records deleted? (y/n)");
                String answer = Console.ReadLine();

                deleteRecords = (answer.StartsWith("y") || answer.StartsWith("Y"));
            }

            if (deleteRecords)
            {
                #region How to delete a option from a option set
                //<snippetWorkwithGlobalOptionSets11>
                // Use the DeleteOptionValueRequest message 
                // to remove the newly inserted label.
                DeleteOptionValueRequest deleteOptionValueRequest =
                    new DeleteOptionValueRequest
                {
                    OptionSetName = _globalOptionSetName,
                    Value = _insertedOptionValue
                };

                // Execute the request.
                _serviceProxy.Execute(deleteOptionValueRequest);
                //</snippetWorkwithGlobalOptionSets11>

                Console.WriteLine("Option Set option removed.");
                #endregion How to delete a option from a option set

                #region How to delete attribute
                //<snippetWorkwithGlobalOptionSets12>
                // Create the request to see which components have a dependency on the
                // global option set.
                RetrieveDependentComponentsRequest dependencyRequest =
                    new RetrieveDependentComponentsRequest
                    {
                        ObjectId = _optionSetId,
                        ComponentType = (int)componenttype.OptionSet
                    };

                RetrieveDependentComponentsResponse dependencyResponse =
                    (RetrieveDependentComponentsResponse)_serviceProxy.Execute(
                    dependencyRequest);

                // Here you would check the dependencyResponse.EntityCollection property
                // and act as appropriate. However, we know there is exactly one 
                // dependency so this example deals with it directly and deletes 
                // the previously created attribute.
                DeleteAttributeRequest deleteAttributeRequest =
                    new DeleteAttributeRequest
                {
                    EntityLogicalName = Contact.EntityLogicalName,
                    LogicalName = "sample_examplepicklist"
                };

                _serviceProxy.Execute(deleteAttributeRequest);
              
                Console.WriteLine("Referring attribute deleted.");
                #endregion How to delete attribute

                #region How to delete global option set
                
                // Finally, delete the global option set. Attempting this before deleting
                // the picklist above will result in an exception being thrown.
                //<snippetWorkwithGlobalOptionSets.DeleteOptionSetRequest>
                DeleteOptionSetRequest deleteRequest = new DeleteOptionSetRequest
                {
                    Name = _globalOptionSetName
                };

                _serviceProxy.Execute(deleteRequest);
                //</snippetWorkwithGlobalOptionSets.DeleteOptionSetRequest>
                //</snippetWorkwithGlobalOptionSets12>
                Console.WriteLine("Global Option Set deleted");
                #endregion How to delete global option set
            }
        }
        public void GenerateEarlyBoundEntities(string connectionstring, List <string> entities, List <string> globalOptionSets, List <string> actions, string @namespace, string filepath, string servicecontextname)
        {
            if (string.IsNullOrWhiteSpace(servicecontextname))
            {
                servicecontextname = null;
            }

            var intepret = Utility.InterpretConnectionstring.Interpret(connectionstring);

            if (actions != null)
            {
                actions = actions.Select(x => x.ToLower()).ToList();
            }

            var service = Connection.CrmConnection.GetClientByConnectionString(connectionstring);
            var globalOptionSetDepedencies = new List <XrmEarlyBound.Utility.ListItem>(); //new Dictionary<string, string>();

            foreach (var gos in globalOptionSets)
            {
                var response = (RetrieveOptionSetResponse)service.Execute(new RetrieveOptionSetRequest {
                    Name = gos
                });
                RetrieveDependentComponentsRequest dependencyRequest = new RetrieveDependentComponentsRequest
                {
                    ObjectId      = response.OptionSetMetadata.MetadataId.Value,
                    ComponentType = 9
                };

                var result = (RetrieveDependentComponentsResponse)service.Execute(dependencyRequest);

                foreach (var dep in result.EntityCollection.Entities)
                {
                    var dependentcomponentobjectid = (Guid)dep.Attributes["dependentcomponentobjectid"];
                    var _result = (RetrieveAttributeResponse)service.Execute(new RetrieveAttributeRequest {
                        MetadataId = dependentcomponentobjectid
                    });

                    if (_result.AttributeMetadata != null && _result.AttributeMetadata.EntityLogicalName != null && _result.AttributeMetadata.LogicalName != null)
                    {
                        globalOptionSetDepedencies.Add(new Utility.ListItem
                        {
                            Item1 = $"{_result.AttributeMetadata.EntityLogicalName.ToLower()}_{_result.AttributeMetadata.LogicalName.ToLower()}",
                            Item2 = gos
                        });
                    }
                }
            }

            var config = new Utility.Config
            {
                Entites                     = entities,
                Actions                     = actions,
                GlobalOptionSets            = globalOptionSets,
                GlobalOptionSetsDepedencies = globalOptionSetDepedencies
            };

            config.Save();

            var hasActions = actions != null ? actions.Count > 0 : false;

            var outpath = GetPath(filepath);

            Utility.RunSvcProcess.Run(intepret.Url, intepret.UserName, intepret.Domain, intepret.Password, @namespace, filepath, hasActions, servicecontextname, ShowMessage);

            config.Delete();
        }