< Back

Get-D365CeODataEntityDataByKey

Mon Jan 13, 2020 8:43 am

NAME Get-D365CeODataEntityDataByKey



SYNOPSIS

Get data from an Data Entity using OData, providing a key





SYNTAX

Get-D365CeODataEntityDataByKey [-ODataQuery <String>] [-Tenant <String>] [-URL <String>] [-ClientId <String>]

[-ClientSecret <String>] [-EnableException] [-OutputAsJson] [<CommonParameters>]



Get-D365CeODataEntityDataByKey -EntityName <String> -Key <String> [-ODataQuery <String>] [-Tenant <String>] [-URL

<String>] [-ClientId <String>] [-ClientSecret <String>] [-EnableException] [-OutputAsJson] [<CommonParameters>]





DESCRIPTION

Get data from an Data Entity, by providing a key, using the OData endpoint of the Dynamics 365 Customer Engagement





PARAMETERS

-EntityName <String>

Name of the Data Entity you want to work against



The parameter is Case Sensitive, because the OData endpoint in D365CE is Case Sensitive



Remember that most Data Entities in a D365CE environment is named by its singular name, but most be retrieve

using the plural name



E.g. The builtin account Data Entity is named Account, but can only be retrieving using accounts



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Key <String>

A string value that contains all needed fields and value to be a valid OData key



The key needs to be a valid http encoded value and each datatype needs to handled appropriately



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ODataQuery <String>

Valid OData query string that you want to pass onto the D365 OData endpoint while retrieving data



OData specific query options are:

$filter

$expand

$select

$orderby

$top

$skip



Each option has different characteristics, which is well documented at:

http://docs.oasis-open.org/odata/odata/ ... tions.html



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tenant <String>

Azure Active Directory (AAD) tenant id (Guid) that the D365CE environment is connected to, that you want to

access through OData



Required? false

Position? named

Default value $Script:ODataTenant

Accept pipeline input? false

Accept wildcard characters? false



-URL <String>

URL / URI for the D365CE environment you want to access through OData



Required? false

Position? named

Default value $Script:ODataUrl

Accept pipeline input? false

Accept wildcard characters? false



-ClientId <String>

The ClientId obtained from the Azure Portal when you created a Registered Application



Required? false

Position? named

Default value $Script:ODataClientId

Accept pipeline input? false

Accept wildcard characters? false



-ClientSecret <String>

The ClientSecret obtained from the Azure Portal when you created a Registered Application



Required? false

Position? named

Default value $Script:ODataClientSecret

Accept pipeline input? false

Accept wildcard characters? false



-EnableException [<SwitchParameter>]

This parameters disables user-friendly warnings and enables the throwing of exceptions

This is less user friendly, but allows catching exceptions in calling scripts



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-OutputAsJson [<SwitchParameter>]

Instructs the cmdlet to convert the output to a Json string



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: OData, Data, Entity, Query



Author: M????tz Jensen (@Splaxi)



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-D365CeODataEntityDataByKey -EntityName accounts -Key "accountid=4b306dc7-ab04-4ddf-b18d-d75ffa2dba2c"



This will get the specific Account from the OData endpoint.

It will use the "Account" entity, and its EntitySetName / CollectionName "accounts".

It will use the "accountid=4b306dc7-ab04-4ddf-b18d-d75ffa2dba2c" as key to identify the unique Account record.



It will use the default OData configuration details that are stored in the configuration store.











RELATED LINKS

Add-D365CeODataConfig

Get-D365CeActiveODataConfig

Set-D365CeActiveODataConfig