Retrieve, update, and delete tables
Learn how to retrieve, update, and delete a table definition. This article uses the custom Bank Account
table that was created in Create a custom table.
Retrieve and update a table
The following code sample retrieves a table definition by using the RetrieveEntityRequest message. It then updates the table to disable mail merge by setting the IsMailMergeEnabled property to false
, and sets HasNotes to true
in the UpdateEntityRequest to specify that the table should include a relationship to the Annotation
table for the purpose of displaying notes.
RetrieveEntityRequest retrieveBankAccountEntityRequest = new RetrieveEntityRequest
{
EntityFilters = EntityFilters.Entity,
LogicalName = _customEntityName
};
RetrieveEntityResponse retrieveBankAccountEntityResponse = (RetrieveEntityResponse)_serviceProxy.Execute(retrieveBankAccountEntityRequest);
EntityMetadata BankAccountEntity = retrieveBankAccountEntityResponse.EntityMetadata;
// Disable Mail merge
BankAccountEntity.IsMailMergeEnabled = new BooleanManagedProperty(false);
// Enable Notes
UpdateEntityRequest updateBankAccountRequest = new UpdateEntityRequest
{
Entity = BankAccountEntity,
HasNotes = true
};
_serviceProxy.Execute(updateBankAccountRequest);
Delete a custom table
The following code sample uses the DeleteEntityRequest message to delete the table definition with the logical name specified by the _customEntityName
variable.
DeleteEntityRequest request = new DeleteEntityRequest()
{
LogicalName = _customEntityName,
};
_serviceProxy.Execute(request);
See also
Customize table definitions
Create and update a table to send email activities to rows
Create a custom table
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: