Skip to content

Commit 489b822

Browse files
committed
Merge branch 'main' into ChrisGarty-patch-4
2 parents ec4d429 + 6a3d165 commit 489b822

17 files changed

+215
-101
lines changed

powerapps-docs/developer/data-platform/bulk-operations-elastic-tables.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ contributors:
1414

1515
[!INCLUDE [cc-beta-prerelease-disclaimer](../../includes/cc-beta-prerelease-disclaimer.md)]
1616

17-
Often applications need to ingest large amount of data into Dataverse in a short amount of time. Dataverse has a group of messages that are designed to achieve high throughput. With elastic tables, the throughput can be much higher.
17+
Often applications need to ingest large amount of data into Dataverse in a short amount of time. Dataverse has a group of messages that are designed to achieve high throughput. With elastic tables, the throughput can be higher.
1818

19-
Bulk operations are optimized for performance when executing multiple write operations on the same table by taking a batch of rows as input in a single write operation. For elastic tables, we recommend sending 100 items in a batch. Multiple bulk operation can be run in parallel to achieve high throughput. More information [Send parallel requests](send-parallel-requests.md)
19+
Bulk operations are optimized for performance when executing multiple write operations on the same table by taking a batch of rows as input in a single write operation. For elastic tables, we recommend sending 100 items in a batch. Multiple bulk operations can be run in parallel to achieve high throughput. More information [Send parallel requests](send-parallel-requests.md)
2020

2121
Elastic tables currently support the following messages for bulk operations:
2222

@@ -183,6 +183,32 @@ public static OrganizationResponse DeleteMultiple(IOrganizationService service)
183183
}
184184
```
185185

186+
## Exception handling for elastic tables
187+
188+
Unlike standard tables, an error within a bulk operation with an elastic table doesn't roll back the entire request. It's possible for the operation to partially succeed and you can detect which records have failed from the ErrorDetails.
189+
190+
191+
When you use the SDK, a [FaultException](xref:System.ServiceModel.FaultException%601) of type [OrganizationServiceFault](xref:Microsoft.Xrm.Sdk.OrganizationServiceFault) is thrown if a failure occurs. You can get the status of each record using the following code.
192+
193+
```csharp
194+
if (ex.Detail.ErrorDetails.TryGetValue("Plugin.BulkApiErrorDetails", out object errorDetails))
195+
{
196+
List<BulkApiErrorDetail> bulkApiErrorDetails = JsonConvert.DeserializeObject<List<BulkApiErrorDetail>>(errorDetails.ToString());
197+
}
198+
199+
public class BulkApiErrorDetail
200+
{
201+
public int RequestIndex { get; set; }
202+
public string Id { get; set; }
203+
public int StatusCode { get; set; }
204+
}
205+
```
206+
207+
When using Web API, you need to pass the `Prefer` header with value `odata.include-annotations=*` or `odata.include-annotations=Microsoft.PowerApps.CDS.ErrorDetails.*`, which gives the status of each record. More information: [Include more details with errors](webapi/compose-http-requests-handle-errors.md#include-more-details-with-errors)
208+
209+
> [!NOTE]
210+
> You can see the errors in the above format only when the errors have occurred while writing data and cannot capture errors occurred in Pre and Post plugins. More information: [Handling Exceptions](write-plugin-multiple-operation.md#handling-exceptions).
211+
186212
### See also
187213

188214
[Use elastic tables](elastic-tables.md)<br />

powerapps-docs/developer/data-platform/files-images-overview.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Dataverse provides several different ways to save binary data representing files
3535

3636
## Block certain types of files
3737

38-
You can block the types of files that can be uploaded by the extension or mime type.
38+
You can block the types of files that can be uploaded by the extension or MIME type.
3939

4040
### Block files by extension
4141

@@ -111,9 +111,9 @@ When anyone tries to upload a file using one of the blocked types, the following
111111
> Number: `-2147205623`<br />
112112
> Message: `The attachment is either not a valid type or is too large. It cannot be uploaded or downloaded.`
113113
114-
### Block or allow certain mime types
114+
### Block or allow certain MIME types
115115

116-
You can block or allow upload of files based on mime types. More Information: [Mime Type Validation](/power-platform/admin/settings-privacy-security#mime-type-validation).
116+
You can block or allow upload of files based on MIME types. More Information: [Mime Type Validation](/power-platform/admin/settings-privacy-security#mime-type-validation).
117117

118118
You can also query and modify this data programmatically. It's stored in the [Organization.BlockedMimeTypes](reference/entities/organization.md#BKMK_BlockedMimeTypes) and [Organization.AllowedMimeTypes](reference/entities/organization.md#BKMK_AllowedMimeTypes) columns. There's only one row in the organization table. You can use the SDK or Web API to query this data:
119119

@@ -165,15 +165,15 @@ OData-Version: 4.0
165165
}
166166
```
167167

