Connect. Communicate. Collaborate. Securely.

Home » Developer Zone » API/SDK Writers » Get Groups/Members via API
  •  
uptimjeff

Messages: 61
Karma: 1
Send a private message to this user
Using the API and provided examples, it was easy enough to display members of Mailing Lists via web interface (outside of administrator console).

The provided PHP code
getMailinglistMembers.php
Does this quite well.


I'm looking for code that will do the same, but with Groups/Members
and only display groups/members which have the Display in GAL checked.

Has anyone done this?
I have a small budget from the client for this, would be happy to pass along or buy some books on amazon or make a donation somewhere Smile

Thanks
Jeff
  •  
Miroslav Osladil (Kerio)

Messages: 188

Karma: 27
Send a private message to this user
Hello,
this is quite easy. According to group structure there is a publishInGal attribute. The same applies for users.

So only you need to do is get list of groups by Groups.get method and set publishInGal field, e.g.:

    $domainId = 'keriodb://domain/5883 ... ... 1e37';
    $params = array(
        'query' => array(
            'fields' => array('id', 'name', 'publishInGal'),
            'orderBy' => array(array(
                'columnName' => 'name',
                'direction' => 'Asc'
            ))
        ),
        'domainId' => $domainId
    );
    $response = $api->sendRequest('Groups.get', $params);
    
    foreach ($response['list'] as $group) {
        $isPublished = ($group['publishInGal']) ? 'is' : 'is not';
        printf('Group %s %s published in GAL.<br>', $group['name'], $isPublished);
    }


Note:
- $domainId is id of the domain where listing the groups, obtained by Domains.get method.

Hope it will help. Smile

Best regards,

Miroslav Osladil
Senior Developer
Kerio Technologies

The views I express are my own and do not necessarily reflect the views of Kerio Technologies.
  •  
pcunix

Messages: 594
Karma: 33
Send a private message to this user

Tony Lawrence
Kerio Preferred Partner and Reseller
Certified for Connect, Control
http://aplawrence.com
  •  
Miroslav Osladil (Kerio)

Messages: 188

Karma: 27
Send a private message to this user
Nice! Thanks for sharing.

Miroslav Osladil
Senior Developer
Kerio Technologies

The views I express are my own and do not necessarily reflect the views of Kerio Technologies.
  •  
pcunix

Messages: 594
Karma: 33
Send a private message to this user
I don't see anything for getting or setting Distribution Lists, though..

Are you going to add user cfg stuff eventually?

Right now, I have a customer who created a bunch of groups and wants them to be public D/L's instead. I can write Perl code to create the vcards easily enough (I think) but y'all keep making it more and more difficult to just plop stuff in and have it seen.. am I going to run into trouble there?

Tony Lawrence
Kerio Preferred Partner and Reseller
Certified for Connect, Control
http://aplawrence.com
  •  
Miroslav Osladil (Kerio)

Messages: 188

Karma: 27
Send a private message to this user
Distribution lists are not related to Administration API but to contacts in general. For such work you need a client API, e.g. that API our Kerio Connect client aka. WebMail2 uses.

Then you have specific contacts-related methods for getting, setting, ... This API requests are available only to logged users and on own contacts, of course.

So you won't be able to say, e.g. sales<_at_>company.tld is a member of DL1,DL2 and DL3 stored in secretary's mailbox etc...

If you are more interested in some more details, I would recommend to checkout our existing sample application the Addressbook.app utility. There is something to start with...

/* Set component Kerio Connect client */
$api->setComponentClient();

/* Login */
$session = $api->login($hostname, $username, $password);

Miroslav Osladil
Senior Developer
Kerio Technologies

The views I express are my own and do not necessarily reflect the views of Kerio Technologies.
  •  
pcunix

Messages: 594
Karma: 33
Send a private message to this user
I didn't know there was a Client API Smile

I never noticed that Address Book example. That 'Contacts.get' in there isn't mentioned at http://manuals.kerio.com/connect/api/en/reference/classes.ht ml ?

Tony Lawrence
Kerio Preferred Partner and Reseller
Certified for Connect, Control
http://aplawrence.com
  •  
Miroslav Osladil (Kerio)

Messages: 188

Karma: 27
Send a private message to this user
Because it is not officially published API. Smile

Miroslav Osladil
Senior Developer
Kerio Technologies

The views I express are my own and do not necessarily reflect the views of Kerio Technologies.
  •  
pcunix

Messages: 594
Karma: 33
Send a private message to this user
Fortunately, I don't have to officially use it Smile

This will be a one-off just to help the customer get what they want.

Tony Lawrence
Kerio Preferred Partner and Reseller
Certified for Connect, Control
http://aplawrence.com
Previous Topic: Control: Get user traffic quota
Next Topic: Extract Pdf from incoming mail
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Tue Aug 22 09:04:27 CEST 2017

Total time taken to generate the page: 0.00593 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.