Etwa so:
Delphi-Quellcode:
var
callSession : IApiSession;
gcc : IGetCategoriesCall;
acc : ICategoryCollection;
i:integer;
begin
callSession := CoApiSession.Create;
callSession.Developer := actForm.DevId.Text;
callSession.Application := actForm.AppId.Text;
callSession.Certificate := actForm.CertId.Text;
callSession.RequestUserId := actForm.UserId.Text;
callSession.RequestPassword := actForm.UserPwd.Text;
callSession.Url := actForm.ServerUrl.Text;
ShowMessage('CallSession Created !');
ApiSession1.ConnectTo(callSession);
gcc := CoGetCategoriesCall.Create;
GetCategoriesCall1.ConnectTo(gcc);
ApiCall1.ConnectTo(GetCategoriesCall1.APICall);
ApiCall1.ApiCallSession := ApiSession1.DefaultInterface;
try
acc := GetCategoriesCall1.GetCategories;
ItemForm.mTxtCategory.Items.Clear;
for i := 0 to acc.ItemCount-1 do
ItemForm.mTxtCategory.Items.AddObject(acc.Item[i].CategoryName, TObject(acc.Item[i].CategoryId));
except
on E: EOleException do
Showmessage(e.ClassName + ': ' + E.Message);
else
raise;
end;
ShowMessage('Done !!!!');
end;
Jetzt muss man nur noch die Baumstruktur der Kategorien wiederherstellen.