public Entity Get(string entity, Hashtable keys, string[] columns = null) { if (!CrmVersionManager.IsSupported(CrmVersion.CRM2015_1_RTM)) { throw new NotSupportedException(); } ColumnSet columnSet = BuildColumnSet(columns); KeyAttributeCollection keysCollection = new KeyAttributeCollection(); keysCollection.AddRange(keys.ToEnumerable <string, object>()); EntityReference reference = new EntityReference(entity, keysCollection); OrganizationRequest request = new OrganizationRequest("Retrieve") { Parameters = new ParameterCollection() }; request.Parameters.Add("Target", reference); request.Parameters.Add("ColumnSet", columnSet); OrganizationResponse response = CrmContext.OrganizationProxy.Execute(request); return((Entity)response.Results["Entity"]); }
public object GetDynamicParameters() { if (CrmVersionManager.IsSupported(CrmVersion.CRM2016_RTM)) { _context = new AddSolutionComponentDynamicParameters2016(); } return(_context); }
protected override void BeginProcessing() { base.BeginProcessing(); if (!CrmVersionManager.IsSupported(CrmVersion.CRM2013_RTM)) { throw new NotSupportedException(); } }
protected override void BeginProcessing() { base.BeginProcessing(); if (!CrmVersionManager.IsSupported(CrmVersion.CRM2015_1_RTM)) { throw new NotSupportedException("Entity Keys are not supported in this version of Dynamics CRM or the SDK."); } }
public object GetDynamicParameters() { if (CrmVersionManager.IsSupported(CrmVersion.CRM2015_RTM)) { _context = new ExportSolutionDynamicParameters2015(); } return(_context); }
public object GetDynamicParameters() { if (CrmVersionManager.IsSupported(CrmVersion.CRM2016_RTM)) { _context = new AddAttributeDynamicParameters2016(); } else { _context = null; } return(_context); }
public object GetDynamicParameters() { if (CrmVersionManager.IsSupported(CrmVersion.CRM2016_RTM)) { _context = new SetEntityDynamicParameters2016(); } else if (CrmVersionManager.IsSupported(CrmVersion.CRM2013_RTM)) { _context = new SetEntityDynamicParameters2013(); } else { _context = new SetEntityDynamicParameters(); } return(_context); }
public object GetDynamicParameters() { if (this.ParameterSetName == SetRelationshipParameterSet) { if (CrmVersionManager.IsSupported(CrmVersion.CRM2016_RTM)) { _context = new SetRelationshipDynamicParameters2016(); } return(_context); } else { return(null); } }
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)); }); } } }
private void GetAttributeByFilter() { IEnumerable <AttributeMetadata> result = _repository.GetAttribute(Entity, CustomOnly.ToBool(), ExcludeManaged.ToBool(), IncludeLinked.ToBool()); if (!string.IsNullOrWhiteSpace(Name)) { WildcardPattern includePattern = new WildcardPattern(Name, WildcardOptions.IgnoreCase); result = result.Where(a => includePattern.IsMatch(a.LogicalName)); } if (!string.IsNullOrWhiteSpace(Exclude)) { WildcardPattern excludePattern = new WildcardPattern(Exclude, WildcardOptions.IgnoreCase); result = result.Where(a => !excludePattern.IsMatch(a.LogicalName)); } if (!string.IsNullOrWhiteSpace(AttributeType)) { if (CrmVersionManager.IsSupported(CrmVersion.CRM2013_RTM)) { string attributeTypeName = AttributeType; if (!attributeTypeName.EndsWith("Type", StringComparison.InvariantCultureIgnoreCase)) { attributeTypeName = string.Format("{0}Type", attributeTypeName); } result = result.Where(a => a.AttributeTypeName == attributeTypeName); } else { AttributeTypeCode typeCode = AttributeTypeCode.String; if (Enum.TryParse <AttributeTypeCode>(AttributeType, true, out typeCode)) { result = result.Where(a => a.AttributeType == typeCode); } } } result = result.OrderBy(a => a.LogicalName); WriteObject(result, true); }
protected override void ExecuteCmdlet() { base.ExecuteCmdlet(); StringAttributeMetadata attribute = new StringAttributeMetadata { ImeMode = ImeMode.Auto }; if (ImeType == CrmImeType.Active) { attribute.ImeMode = ImeMode.Active; } if (ImeType == CrmImeType.Disabled) { attribute.ImeMode = ImeMode.Disabled; } if (ImeType == CrmImeType.Inactive) { attribute.ImeMode = ImeMode.Inactive; } if (CrmVersionManager.IsSupported(CrmVersion.CRM2013_RTM)) { attribute.FormatName = StringFormatName.Text; if (Format == CrmStringAttributeFormat.Email) { attribute.FormatName = StringFormatName.Email; } if (Format == CrmStringAttributeFormat.Phone) { attribute.FormatName = StringFormatName.Phone; } if (Format == CrmStringAttributeFormat.PhoneticGuide) { attribute.FormatName = StringFormatName.PhoneticGuide; } if (Format == CrmStringAttributeFormat.TextArea) { attribute.FormatName = StringFormatName.TextArea; } if (Format == CrmStringAttributeFormat.TickerSymbol) { attribute.FormatName = StringFormatName.TickerSymbol; } if (Format == CrmStringAttributeFormat.Url) { attribute.FormatName = StringFormatName.Url; } if (Format == CrmStringAttributeFormat.VersionNumber) { attribute.FormatName = StringFormatName.VersionNumber; } } else { attribute.Format = StringFormat.Text; if (Format == CrmStringAttributeFormat.Email) { attribute.Format = StringFormat.Email; } if (Format == CrmStringAttributeFormat.Phone) { attribute.Format = StringFormat.Phone; } if (Format == CrmStringAttributeFormat.PhoneticGuide) { attribute.Format = StringFormat.PhoneticGuide; } if (Format == CrmStringAttributeFormat.TextArea) { attribute.Format = StringFormat.TextArea; } if (Format == CrmStringAttributeFormat.TickerSymbol) { attribute.Format = StringFormat.TickerSymbol; } if (Format == CrmStringAttributeFormat.Url) { attribute.Format = StringFormat.Url; } if (Format == CrmStringAttributeFormat.VersionNumber) { attribute.Format = StringFormat.VersionNumber; } } if (Length.HasValue) { attribute.MaxLength = Length.Value; } else { attribute.MaxLength = 100; } WriteAttribute(attribute); }