168-
If `allowedmimetypes` is set, `blockedmimetypes` is ignored. Only the mime types specified in `allowedmimetypes` are allowed.
168+
If `allowedmimetypes` is set, `blockedmimetypes` is ignored. Only the MIME types specified in `allowedmimetypes` are allowed.
169169

170-
If `blockedmimetypes` isn't empty and `allowedmimetypes` is empty, the following error occurs when someone tries to upload a mime type that is in blocked mime types:
170+
If `blockedmimetypes` isn't empty and `allowedmimetypes` is empty, the following error occurs when someone tries to upload a MIME type that is in blocked MIME types:
171171

172172
> Name: `MimeTypeBlocked`<br />
173173
> Code: `0x80072522`<br />
174174
> Message: `Operation not allowed as mime type image/svg+xml is blocked.`
175175
176-
If `allowedmimetypes` isn't empty, the following error occurs when someone tries to upload a mime type that isn't in `allowedmimetypes`:
176+
If `allowedmimetypes` isn't empty, the following error occurs when someone tries to upload a MIME type that isn't in `allowedmimetypes`:
177177

178178
> Name: `MimeTypeNotInAllowedList`<br />
179179
> Code: `0x80072521`<br />

powerapps-docs/developer/data-platform/webapi/create-entity-web-api.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Create a table row using the Web API (Microsoft Dataverse) | Microsoft Docs"
33
description: "Read how to create a POST request to send data to create a table row on Microsoft Dataverse using the Web API"
4-
ms.date: 05/18/2023
4+
ms.date: 06/14/2023
55
ms.service: powerapps
66
ms.topic: article
77
author: divkamath
@@ -26,13 +26,13 @@ Use a POST request to send data to create a table row (entity record). You can c
2626

2727
## Basic Create
2828

29-
This example creates a new account entity record. The response `OData-EntityId` header contains the Uri of the created entity.
29+
This example creates a new account entity record. `accounts` is the entity set name for the [account EntityType](xref:Microsoft.Dynamics.CRM.account). The response `OData-EntityId` header contains the Uri of the created entity.
3030

3131
**Request**
3232

3333
```http
3434
35-
POST [Organization URI]/api/data/v9.0/accounts HTTP/1.1
35+
POST [Organization URI]/api/data/v9.0/accounts
3636
Content-Type: application/json; charset=utf-8
3737
OData-MaxVersion: 4.0
3838
OData-Version: 4.0
@@ -58,28 +58,28 @@ OData-EntityId: [Organization URI]/api/data/v9.0/accounts(7eb682f1-ca75-e511-80d
5858
5959
```
6060

61-
To create a new entity record you must identify the valid property names and types. For all system tables and attributes (table columns), you can find this information in the topic for that entity in the [Dataverse table/entity reference](../reference/about-entity-reference.md). For custom tables or columns, refer to the definition of that table in the [CSDL $metadata document](web-api-service-documents.md#csdl-metadata-document). More information: [Web API EntityTypes](web-api-entitytypes.md)
61+
To create a new entity record you must identify the valid [Entity set name](web-api-service-documents.md#entity-set-name), property names, and types. For all system tables and attributes (table columns), you can find this information in the article for that entity in the [Web API Entity Type Reference](xref:Microsoft.Dynamics.CRM.EntityTypeIndex). For custom tables or columns, refer to the definition of that table in the [CSDL $metadata document](web-api-service-documents.md#csdl-metadata-document). More information: [Web API EntityTypes](web-api-entitytypes.md)
6262

6363
<a name="bkmk_createWithDataReturned"></a>
6464

6565
## Create with data returned
6666

67-
You can compose your `POST` request so that data from the created record will be returned with a status of `201 (Created)`. To get this result, you must use the `return=representation` preference in the request headers.
67+
You can compose your `POST` request so that data from the created record is returned with a status of `201 (Created)`. To get this result, you must use the `return=representation` preference in the request headers.
6868

6969
To control which properties are returned, append the `$select` query option to the URL to the entity set. You may also use `$expand` to return related entities.
7070

7171
> [!NOTE]
7272
> Nested `$expand` on collection-valued navigation properties will not return data when used with the `return=representation` preference. More information: [Nested $expand on collection-valued navigation properties](query-data-web-api.md#nested-expand-on-collection-valued-navigation-properties)
7373
74-
When an entity is created in this way the `OData-EntityId` header containing the URI to the created record is not returned.
74+
When an entity is created in this way, the `OData-EntityId` header containing the URI to the created record isn't returned.
7575

7676
This example creates a new account entity and returns the requested data in the response.
7777

7878
**Request**
7979

8080
```http
8181
82-
POST [Organization URI]/api/data/v9.0/accounts?$select=name,creditonhold,address1_latitude,description,revenue,accountcategorycode,createdon HTTP/1.1
82+
POST [Organization URI]/api/data/v9.0/accounts?$select=name,creditonhold,address1_latitude,description,revenue,accountcategorycode,createdon
8383
OData-MaxVersion: 4.0
8484
OData-Version: 4.0
8585
Accept: application/json
@@ -125,25 +125,25 @@ OData-Version: 4.0
125125

126126
## Create related table rows in one operation
127127

128-
You can create entities related to each other by defining them as navigation properties values. This is known as *deep insert*. This approach has two advantages. It is more efficient, replacing multiple simpler creation and association operations with one combined operation. Also, it is atomic where either the entire operation succeeds and all the related objects are created, or the operation fails and none are created.
128+
You can create entities related to each other by defining them as navigation properties values. This pattern is known as *deep insert*. This approach has two advantages. It's more efficient, replacing multiple simpler creation and association operations with one combined *atomic* operation. An atomic operation succeeds or fails entirely.
129129

130130
As with a basic create, the response `OData-EntityId` header contains the Uri of the created entity. The URIs for the related entities created aren't returned. You can get the primary key values of the records if you use the `Prefer: return=representation` header so it returns the values of the created record. More information: [Create with data returned](#create-with-data-returned)
131131

132-
For example, the following request body posted to the `accounts` entity set will create a total of four new entities in the context of creating an account.
132+
For example, the following request body posted to the `accounts` entity set creates a total of four new entities in the context of creating an account.
133133

134-
- A contact is created because it is defined as an object property of the single-valued navigation property `primarycontactid`.
134+
- A contact is created because it's defined as an object property of the single-valued navigation property `primarycontactid`.
135135

136-
- An opportunity is created because it is defined as an object within an array that is set to the value of a collection-valued navigation property `opportunity_customer_accounts`.
136+
- An opportunity is created because it's defined as an object within an array that is set to the value of a collection-valued navigation property `opportunity_customer_accounts`.
137137

138-
- A task is created because it is defined an object within an array that is set to the value of a collection-valued navigation property `Opportunity_Tasks`.
138+
- A task is created because it's defined an object within an array that is set to the value of a collection-valued navigation property `Opportunity_Tasks`.
139139

140140
> [!NOTE]
141141
> When creating a new table row, it is not possible to combine the row creation with the insert of a non-primary image. For a non-primary image to be added, the row must already exist.
142142
143143
**Request**
144144

145145
```http
146-
POST [Organization URI]/api/data/v9.0/accounts HTTP/1.1
146+
POST [Organization URI]/api/data/v9.0/accounts
147147
Content-Type: application/json; charset=utf-8
148148
OData-MaxVersion: 4.0
149149
OData-Version: 4.0
@@ -184,9 +184,9 @@ OData-EntityId: [Organization URI]/api/data/v9.0/accounts(3c6e4b5f-86f6-e411-80d
184184

185185
## Associate table rows on create
186186

187-
To associate new entities to existing entities when they are created you must set the value of navigation properties using the `@odata.bind` annotation.
187+
To associate new entities with existing entities when they're created, you must set the value of navigation properties using the `@odata.bind` annotation.
188188

189-
The following request body posted to the `accounts` entity set will create a new account associated with an existing contact with the `contactid` value of `00000000-0000-0000-0000-000000000001` and two existing tasks with `activityid` values of `00000000-0000-0000-0000-000000000002` and `00000000-0000-0000-0000-000000000003`.
189+
The following request body posted to the `accounts` entity set creates a new account associated with an existing contact with the `contactid` value of `00000000-0000-0000-0000-000000000001` and two existing tasks with `activityid` values of `00000000-0000-0000-0000-000000000002` and `00000000-0000-0000-0000-000000000003`.
190190

191191
> [!NOTE]
192192
> This request is using the `Prefer: return=representation` header so it returns the values of the created record. More information: [Create with data returned](#create-with-data-returned)
@@ -195,7 +195,7 @@ OData-EntityId: [Organization URI]/api/data/v9.0/accounts(3c6e4b5f-86f6-e411-80d
195195

196196
```http
197197
198-
POST [Organization URI]/api/data/v9.0/accounts?$select=name&$expand=primarycontactid($select=fullname),Account_Tasks($select=subject) HTTP/1.1
198+
POST [Organization URI]/api/data/v9.0/accounts?$select=name&$expand=primarycontactid($select=fullname),Account_Tasks($select=subject)
199199
Content-Type: application/json; charset=utf-8
200200
OData-MaxVersion: 4.0
201201
OData-Version: 4.0
@@ -253,9 +253,16 @@ Preference-Applied: return=representation
253253

254254
## Check for duplicate records
255255

256-
By default, duplicate detection is suppressed when you are creating records using the Web API. You must include the `MSCRM.SuppressDuplicateDetection: false` header with your POST request to enable duplicate detection. Duplicate detection only applies when 1) the organization has enabled duplicate detection, 2) the entity is enabled for duplicate detection, and 3) there are active duplicate detection rules being applied. More information: [Detect duplicate data using code](../detect-duplicate-data-with-code.md)
256+
By default, duplicate detection is suppressed when you're creating records using the Web API. You must include the `MSCRM.SuppressDuplicateDetection: false` header with your POST request to enable duplicate detection. Duplicate detection only applies when the following conditions are true:
257257

258-
See [Detect duplicate data using Web API](manage-duplicate-detection-create-update.md#bkmk_create) for more information on how to check for duplicate records during Create operation.
258+
- The organization has enabled duplicate detection
259+
- The entity is enabled for duplicate detection
260+
- There are active duplicate detection rules being applied
261+
262+
More information:
263+
264+
- [Detect duplicate data using code](../detect-duplicate-data-with-code.md)
265+
- [Detect duplicate data using Web API](manage-duplicate-detection-create-update.md#bkmk_create)
259266

260267
<a name="bkmk_initializefrom"></a>
261268

@@ -267,10 +274,10 @@ Use the <xref:Microsoft.Dynamics.CRM.InitializeFrom?text=InitializeFrom Function
267274
- [Customize table and column mappings](../customize-entity-attribute-mappings.md)
268275

269276
> [!NOTE]
270-
> To determine whether two entities can be mapped, use this query:<br />
277+
> To determine whether two entities can be mapped, use the following query:<br />
271278
`GET [Organization URI]/api/data/v9.1/entitymaps?$select=sourceentityname,targetentityname&$orderby=sourceentityname`
272279

273-
This is a two step process. The `InitializeFrom` function doesn't create the record, but it returns data you can use to create a new record with specified property values mapped from the original record. You will combine the response data returned in the `InitializeFrom` function with any changes you want to make and then `POST` the data to create the new record.
280+
Creating a new record from another record is a two step process. The `InitializeFrom` function doesn't create the record, but it returns data you can use to create a new record with specified property values mapped from the original record. You must combine the response data returned in the `InitializeFrom` function with any changes you want to make and then `POST` the data to create the new record.
274281

275282
The following example shows how to create an account record using the values of an existing account record with `accountid` value equal to `00000000-0000-0000-0000-000000000001`.
276283

@@ -279,7 +286,7 @@ The following example shows how to create an account record using the values of
279286
**Request**
280287

281288
```http
282-
GET [Organization URI]/api/data/v9.0/InitializeFrom(EntityMoniker=@p1,TargetEntityName=@p2,TargetFieldType=@p3)?@p1={'@odata.id':'accounts(00000000-0000-0000-0000-000000000001)'}&@p2='account'&@p3=Microsoft.Dynamics.CRM.TargetFieldType'ValidForCreate' HTTP/1.1
289+
GET [Organization URI]/api/data/v9.0/InitializeFrom(EntityMoniker=@p1,TargetEntityName=@p2,TargetFieldType=@p3)?@p1={'@odata.id':'accounts(00000000-0000-0000-0000-000000000001)'}&@p2='account'&@p3=Microsoft.Dynamics.CRM.TargetFieldType'ValidForCreate'
283290
If-None-Match: null
284291
OData-Version: 4.0
285292
OData-MaxVersion: 4.0
@@ -303,14 +310,14 @@ Accept: application/json
303310

304311
### Step 2: Create the new record
305312

306-
The response received from `InitializeFrom` function consists of values of mapped columns between the source table and target table and the GUID of the parent record. The column mapping between tables that have an relationship is different for different tables and is customizable, so the response from `InitializeFrom` function request may vary for different organizations.
313+
The response received from `InitializeFrom` function consists of values of mapped columns between the source table and target table and the GUID of the parent record. The column mapping between tables that have a relationship is different for different tables and is customizable, so the response from `InitializeFrom` function request may vary for different organizations.
307314

308315

309316

310-
Other property values can also be set and/or modified for the new record by adding them in the JSON request body, as shown in the example below.
317+
Other property values can also be set and/or modified for the new record by adding them in the JSON request body, as shown in the following example:
311318

312319
```http
313-
POST [Organization URI]/api/data/v9.0/accounts HTTP/1.1
320+
POST [Organization URI]/api/data/v9.0/accounts
314321
Content-Type: application/json; charset=utf-8
315322
OData-MaxVersion: 4.0
316323
OData-Version: 4.0
@@ -333,7 +340,7 @@ Accept: application/json
333340

334341
## Create documents in storage partitions
335342

336-
If you are creating large numbers of records for elastic tables, you can create the entities in storage partitions to speed up access to those entity records.
343+
If you're creating large numbers of records for elastic tables, you can create the entities in storage partitions to speed up access to those entity records.
337344

338345
More information: [Create a record in an elastic table](../use-elastic-tables.md#create-a-record-in-an-elastic-table)
339346

powerapps-docs/maker/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,8 @@
12901290
href: ./canvas-apps/component-multimedia.md
12911291
- name: Behavior formulas (experimental)
12921292
href: ./canvas-apps/component-behavior.md
1293+
- name: Canvas component properties (experimental)
1294+
href: ./canvas-apps/component-properties.md
12931295
- name: Performance and optimization
12941296
items:
12951297
- name: Understand canvas app execution phases and data flow

0 commit comments

Comments
 (0)