delete item from custom table with kentico API

hadi tag asked on April 12, 2015 14:55

hi

how to delete item from custom table with kentico API??

i user from this:

    DataSet dataSet = CustomTableItemProvider.GetItems("doc.OfflineRequestLog").Columns("Di");

    foreach (DataRow row in dataSet.Tables[0].Rows)
    {
    CustomTableItem deleteCustomTableItem = CustomTableItem.New("doc.OfflineRequestLog", row);
    deleteCustomTableItem.Delete();
    }

but gives me an error message => Error: [BaseInfo.Delete]: Object ID (ItemID) is not set, unable to delete this object.

Is there another way?

Correct Answer

Jim Spillane answered on April 12, 2015 15:37

You can try adding ItemID to .Columns() or removing .Columns()

DataSet dataSet = CustomTableItemProvider.GetItems("doc.OfflineRequestLog").Columns("Di,ItemID");

DataSet dataSet = CustomTableItemProvider.GetItems("doc.OfflineRequestLog");

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.