RetrieveDependenciesForDeleteRequest Class

Definition

Contains the data that is needed to retrieve a collection of dependency records that describe any solution components that would prevent a solution component from being deleted.

For the Web API use the RetrieveDependenciesForDelete Function.

public ref class RetrieveDependenciesForDeleteRequest sealed : Microsoft::Xrm::Sdk::OrganizationRequest
[System.Runtime.Serialization.DataContract(Namespace="http://schemas.microsoft.com/crm/2011/Contracts")]
public sealed class RetrieveDependenciesForDeleteRequest : Microsoft.Xrm.Sdk.OrganizationRequest
type RetrieveDependenciesForDeleteRequest = class
    inherit OrganizationRequest
Public NotInheritable Class RetrieveDependenciesForDeleteRequest
Inherits OrganizationRequest
Inheritance
RetrieveDependenciesForDeleteRequest
Attributes

Examples


// Use the RetrieveOptionSetRequest message to retrieve  
// a global option set by it's name.

var retrieveOptionSetRequest =
    new RetrieveOptionSetRequest
    {
     Name = _globalOptionSetName
    };

// Execute the request.
var retrieveOptionSetResponse =(RetrieveOptionSetResponse)svc.Execute(retrieveOptionSetRequest);
_globalOptionSetId = retrieveOptionSetResponse.OptionSetMetadata.MetadataId;

if (_globalOptionSetId != null)
{ 
 //Use the global OptionSet MetadataId with the appropriate componenttype
 // to call RetrieveDependenciesForDeleteRequest
 var retrieveDependenciesForDeleteRequest = new RetrieveDependenciesForDeleteRequest 
{ 
 ComponentType = (int)componenttype.OptionSet,
 ObjectId = (Guid)_globalOptionSetId
};

   var retrieveDependenciesForDeleteResponse =
  (RetrieveDependenciesForDeleteResponse)svc.Execute(retrieveDependenciesForDeleteRequest);
    Console.WriteLine("");
       foreach (Dependency d in retrieveDependenciesForDeleteResponse.EntityCollection.Entities)
     {
          if (d.DependentComponentType.Value == 2)//Just testing for Attributes
  {
   String attributeLabel = "";
   
   var retrieveAttributeRequest = new RetrieveAttributeRequest
   {
    MetadataId = (Guid)d.DependentComponentObjectId
   };

   var retrieveAttributeResponse = (RetrieveAttributeResponse)svc.Execute(retrieveAttributeRequest);
   AttributeMetadata attmet = retrieveAttributeResponse.AttributeMetadata;
    attributeLabel = attmet.DisplayName.UserLocalizedLabel.Label;

Console.WriteLine("An {0} named {1} will prevent deleting the {2} global option set.", 
   (componenttype)d.DependentComponentType.Value, 
   attributeLabel, 
   _globalOptionSetName);
  }
 }                 
}

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.

Solutions#GetSolutionDependencies8 SolutionsVB#GetSolutionDependencies8

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(OrganizationRequest) method, which returns an instance of the RetrieveDependenciesForDeleteResponse class.

Privileges and Access Rights

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

Constructors

RetrieveDependenciesForDeleteRequest()

Initializes a new instance of the RetrieveDependenciesForDeleteRequest class.

Properties

ComponentType

Gets or sets the value for the component type that you want to delete. Required.

ExtensionData

Gets or sets the structure that contains extra data. Optional.

(Inherited from OrganizationRequest)
Item[String]

Gets or sets the indexer for the Parameters collection.

(Inherited from OrganizationRequest)
ObjectId

Gets or sets the ID of the solution component that you want to delete. Required.

Parameters

Gets or sets the collection of parameters for the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)
RequestId

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

(Inherited from OrganizationRequest)
RequestName

Gets or sets the name of the request. Required, but is supplied by derived classes.

(Inherited from OrganizationRequest)

Applies to