Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

Delete List Item by Validating Security

  • Last UpdatedApr 02, 2024
  • 1 minute read

Check and delete a list item using the list API.

The list API makes use of the following DLL references, namespaces, classes, and methods.

DLL Reference

Namespace

Workflow.NET.NET2

  • System

  • Skelta.Repository.List

Class

  • Skelta.Repository.List.ListDefinition

  • Skelta.Repository.List.ListItem

Methods

  • ListItem.CanDelete()

    This method checks whether you can delete an item, and returns a Boolean value.

  • ListItem.Delete()

    This method deletes a list item.

Scenario

For the Employee Details list mapped to an Employee table with the fields such as TitleNameAgeSalaryDepartment, and Manager, delete list item by running the following code.

using System;

using Skelta.Repository.List;

namespace ListObject

{

public class DynamicList

{

static void Main(string[] args)

{

DynamicList DL = new DynamicList();

DL.DeleteListItem("SkeltaRepo", "Employee", "admin");

}

 private void DeleteListItem(string applicationname, string listname, string LoggedInUser)

{

// Creating ListDefinition Object.

ListDefinition userlist = new ListDefinition(new Skelta.Core.ApplicationObject(applicationname),  

listname);

// Creating ListItem object.

ListItem listitem = new ListItem(userlist, new Guid("cead17b3-d91d-42d2-ac00-da0ccd1e3611"));

// Checking whether list item can be deleted.

if (listitem.CanDelete())

{

// Deleting list item.

listitem.Delete();

Console.WriteLine("ListItem has been successfully deleted");

}

else

{

Console.WriteLine("Can not delete ListItem");

}

}

}

}

}

Related Links
TitleResults for “How to create a CRG?”Also Available in