Beispiel #1
0
        public static List <Dependency> GetSolutionDependencies(IOrganizationService service, Guid solutionId)
        {
            var dependencies = new List <Dependency>();
            var components   = GetSolutionComponents(service, solutionId, false);

            foreach (var component in components)
            {
                var req = new RetrieveRequiredComponentsRequest()
                {
                    ComponentType = (int)component.Type,
                    ObjectId      = component.ObjectId,
                };
                var response = (RetrieveRequiredComponentsResponse)service.Execute(req);
                foreach (var dependency in response.EntityCollection.Entities.Select(k => k.ToDependency()).ToList())
                {
                    var foundAlready = dependencies.FirstOrDefault(k => k.Id == dependency.Id);
                    if (foundAlready == null)
                    {
                        dependencies.Add(dependency);
                    }
                }
            }

            return(dependencies);
            //var dependencyRequest = new RetrieveMissingDependenciesRequest()
            //{
            //    SolutionUniqueName = solutionUniqueName
            //};
            //var response = (RetrieveMissingDependenciesResponse)service.Execute(dependencyRequest);
            //return response.EntityCollection.Entities.Select(k => k.ToDependency()).ToList();
        }
        public List <Entity> RetrieveRequiredComponents(Guid workflowId)
        {
            var request = new RetrieveRequiredComponentsRequest
            {
                ObjectId      = workflowId,
                ComponentType = 29
            };

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

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

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

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

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

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

            return(listComponent);
        }
Beispiel #5
0
        private IEnumerable <OrganizationRequest> RetrieveDependentComponents(IOrganizationService service,
                                                                              Dependency dependency)
        {
            if (dependency.DependentComponentObjectId == null)
            {
                yield break;
            }

            var retrieveRequiredComponentsRequest = new RetrieveRequiredComponentsRequest()
            {
                ComponentType = dependency.DependentComponentType.Value,
                ObjectId      = dependency.DependentComponentObjectId.Value
            };

            var response = (RetrieveRequiredComponentsResponse)service.Execute(retrieveRequiredComponentsRequest);

            foreach (var dep in response.EntityCollection.Entities.Select(e => e.ToEntity <Dependency>()))
            {
                if (dep.RequiredComponentType.Value != (int)Dependency.OptionSet.ComponentType.Workflow)
                {
                    continue;
                }

                if (dep.RequiredComponentObjectId != null)
                {
                    yield return new AddSolutionComponentRequest
                           {
                               AddRequiredComponents = false,
                               ComponentType         = dep.RequiredComponentType.Value,
                               ComponentId           = dep.RequiredComponentObjectId.Value,
                               SolutionUniqueName    = SolutionName
                           }
                }
                ;
            }
        }
    }