protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); int[] languageIds = null; if (All.IsPresent) { OrganizationResponse response = _repository.Execute("RetrieveAvailableLanguages"); languageIds = (int[])response.Results["LocaleIds"]; } else if (ListAvailable.IsPresent) { OrganizationResponse response = _repository.Execute("RetrieveDeprovisionedLanguages"); languageIds = (int[])response.Results["RetrieveDeprovisionedLanguages"]; } else { OrganizationResponse response = _repository.Execute("RetrieveProvisionedLanguages"); languageIds = (int[])response.Results["RetrieveProvisionedLanguages"]; } if (languageIds != null) { WriteObject(languageIds.Select(l => CultureInfo.GetCultureInfo(l)).OrderBy(c => c.Name)); } }
private void ExecuteTestUninstall(string solutionUniqueName) { OrganizationResponse response = _repository.Execute("RetrieveDependenciesForUninstall", new Hashtable() { { "SolutionUniqueName", solutionUniqueName } }); EntityCollection collection = (EntityCollection)response["EntityCollection"]; WriteObject(collection.Entities, true); }
private void ExecuteTestDelete(int componentType, Guid objectId) { OrganizationResponse response = _repository.Execute("RetrieveDependenciesForDelete", new Hashtable() { { "ComponentType", componentType }, { "ObjectId", objectId } }); EntityCollection collection = (EntityCollection)response["EntityCollection"]; WriteObject(collection.Entities, true); }
private void AssignOwner(EntityReference owner, EntityReference record) { OrganizationRequest request = new OrganizationRequest("Assign") { Parameters = new ParameterCollection() }; request.Parameters["Assignee"] = owner; request.Parameters["Target"] = record; _repository.Execute(request); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); string solutionUniqueName = SolutionManagementHelper.GetSolutionUniqueName(_repository, Solution, false); int componentTypeValue = 0; if (int.TryParse(Type, out int typeAsInt) && _validComponentTypes.ContainsKey(typeAsInt)) { componentTypeValue = typeAsInt; } else if (_validComponentTypes.Any(v => v.Value.Equals(Type, StringComparison.InvariantCultureIgnoreCase))) { componentTypeValue = _validComponentTypes.First(v => v.Value.Equals(Type, StringComparison.InvariantCultureIgnoreCase)).Key; } else { throw new NotSupportedException(string.Format("ComponentType '{0}' is not supported.", Type)); } OrganizationRequest request = new OrganizationRequest("RemoveSolutionComponent") { Parameters = new ParameterCollection() { { "SolutionUniqueName", solutionUniqueName }, { "ComponentType", componentTypeValue }, { "ComponentId", ComponentId } } }; OrganizationResponse response = _repository.Execute(request); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); foreach (string fullPath in ResolvePaths(_paths, _shouldExpandWildcards)) { byte[] content = File.ReadAllBytes(fullPath); ExecuteAction(fullPath, delegate { Guid importjobid = Guid.NewGuid(); _repository.Execute("ImportSolution", new Hashtable() { { "CustomizationFile", content }, { "ImportJobId", importjobid }, { "ConvertToManaged", ConvertToManaged.ToBool() }, { "OverwriteUnmanagedCustomizations", Overwrite.ToBool() }, { "PublishWorkflows", PublishWorkflows.ToBool() }, { "SkipProductUpdateDependencies", SkipDependencies.ToBool() } }); WriteObject(_repository.Get("importjob", importjobid)); }); } }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); foreach (Guid id in Record) { ExecuteAction(id.ToString(), Process.ToString(), delegate { OrganizationRequest request = new OrganizationRequest() { RequestName = "ExecuteWorkflow" }; request.Parameters["EntityId"] = id; request.Parameters["WorkflowId"] = Process; OrganizationResponse response = _repository.Execute(request); if (PassThru) { Guid asyncId = (Guid)response.Results["Id"]; WriteObject(_repository.Get("asyncoperation", asyncId)); } }); } }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); Hashtable requestParameters = new Hashtable() { { "SolutionName", SolutionManagementHelper.GetSolutionUniqueName(_repository, Id, false) }, { "ExportAutoNumberingSettings", AutoNumberingSettings.ToBool() }, { "ExportCalendarSettings", CalendarSettings.ToBool() }, { "ExportCustomizationSettings", CustomizationSettings.ToBool() }, { "ExportEmailTrackingSettings", EmailTrackingSettings.ToBool() }, { "ExportGeneralSettings", GeneralSettings.ToBool() }, { "ExportIsvConfig", IsvConfig.ToBool() }, { "ExportMarketingSettings", MarketingSettings.ToBool() }, { "ExportOutlookSynchronizationSettings", OutlookSynchronizationSettings.ToBool() }, { "ExportRelationshipRoles", RelationshipRoles.ToBool() }, { "Managed", Managed.ToBool() } }; if (_context != null) { _context.SetParametersOnRequest(requestParameters); } OrganizationResponse response = _repository.Execute("ExportSolution", requestParameters); File.WriteAllBytes(Path, (byte[])response.Results["ExportSolutionFile"]); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); OrganizationResponse response = _repository.Execute(Request, Parameters); WriteObject(response.Results); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); OrganizationResponse response = _repository.Execute("ExportTranslation", new Hashtable() { { "SolutionName", SolutionManagementHelper.GetSolutionUniqueName(_repository, Solution, false) } }); File.WriteAllBytes(Path, (byte[])response.Results["ExportTranslationFile"]); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteAction(string.Format("{0}", LocaleId), delegate { OrganizationResponse response = _repository.Execute("DeprovisionLanguage", new Hashtable() { { "Language", LocaleId } }); }); }
public static void RemoveUsersFromTeam(ContentRepository repository, Guid teamId, Guid[] userIds) { OrganizationRequest request = new OrganizationRequest("RemoveMembersTeam") { Parameters = new ParameterCollection() }; request.Parameters["TeamId"] = teamId; request.Parameters["MemberIds"] = userIds; OrganizationResponse response = repository.Execute(request); }
private QueryExpression BuildQueryExpression(string fetchXml) { OrganizationRequest request = new OrganizationRequest() { RequestName = "FetchXmlToQueryExpression" }; request.Parameters["FetchXml"] = fetchXml; OrganizationResponse response = _repository.Execute(request); return((QueryExpression)response.Results["Query"]); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteAction(string.Format("{0}", User), delegate { OrganizationRequest request = new OrganizationRequest("RemoveParent") { Parameters = new ParameterCollection() }; request.Parameters["Target"] = new EntityReference("systemuser", User); OrganizationResponse response = _repository.Execute(request); }); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); OrganizationRequest request = new OrganizationRequest("SetState") { Parameters = new ParameterCollection() }; request.Parameters.Add("EntityMoniker", new EntityReference("sdkmessageprocessingstep", Id)); request.Parameters.Add("State", new OptionSetValue(1)); request.Parameters.Add("Status", new OptionSetValue(-1)); _repository.Execute(request); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); foreach (string fullPath in ResolvePaths(_paths, _shouldExpandWildcards)) { byte[] content = File.ReadAllBytes(fullPath); if (Async.ToBool() && CrmVersionManager.IsSupported(CrmVersion.CRM2015_RTM)) { ExecuteAction(fullPath, delegate { Guid importjobid = Guid.NewGuid(); OrganizationResponse response = _repository.ExecuteAsync("ImportSolution", new Hashtable() { { "CustomizationFile", content }, { "ImportJobId", importjobid }, { "ConvertToManaged", ConvertToManaged.ToBool() }, { "OverwriteUnmanagedCustomizations", Overwrite.ToBool() }, { "PublishWorkflows", PublishWorkflows.ToBool() }, { "SkipProductUpdateDependencies", SkipDependencies.ToBool() } }); WriteObject(_repository.Get("asyncoperation", (Guid)response.Results["AsyncJobId"])); }); } else { ExecuteAction(fullPath, delegate { Guid importjobid = Guid.NewGuid(); _repository.Execute("ImportSolution", new Hashtable() { { "CustomizationFile", content }, { "ImportJobId", importjobid }, { "ConvertToManaged", ConvertToManaged.ToBool() }, { "OverwriteUnmanagedCustomizations", Overwrite.ToBool() }, { "PublishWorkflows", PublishWorkflows.ToBool() }, { "SkipProductUpdateDependencies", SkipDependencies.ToBool() } }); WriteObject(_repository.Get("importjob", importjobid)); }); } } }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); foreach (string fullPath in ResolvePaths(_paths, _shouldExpandWildcards)) { byte[] content = File.ReadAllBytes(fullPath); ExecuteAction(fullPath, delegate { Guid importjobid = Guid.NewGuid(); _repository.Execute("ImportTranslation", new Hashtable() { { "TranslationFile", content }, { "ImportJobId", importjobid } }); WriteObject(_repository.Get("importjob", importjobid)); }); } }