AddSolutionComponentRequest Class

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

Contains the data that is needed to add a solution component to an unmanaged solution.

For the Web API use the AddSolutionComponent Action.

Namespace:   Microsoft.Crm.Sdk.Messages
Assembly:  Microsoft.Crm.Sdk.Proxy (in Microsoft.Crm.Sdk.Proxy.dll)

Inheritance Hierarchy

System.Object
  Microsoft.Xrm.Sdk.OrganizationRequest
    Microsoft.Crm.Sdk.Messages.AddSolutionComponentRequest

Syntax

[DataContractAttribute(Namespace = "https://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class AddSolutionComponentRequest : OrganizationRequest
<DataContractAttribute(Namespace := "https://schemas.microsoft.com/crm/2011/Contracts")>
Public NotInheritable Class AddSolutionComponentRequest
    Inherits OrganizationRequest

Constructors

Name Description
System_CAPS_pubmethod AddSolutionComponentRequest()

Initializes a new instance of the AddSolutionComponentRequest class.

Properties

Name Description
System_CAPS_pubproperty AddRequiredComponents

Gets or sets a value that indicates whether other solution components that are required by the solution component that you are adding should also be added to the unmanaged solution. Required.

System_CAPS_pubproperty ComponentId

Gets or sets the ID of the solution component. Required.

System_CAPS_pubproperty ComponentType

Gets or sets the value that represents the solution component that you are adding. Required.

System_CAPS_pubproperty DoNotIncludeSubcomponents

Indicates whether the subcomponents should be included.

System_CAPS_pubproperty ExtensionData

Gets or sets the structure that contains extra data. Optional.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty IncludedComponentSettingsValues

Gets or sets a value that specifies if the component is added to the solution with its metadata.

System_CAPS_pubproperty Item[String]

Gets or sets the indexer for the Parameters collection.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty RequestId

Gets or sets the ID of an asynchronous operation (system job). Optional. (Inherited from OrganizationRequest.)

System_CAPS_pubproperty RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.(Inherited from OrganizationRequest.)

System_CAPS_pubproperty SolutionUniqueName

Gets or sets the unique name of the solution you are adding the solution component to. Required.

Methods

Name Description
System_CAPS_pubmethod Equals(Object)

(Inherited from Object.)

System_CAPS_pubmethod GetHashCode()

(Inherited from Object.)

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethod ToString()

(Inherited from Object.)

Remarks

Message Availability

For this message to work, the caller must be connected to the server.

Usage

Pass an instance of this class to the Execute method, which returns an instance of AddSolutionComponentResponse class.

Privileges and Access Rights

To perform this action, the caller must have the privileges that are listed in AddSolutionComponent message privileges.

Notes for Callers

The componenttype enumeration defines the supported range of values for this property. You can access the available values by including the SampleCode\CS\HelperCode\OptionSets.cs file or the SampleCode\VB\HelperCode\OptionSets.vb file in your project.

An alternative to using this message is to create or update the solution component for a specific solution. When you use this technique, you add the solution component to both the default solution and the specified solution. You can implement the specific-solution technique in two ways.

  • Use the SolutionUniqueName parameter on the solution component create and update requests.

  • Pass the SolutionUniqueName optional parameter to the CreateRequest or UpdateRequest.

Supported Entities

This message can only be used for valid solution components.

Adding Application Ribbons to a Solution.

When you use AddSolutionComponentRequest to add application ribbons to your solution, you must make sure to include the RibbonCustomization solution component that is associated with the active solution. Use the Active Solution.SolutionId in the query expression you use to retrieve the RibbonCustomization record.

QueryExpression query = new QueryExpression("ribboncustomization");
query.ColumnSet = new ColumnSet("ribboncustomizationid");
query.Criteria = new FilterExpression();
query.Criteria.AddCondition("entity", ConditionOperator.Null);
query.Criteria.AddCondition("solutionid", ConditionOperator.Equal, new Guid("{FD140AAE-4DF4-11DD-BD17-0019B9312238}"));
RetrieveMultipleRequest req = new RetrieveMultipleRequest();
req.Query = query;
RetrieveMultipleResponse resp = (RetrieveMultipleResponse)_context.Execute(req);
RibbonCustomization activeRibbonCustomization = (RibbonCustomization)resp.EntityCollection[0];

Examples

The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. For the complete sample, see the link later in this topic.

The following code example adds the account entity to a solution that is specified in the SolutionUniqueName property.


// Add an existing Solution Component
//Add the Account entity to the solution
RetrieveEntityRequest retrieveForAddAccountRequest = new RetrieveEntityRequest()
{
    LogicalName = Account.EntityLogicalName
};
RetrieveEntityResponse retrieveForAddAccountResponse = (RetrieveEntityResponse)_serviceProxy.Execute(retrieveForAddAccountRequest);
AddSolutionComponentRequest addReq = new AddSolutionComponentRequest()
{
    ComponentType = (int)componenttype.Entity,
    ComponentId = (Guid)retrieveForAddAccountResponse.EntityMetadata.MetadataId,
    SolutionUniqueName = solution.UniqueName
};
_serviceProxy.Execute(addReq);

' Add an existing Solution Component
'Add the Account entity to the solution
Dim retrieveForAddAccountRequest As New RetrieveEntityRequest() With {
 .LogicalName = Account.EntityLogicalName
}
Dim retrieveForAddAccountResponse As RetrieveEntityResponse =
 CType(_serviceProxy.Execute(retrieveForAddAccountRequest), 
  RetrieveEntityResponse)
Dim addReq As New AddSolutionComponentRequest() With {
 .ComponentType = componenttype.Entity,
 .ComponentId = CType(retrieveForAddAccountResponse.EntityMetadata.MetadataId, Guid),
 .SolutionUniqueName = solution.UniqueName
}
_serviceProxy.Execute(addReq)

Thread Safety

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

AddSolutionComponentResponse
Microsoft.Crm.Sdk.Messages Namespace
AddSolutionComponent message privileges
Sample: Work with solutions
Work with solutions
SolutionComponent entity messages and methods
Dependency tracking for solution components
Constant SolutionId Values

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright