PDA

View Full Version : API problem -> AccountObject.Save() simply returnes false, how do i debug??



julian
10-23-2011, 06:30 PM
Hi

I'm making a small app for a Merak 10 server in C# .net, using the API.
I can change properties on accounts, and even delete them, and the .Save() Method works great

THE PROBLEM is when i create a new account, the .Save() Method returns false, but no Exception is cast and the "LastErr" field in the account-object is 0, so no help there either.

What am i not getting here?

I'm doing it like this:


if (!accountList.Contains(email))
{
AccountObject konto = domain.NewAccount(email);
if (konto != null)
{
bool res = konto.SetProperty("u_password", password);
res = res && konto.SetProperty("u_name", navn);
res = res && konto.SetProperty("u_alias", email);
res = res && konto.SetProperty("u_mailbox", email);
if (res)
res = res && domain.Save();

return res;

}
else return false;
}
else return false;

For reference, this works just fine:


AccountObject konto = domain.OpenAccount(emailID);
if (konto != null)
{
bool res = konto.Delete();
bool save = konto.Save();
return (res && save);
}
else return false;

Any help is much appreciated! :)

/Julian

julian
10-24-2011, 09:21 AM
Update:
LastErr is -2, what does that tell me?
Where can i find some references for these error-codes?

julian
10-24-2011, 10:59 AM
I scooped out some ErrorCode info from the API's delphi-code.
-2 suggests a license-issue, and it turned out to be just that. The code was working as it should.

Problem solved