Condividi tramite


GetDistinctValuesImportFileRequest Class

 

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

Contains the data that is needed to retrieve distinct values from the parse table for a column in the source file that contains list values.

For the Web API use the GetDistinctValuesImportFile Function.

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

Syntax

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

Constructors

Name Description
System_CAPS_pubmethod GetDistinctValuesImportFileRequest()

Initializes a new instance of the GetDistinctValuesImportFileRequest class.

Properties

Name Description
System_CAPS_pubproperty columnNumber

Gets or sets a column number in the CSV, XML Spreadsheet 2003 (.xml), or text source file for which the distinct values are returned. Required.

System_CAPS_pubproperty ExtensionData

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

System_CAPS_pubproperty ImportFileId

Gets or sets in ID of the import file that is associated with the source file. Required.

System_CAPS_pubproperty Item[String]

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

System_CAPS_pubproperty pageNumber

Gets or sets the page number in the source file. Required.

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 recordsPerPage

Gets or sets the number of data records per page in the source file. Required.

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

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

This message works regardless whether the caller is connected to the server or offline.

Usage

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

Privileges and Access Rights

To perform this action, the caller must have privileges on the ImportFile entity and access rights on the record specified in the ImportFileId property. For a complete list of the required privileges, see GetDistinctValuesImportFile message privileges.

Notes for Callers

Use this message only after you have created a parse table by using the ParseImportRequest message. Do not use this message after you use the ImportRecordsImportRequest message. You cannot access the parse table after the import job submitted by the ImportRecordsRequest message has finished running.

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.


// Retrieve the first two distinct values for column 1 from the parse table.
// NOTE: You must create the parse table first using the ParseImport message.
// The parse table is not accessible after ImportRecordsImportResponse is called.
GetDistinctValuesImportFileRequest distinctValuesRequest = new GetDistinctValuesImportFileRequest()
{
    columnNumber = 1,
    ImportFileId = importFileId,
    pageNumber = 1,
    recordsPerPage = 2,
};
GetDistinctValuesImportFileResponse distinctValuesResponse =
    (GetDistinctValuesImportFileResponse)_serviceProxy.Execute(distinctValuesRequest);

// Output the distinct values.  In this case: (column 1, row 1) and (column 1, row 2).
int cellNum = 1;
foreach (string cellValue in distinctValuesResponse.Values)
{
    Console.WriteLine("(1, " + cellNum.ToString() + "): " + cellValue);
    Console.WriteLine(cellValue);
    cellNum++;
}

' Retrieve the first two distinct values for column 1 from the parse table.
' NOTE: You must create the parse table first using the ParseImport message.
' The parse table is not accessible after ImportRecordsImportResponse is called.
Dim distinctValuesRequest As New GetDistinctValuesImportFileRequest() With
    {
        .columnNumber = 1,
        .ImportFileId = importFileId,
        .pageNumber = 1,
        .recordsPerPage = 2
    }
Dim distinctValuesResponse As GetDistinctValuesImportFileResponse =
    CType(_serviceProxy.Execute(distinctValuesRequest), 
        GetDistinctValuesImportFileResponse)

' Output the distinct values.  In this case: (column 1, row 1) and (column 1, row 2).
Dim cellNum As Integer = 1
For Each cellValue As String In distinctValuesResponse.Values
    Console.WriteLine("(1, " &amp; cellNum.ToString() &amp; "): " &amp; cellValue)
    Console.WriteLine(cellValue)
    cellNum += 1
Next cellValue

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

GetDistinctValuesImportFileResponse
Microsoft.Crm.Sdk.Messages Namespace
Import data
ImportFile entity messages and methods
Run data import
Sample: Import data using complex data map
GetDistinctValuesImportFile message privileges
How role-based security can be used to control access to entities in Microsoft Dynamics 365
How record-based security can be used to control access to records in Microsoft Dynamics 365

Return to top

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright