Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Cannot able to remove ...
Finance forum
Unanswered

Cannot able to remove the data entity values using OData in C#.

Posted on by Microsoft Employee

Hi there,

I am working on OData CRUD Concept in F&O Data Entities using HTTP Delete Method in C#. Unfortunately, i can't able to delete the entity. Actually i am receiving the HTTP 404 Exception. I am using the below code to delete the entity.

Data entity used : SecurityUserRoleOrganizations

public async Task<string> DeleteAsync(AXEntity entity)
{
    var fullUrl = ApiUrl + entity.LogicalName + "(";
    foreach (var a in entity.Attributes)
    {
        fullUrl = fullUrl + a.Key + "='" + a.Value.ToString() + "',";
    }
    var request = new HttpRequestMessage(new HttpMethod("Delete"), fullUrl)
    {
        Content = new StringContent("{}", Encoding.UTF8, "application/json")
    };
    var response = await _baseAuthorization.GetHttpCliente().SendAsync(request);
    string isSuccess = ResponseValidator.EnsureSuccessStatusCode(response);
    return isSuccess;
}
Could anyone help me to implement the delete call or sample to delete the F&O Data Entity Values using OData?
Thanks,
Jeyaprakash A

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,995 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,610 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans