Developer

Create Operations

Create an ODataEntity using the ScheduleCreateEntity method on the ODataStore.

The ScheduleCreateEntity takes an ODataEntity and the CollectionName as the parameter. An ODataEntity is created locally and then passed along as a parameter.
  1. Create a local ODataEntity and set values for the properties.
  2. Set the PropertyCreationMode: Options are All, Keys, Mandatory, Optional. The PropertyCreationMode can be combined using the binary | operator
  3. Call the ScheduleCreateEntity method on the ODataStore. Await on the Response property.
var entity = new SAP.Data.OData.Online.ODataEntity(“TypeName");
entity.Properties["ID"].Value = XYZ;
entity.Properties["Name"].Value = “XYZ";

Store.AllocateProperties(entity, SAP.Data.OData.Store.PropertyCreationMode.All);

var execution = Store.ScheduleCreateEntity(entity, collectionName);
await execution.Response;

//You can also store the Response object in a variable and perform operations against it, 
//if you know that the server returns something when an entity is created
var response = await execution.Response;