コード例 #1
0
 /// <summary>
 /// Method to Unregister an Image.
 /// </summary>
 /// <param name="xrmPluginImage">The Image to Unregister.</param>
 /// <returns>Result.</returns>
 internal bool UnregisterImage(string xrmServerDetails, XrmPluginImage xrmPluginImage, Collection <string> errors, SolutionComponentType solutionComponentType)
 {
     try
     {
         Result = RegistrationService.Unregister(xrmServerDetails, SdkMessageProcessingStepImage.EntityLogicalName, xrmPluginImage.ImageId.Value, errors, solutionComponentType);
         return(Result);
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }
コード例 #2
0
 /// <summary>
 /// Method to Register an Image.
 /// </summary>
 /// <param name="xrmPluginImage">The Image to Register.</param>
 /// <returns>The newly Registered Image Identifier.</returns>
 internal Guid RegisterImage(string xrmServerDetails, XrmPluginImage xrmPluginImage)
 {
     try
     {
         using (xrmService = RegistrationService.GetService(xrmServerDetails))
         {
             SdkMessageProcessingStepImage sdkMessageProcessingStepImage = GetPluginImage(xrmPluginImage);
             return(xrmService.Create(sdkMessageProcessingStepImage));
         }
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }
コード例 #3
0
 /// <summary>
 /// Method to Update an Image Registration.
 /// </summary>
 /// <param name="xrmPluginImage">The Image to Update.</param>
 /// <returns>Result.</returns>
 internal bool UpdateImage(string xrmServerDetails, XrmPluginImage xrmPluginImage)
 {
     try
     {
         Result = false;
         using (xrmService = RegistrationService.GetService(xrmServerDetails))
         {
             SdkMessageProcessingStepImage sdkMessageProcessingStepImage = GetPluginImage(xrmPluginImage);
             xrmService.Update(sdkMessageProcessingStepImage);
         }
         Result = true;
         return(Result);
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }
コード例 #4
0
 /// <summary>
 /// Method to retrieve the list of Images specified in the Registration Object linked to the Step object and populate the XRM Plugin Step accordingly.
 /// </summary>
 /// <param name="registration">The Registration Object.</param>
 /// <param name="step">The Step Object.</param>
 /// <param name="xrmPluginStep">The XRM Plugin Step Object.</param>
 internal XrmPluginStep GetRegistrationImages(string xrmServerDetails, PluginStep step, XrmPluginStep xrmPluginStep)
 {
     try
     {
         foreach (Image image in step.Images)
         {
             ValidateImage(step, image);
             XrmPluginImage xrmPluginImage = new XrmPluginImage();
             using (xrmService = RegistrationService.GetService(xrmServerDetails))
             {
                 string     attributeCSV = GetAttributeCSV(new XrmMetadata(xrmServerDetails), image, step.PrimaryEntity);
                 ItemExists imageDetails = GetImageId(xrmPluginStep, image, xrmService, attributeCSV);
                 xrmPluginImage.ImageId   = imageDetails.ItemId;
                 xrmPluginImage.Exists    = imageDetails.Exists;
                 xrmPluginImage.StepId    = xrmPluginStep.StepId;
                 xrmPluginImage.ImageType = image.ImageType;
                 if (!string.IsNullOrEmpty(attributeCSV))
                 {
                     xrmPluginImage.Attributes = attributeCSV;
                 }
                 xrmPluginImage.EntityAlias     = image.EntityAlias;
                 xrmPluginImage.MessageProperty = image.MessageProperty;
                 if (image.Merge.HasValue)
                 {
                     xrmPluginImage.MessagePropertyName = GetMessagePropertyName(step.PluginMessage, image.Merge.Value);
                 }
                 else
                 {
                     xrmPluginImage.MessagePropertyName = GetMessagePropertyName(step.PluginMessage);
                 }
                 xrmPluginStep.Images.Add(xrmPluginImage);
             }
         }
         return(xrmPluginStep);
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }
コード例 #5
0
 /// <summary>
 /// Method to populate a Dynamics CRM Image from a XRM Image and retrieve it.
 /// </summary>
 /// <param name="xrmPluginImage">The ZRM Image providing the details.</param>
 /// <returns>The Dynamics CRM Image.</returns>
 private SdkMessageProcessingStepImage GetPluginImage(XrmPluginImage xrmPluginImage)
 {
     try
     {
         SdkMessageProcessingStepImage = new SdkMessageProcessingStepImage();
         if (!string.IsNullOrEmpty(xrmPluginImage.Attributes))
         {
             SdkMessageProcessingStepImage.Attributes1 = xrmPluginImage.Attributes;
         }
         SdkMessageProcessingStepImage.EntityAlias = xrmPluginImage.EntityAlias;
         SdkMessageProcessingStepImage.SdkMessageProcessingStepImageId = xrmPluginImage.ImageId;
         SdkMessageProcessingStepImage.Name = xrmPluginImage.MessageProperty;
         SdkMessageProcessingStepImage.MessagePropertyName        = xrmPluginImage.MessagePropertyName;
         SdkMessageProcessingStepImage.SdkMessageProcessingStepId = new EntityReference(SdkMessageProcessingStep.EntityLogicalName, xrmPluginImage.StepId.Value);
         SdkMessageProcessingStepImage.ImageType = new OptionSetValue((int)xrmPluginImage.ImageType);
         return(SdkMessageProcessingStepImage);
     }
     catch (FaultException <Microsoft.Xrm.Sdk.OrganizationServiceFault> )
     {
         throw;
     }
 }