Index: documentation/manual/en/module_specs/Zend_Gdata_Gapps.xml =================================================================== --- documentation/manual/en/module_specs/Zend_Gdata_Gapps.xml (revision 22018) +++ documentation/manual/en/module_specs/Zend_Gdata_Gapps.xml (working copy) @@ -9,7 +9,7 @@ and Docs & Spreadsheets. The Provisioning API offers a programmatic interface to configure this service. Specifically, this API allows administrators the ability to create, retrieve, update, and delete - user accounts, nicknames, and email lists. + user accounts, nicknames, groups, and email lists. @@ -563,6 +563,426 @@ + + Interacting with groups + + + Google Groups allows people to post messages like an email list. Google + is depreciating the Email List API. Google Groups provides some neat + features like nested groups and group owners. If you want to start + a new email lst, it is advisable to use Google Groups instead. + Google's Email List is not compatible with Google Groups. So if you + create an email list, it will not show up as a group. The opposite is + true as well. + + + + Each group on a domain is represented as an instance of + Zend_Gdata_Gapps_GroupEntry. + + + + Creating a group + + + Groups can be created by calling the + createGroup() convenience method: + + + createGroup('friends', 'The Friends Group'); +]]> + + + Groups can also be created by instantiating + GroupEntry, providing a group id and name for the group, + then calling insertGroup() on a service + object to upload the entry to the server. + + + newGroupEntry(); + +$properties[0] = $this->newProperty(); +$properties[0]->name = 'groupId'; +$properties[0]->value = 'friends'; +$properties[1] = $this->newProperty(); +$properties[1]->name = 'groupName'; +$properties[1]->value = 'The Friends Group'; + +$group->property = $properties; + +$group = $gdata->insertGroup($group); +]]> + + + + Retrieving an individual group + + + To retrieve an individual group, call the + retrieveGroup() convenience method: + + + retrieveGroup('friends'); + +foreach ($entry->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; +} +]]> + + + This will create a Zend_Gdata_Gapps_GroupEntry + object which holds the properties about the group. + + + + Alternatively, create a new Zend_Gdata_Gapps_GroupQuery, + set its groupId property to the desired group id, and + submit the query by calling getGroupEntry() + on a service object. + + + newGroupQuery(); +$query->setGroupId('friends'); +$entry = $gdata->getGroupEntry($query); + +foreach ($entry->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; +} +]]> + + + + Retrieving all groups in a domain + + + To retrieve all groups in a domain, call the convenience + method retrieveAllGroups(). + + + retrieveAllGroups(); + +foreach ($feed->entry as $entry) { + foreach ($entry->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; + } + echo "\n\n"; +} +]]> + + + This will create a Zend_Gdata_Gapps_GroupFeed + object which holds each group on the domain. + + + + Alternatively, call getGroupFeed() on a + service object with no arguments. + + + getGroupFeed(); + +foreach ($feed->entry as $entry) { + foreach ($entry->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; + } + echo "\n\n"; +} +]]> + + + + Deleting a group + + + To delete a group, call the deleteGroup() convenience method: + + + deleteGroup('friends'); +]]> + + + + Updating a group + + + Groups can be updated by calling the + updateGroup() convenience method: + + + updateGroup('group-id-here', 'Group Name Here'); +]]> + + + The first parameter is required. The second, third and fourth parameter, + representing the group name, group descscription, and email permission, + respectively are optional. Setting any of these optional parameters + to null will not update that item. + + + + + Retrieving all groups to which a person is a member + + + To retrieve all groups to which a particular person is a + member, call the retrieveGroups() + convenience method: + + + retrieveGroups('baz@somewhere.com'); + +foreach ($feed->entry as $entry) { + foreach ($entry->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; + } + echo "\n\n"; +} +]]> + + + This will create a Zend_Gdata_Gapps_GroupFeed + object which holds each group associated with the specified member. + + + + Alternatively, create a new Zend_Gdata_Gapps_GroupQuery, + set its member property to the desired email address, and + submit the query by calling getGroupFeed() + on a service object. + + + newGroupQuery(); +$query->setMember('baz@somewhere.com'); +$feed = $gdata->getGroupFeed($query); + +foreach ($feed->entry as $entry) { + foreach ($entry->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; + } + echo "\n\n"; +} +]]> + + + + + Interacting with group members + + + Each member subscribed to a group is represented by an + instance of Zend_Gdata_Gapps_MemberEntry. + Through this class, individual recipients can be added and removed + from groups. + + + + Adding a member to a group + + + To add a member to a group, simply call the + addMemberToGroup() convenience method: + + + addMemberToGroup('bar@somewhere.com', 'friends'); +]]> + + + + Check to see if member belongs to group + + + To check to see if member belongs to group, simply call the + isMember() convenience method: + + + isMember('bar@somewhere.com', 'friends'); +var_dump($isMember); +]]> + + + The method returns a boolean value. If the member belongs to the + group specified, the method returns true, else it returns false. + + + + + Removing a member from a group + + + To remove a member from a group, call the + removeMemberFromGroup() convenience + method: + + + removeMemberFromGroup('baz', 'friends'); +]]> + + + + Retrieving the list of members to a group + + + The convenience method retrieveAllMembers() + can be used to retrieve the list of members of a group: + + + retrieveAllMembers('friends'); + +foreach ($feed as $member) { + foreach ($member->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; + } +} +]]> + + + Alternatively, construct a new MemberQuery, set its groupId + property to match the desired group id, and call + getMemberFeed() on a service object. + + + newMemberQuery(); +$query->setGroupId('friends'); +$feed = $gdata->getMemberFeed($query); + +foreach ($feed as $member) { + foreach ($member->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; + } +} +]]> + + + This will create a Zend_Gdata_Gapps_MemberFeed + object which holds each member for the selected group. + + + + + + Interacting with group owners + + + Each owner associated with a group is represented by an + instance of Zend_Gdata_Gapps_OwnerEntry. + Through this class, individual owners can be added and removed + from groups. + + + + Adding an owner to a group + + + To add an owner to a group, simply call the + addOwnerToGroup() convenience method: + + + addOwnerToGroup('bar@somewhere.com', 'friends'); +]]> + + + + Retrieving the list of the owner of a group + + + The convenience method retrieveGroupOwners() + can be used to retrieve the list of the owners of a group: + + + retrieveGroupOwners('friends'); + +foreach ($feed as $owner) { + foreach ($owner->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; + } +} +]]> + + + Alternatively, construct a new OwnerQuery, set its groupId + property to match the desired group id, and call + getOwnerFeed() on a service object. + + + newOwnerQuery(); +$query->setGroupId('friends'); +$feed = $gdata->getOwnerFeed($query); + +foreach ($feed as $owner) { + foreach ($owner->property as $p) { + echo "Property Name: " . $p->name; + echo "\nProperty Value: " . $p->value . "\n\n"; + } +} +]]> + + + This will create a Zend_Gdata_Gapps_OwnerFeed + object which holds each member for the selected group. + + + + + Check to see if an email is the owner of a group + + + To check to see if an email is the owner of a group, simply call + the isOwner() convenience method: + + + isOwner('bar@somewhere.com', 'friends'); +var_dump($isOwner); +]]> + + + The method returns a boolean value. If the email is the owner of + the group specified, the method returns true, else it returns false. + + + + + Removing an owner from a group + + + To remove an owner from a group, call the + removeOwnerFromGroup() convenience + method: + + + removeOwnerFromGroup('baz@somewhere.com', 'friends'); +]]> + + + Interacting with email lists Index: documentation/manual/en/module_specs/Zend_Gdata-Introduction.xml =================================================================== --- documentation/manual/en/module_specs/Zend_Gdata-Introduction.xml (revision 22018) +++ documentation/manual/en/module_specs/Zend_Gdata-Introduction.xml (working copy) @@ -53,7 +53,7 @@ Google Provisioning provides the ability to create, retrieve, update, and - delete user accounts, nicknames, and email lists on a + delete user accounts, nicknames, groups, and email lists on a Google Apps hosted domain.