Share via


RetrieveAllEntitiesRequest Class

Definition

Contains the data that is needed to retrieve schema information about all tables.

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

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 instance.

/// <summary>
/// Retrieves all tables and outputs the LogicalName values
/// </summary>
/// <param name="service">Authenticated IOrganizationService instance</param>
static void RetrieveAllTablesExample(IOrganizationService service) {

    RetrieveAllEntitiesRequest request = new()
    {
        EntityFilters = EntityFilters.Entity, //Only tables
        RetrieveAsIfPublished = false
    };

    var response = (RetrieveAllEntitiesResponse)service.Execute(request);

    var tables = response.EntityMetadata.OrderBy(x => x.LogicalName).ToList();

    tables.ForEach(table => {
        Console.WriteLine($"LogicalName: {table.LogicalName}");
    });        
}

Output:

LogicalName: aaduser
LogicalName: account
LogicalName: accountleads
LogicalName: aciviewmapper
LogicalName: actioncard
< results limited for brevity >

Sample code on GitHub

Dump table definitions to a file

Remarks

For the Web API use the RetrieveAllEntities function.

Usage

Pass an instance of this class to the Execute(OrganizationRequest) method, which returns an instance of RetrieveAllEntitiesResponse.

Privileges and Access Rights

Table schema information is available for all users.

Notes for Callers

This request returns a large amount of data and may take significant time to return all the data. When there are a large number of customizations it is possible that this request could fail due to time limitations using Dataverse. Learn more about querying schema definitions.

Use the RetrieveMetadataChangesRequest class to request just the metadata you need. Otherwise, set the EntityFilters property to use EntityFilters.Entity member to minimize the amount of data retrieved. Then, using the EntityMetadata.LogicalName property returned for each table definition, use the RetrieveEntityRequest class for each table definition that you need metadata for. Splitting up the requests can reduce the chance that your request will time out.

Constructors

RetrieveAllEntitiesRequest()

Initializes a new instance of the RetrieveAllEntitiesRequest class.

Properties

EntityFilters

Gets or sets a filter to control how much data for each table is retrieved. 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)
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 the request. Optional.

(Inherited from OrganizationRequest)
RequestName

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

(Inherited from OrganizationRequest)
RetrieveAsIfPublished

Gets or sets whether to retrieve the metadata that has not been published. Required.

Applies to