Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-17-2011, 11:33 AM
fgb fgb is offline
Junior Member
 
Posts: 8
Default Delete an account via SOAP, how to find zimbraId ?

Hi,

I have been able to successfully add an account via SOAP and I am now looking to delete one. However, I need the zimbraId to do that and can't find how to get this id via SOAP. Is there any other way to find it than the command line?

Thanks
Reply With Quote
  #2 (permalink)  
Old 06-17-2011, 09:08 PM
Outstanding Member
 
Posts: 717
Default

You can get it with GetAccountRequest
__________________
01 Networks, LLC / Cybernetik.net
Zimbra NE and OSS Cloud Hosting
Shared Web Hosting
Consulting Services
Reply With Quote
  #3 (permalink)  
Old 04-05-2012, 08:56 AM
Member
 
Posts: 11
Default

When using Java API, how do I get zimbraId?

I also use SoapProvisioning, but can't find it...

In the code:
Account c = sp.getAccountByName("account@domain");

Inspecting "c" variable above in Eclipse IDE, I can see that there's an attribute called "mID" which seems to be zimbraId, but which method from Account class get this value? I tried getId() but it is blank, getUid() is from the email adress,... just don't know!
Reply With Quote
  #4 (permalink)  
Old 04-11-2012, 12:20 AM
Trained Alumni
 
Posts: 104
Default

Quote:
Originally Posted by Roger75 View Post
When using Java API, how do I get zimbraId?
The XML you would need to send is:
Code:
<GetAccountRequest attrs="zimbraId" xmlns="urn:zimbraAdmin">
  <account by="name">address@domain.tld</account>
</GetAccountRequest>
The trick here is passing the attrs= attribute to tell it you want the zimbraId, although from the response output, I'm guessing you probably get that back with every request anyway as the id= attribute of the account object in the response.

The above will give you back something like this:
Code:
<GetAccountResponse xmlns="urn:zimbraAdmin">
  <account id="53738983-181d-44a0-baec-26ddbc224d54" name="address@domain.tld">
    <a n="zimbraId">53738983-181d-44a0-baec-26ddbc224d54</a>
  </account>
</GetAccountResponse>
Reply With Quote
  #5 (permalink)  
Old 04-11-2012, 05:51 AM
Member
 
Posts: 11
Default

Quote:
Originally Posted by justdave View Post
The XML you would need to send is:
Code:
<GetAccountRequest attrs="zimbraId" xmlns="urn:zimbraAdmin">
  <account by="name">address@domain.tld</account>
</GetAccountRequest>
The trick here is passing the attrs= attribute to tell it you want the zimbraId, although from the response output, I'm guessing you probably get that back with every request anyway as the id= attribute of the account object in the response.

The above will give you back something like this:
Code:
<GetAccountResponse xmlns="urn:zimbraAdmin">
  <account id="53738983-181d-44a0-baec-26ddbc224d54" name="address@domain.tld">
    <a n="zimbraId">53738983-181d-44a0-baec-26ddbc224d54</a>
  </account>
</GetAccountResponse>
But using the Java API, getId method from Account class is returning an empty value:

Account c = sp.getAccountByName("address@domain.tld");
String id=c.getId(); // this is returning a blank string!!

So I can't get zimbraId!
Is it a problem from SoapProvisioning API?
What's the other way to send the XML you showed above using Java?
Reply With Quote
  #6 (permalink)  
Old 04-12-2012, 04:04 AM
Trained Alumni
 
Posts: 104
Default

I haven't ever done it from Java so hopefully someone else can step in and help here. I've always done it from Perl, or using the zmsoap commandline tool.
Reply With Quote
  #7 (permalink)  
Old 04-12-2012, 11:07 AM
Member
 
Posts: 11
Default

Quote:
Originally Posted by justdave View Post
I haven't ever done it from Java so hopefully someone else can step in and help here. I've always done it from Perl, or using the zmsoap commandline tool.
Please, how do you send the xml request using perl? Could you show the command line?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.