DeleteItem
Deletes the given item if it exists.
Syntax:
Procedure:Â PlanSwift.DeleteItem(const ItemPath: WideString): WordBool;
API Calls
Delphi
// PlanSwift Code:
var
sItemPath: string;
begin
if(PlanSwift.DeleteItem(sItemPath) = TRUE) then
begin
// do something...
end;
end;
// FreshDesk Code:
var
ps: IPlanSwift;
est: IItem;
i: Integer;
itm: IItem;
begin
// Create Planswift Interface
ps := coPlanswift.Create;
// Get the Estimating Tab
est := ps.GetItem('Job\Takeoff');
// Loop through all items on the first level
for i := est.ChildCount - 1 downto 0 do
begin
// Get the item at index i
itm := est.ChildItem[i];
// delete the item
itm.Delete;
end;
// Free Planswift
ps := nil;
end;
C#
public class PlanswiftApi
{
private PlanSwift Planswift { get; }
public PlanSwiftApi()
{
Planswift = new PlanSwift();
}
}
VB/VBA (OLE)
// PlanSwift Code:
AreYouSure := False;
If then
Item.Delete;
// FreshDesk Code:
var ps: IPlanSwift;
est: IItem;
i: Integer;
itm: IItem;
begin
// Create Planswift Interface
ps := coPlanswift.Create;
// Get the Estimating Tab
est := ps.GetItem('Job\Takeoff');
// Loop through all items on the first level
for i := est.ChildCount - 1 downto 0 do
begin
// Get the item at index i
itm := est.ChildItem[i];
// delete the item
itm.Delete;
end;
// Free Planswift
ps := nil;
end;