diff options
Diffstat (limited to 'zend/documentation/manual/core/en/zend.gdata.gapps.html')
| -rw-r--r-- | zend/documentation/manual/core/en/zend.gdata.gapps.html | 1287 |
1 files changed, 1287 insertions, 0 deletions
diff --git a/zend/documentation/manual/core/en/zend.gdata.gapps.html b/zend/documentation/manual/core/en/zend.gdata.gapps.html new file mode 100644 index 0000000..4e8598b --- /dev/null +++ b/zend/documentation/manual/core/en/zend.gdata.gapps.html @@ -0,0 +1,1287 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + <title>Using Google Apps Provisioning - Zend Framework Manual</title> + +</head> +<body> +<table width="100%"> + <tr valign="top"> + <td width="85%"> + <table width="100%"> + <tr> + <td width="25%" style="text-align: left;"> + <a href="zend.gdata.spreadsheets.html">Using Google Spreadsheets</a> + </td> + + <td width="50%" style="text-align: center;"> + <div class="up"><span class="up"><a href="zend.gdata.html">Zend_Gdata</a></span><br /> + <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> + </td> + + <td width="25%" style="text-align: right;"> + <div class="next" style="text-align: right; float: right;"><a href="zend.gdata.photos.html">Using Picasa Web Albums</a></div> + </td> + </tr> + </table> +<hr /> +<div id="zend.gdata.gapps" class="section"><div class="info"><h1 class="title">Using Google Apps Provisioning</h1></div> + + + <p class="para"> + Google Apps is a service which allows domain administrators to offer + their users managed access to Google services such as Mail, Calendar, + and Docs & Spreadsheets. The Provisioning <acronym class="acronym">API</acronym> offers a programmatic + interface to configure this service. Specifically, this <acronym class="acronym">API</acronym> allows + administrators the ability to create, retrieve, update, and delete + user accounts, nicknames, groups, and email lists. + </p> + + <p class="para"> + This library implements version 2.0 of the Provisioning <acronym class="acronym">API</acronym>. Access to + your account via the Provisioning <acronym class="acronym">API</acronym> must be manually enabled for + each domain using the Google Apps control panel. Only certain + account types are able to enable this feature. + </p> + + <p class="para"> + For more information on the Google Apps Provisioning <acronym class="acronym">API</acronym>, including + instructions for enabling <acronym class="acronym">API</acronym> access, refer to the <a href="http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html" class="link external">» Provisioning + <acronym class="acronym">API</acronym> V2.0 Reference</a>. + </p> + + <blockquote><p><b class="note">Note</b>: <span class="info"><b>Authentication</b><br /></span> + + + + The Provisioning <acronym class="acronym">API</acronym> does not support authentication via AuthSub + and anonymous access is not permitted. All <acronym class="acronym">HTTP</acronym> connections must + be authenticated using ClientAuth authentication. + <br /> + </p></blockquote> + + <div class="section" id="zend.gdata.gapps.domain" name="zend.gdata.gapps.domain"><div class="info"><h1 class="title">Setting the current domain</h1></div> + + + <p class="para"> + In order to use the Provisioning <acronym class="acronym">API</acronym>, the domain being + administered needs to be specified in all request <acronym class="acronym">URI</acronym>s. In order + to ease development, this information is stored within both the + Gapps service and query classes to use when constructing + requests. + </p> + + <div class="section" id="zend.gdata.gapps.domain.service" name="zend.gdata.gapps.domain.service"><div class="info"><h1 class="title">Setting the domain for the service class</h1></div> + + + <p class="para"> + To set the domain for requests made by the service class, + either call <span class="methodname">setDomain()</span> or specify the domain + when instantiating the service class. For example: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$domain</span> = <span style="color: #ff0000;">"example.com"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Gdata_Gapps<span style="color: #66cc66;">(</span><span style="color: #0000ff;">$client</span>, <span style="color: #0000ff;">$domain</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.domain.query" name="zend.gdata.gapps.domain.query"><div class="info"><h1 class="title">Setting the domain for query classes</h1></div> + + + <p class="para"> + Setting the domain for requests made by query classes is + similar to setting it for the service class-either call + <span class="methodname">setDomain()</span> or specify the domain when creating + the query. For example: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$domain</span> = <span style="color: #ff0000;">"example.com"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Gdata_Gapps_UserQuery<span style="color: #66cc66;">(</span><span style="color: #0000ff;">$domain</span>, <span style="color: #0000ff;">$arg</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + When using a service class factory method to create a query, + the service class will automatically set the query's domain to + match its own domain. As a result, it is not necessary to + specify the domain as part of the constructor arguments. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$domain</span> = <span style="color: #ff0000;">"example.com"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span> = <span style="color: #000000; font-weight: bold;">new</span> Zend_Gdata_Gapps<span style="color: #66cc66;">(</span><span style="color: #0000ff;">$client</span>, <span style="color: #0000ff;">$domain</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newUserQuery</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$arg</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + </div> + + <div class="section" id="zend.gdata.gapps.users" name="zend.gdata.gapps.users"><div class="info"><h1 class="title">Interacting with users</h1></div> + + + <p class="para"> + Each user account on a Google Apps hosted domain is represented as + an instance of <span class="classname">Zend_Gdata_Gapps_UserEntry</span>. This class provides + access to all account properties including name, username, + password, access rights, and current quota. + </p> + + <div class="section" id="zend.gdata.gapps.users.creating" name="zend.gdata.gapps.users.creating"><div class="info"><h1 class="title">Creating a user account</h1></div> + + + <p class="para"> + User accounts can be created by calling the + <span class="methodname">createUser()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">createUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span>, <span style="color: #ff0000;">'Random'</span>, <span style="color: #ff0000;">'User'</span>, <span style="color: #ff0000;">'••••••••'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Users can also be created by instantiating UserEntry, + providing a username, given name, family name, and password, + then calling <span class="methodname">insertUser()</span> on a service object to + upload the entry to the server. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newUserEntry</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newLogin</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">username</span> = <span style="color: #ff0000;">'foo'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">password</span> = <span style="color: #ff0000;">'••••••••'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newName</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">givenName</span> = <span style="color: #ff0000;">'Random'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">familyName</span> = <span style="color: #ff0000;">'User'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">insertUser</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + The user's password should normally be provided as cleartext. + Optionally, the password can be provided as an <acronym class="acronym">SHA-1</acronym> digest if + <strong class="command">login->passwordHashFunction</strong> is set to + '<span class="property">SHA-1</span>'. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.users.retrieving" name="zend.gdata.gapps.users.retrieving"><div class="info"><h1 class="title">Retrieving a user account</h1></div> + + + <p class="para"> + Individual user accounts can be retrieved by calling the + <span class="methodname">retrieveUser()</span> convenience method. If the user is + not found, <b><tt>NULL</tt></b> will be returned. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Username: '</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">userName</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Given Name: '</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">givenName</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Family Name: '</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">familyName</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Suspended: '</span> . <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">suspended</span> ? <span style="color: #ff0000;">'Yes'</span> : <span style="color: #ff0000;">'No'</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Admin: '</span> . <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">admin</span> ? <span style="color: #ff0000;">'Yes'</span> : <span style="color: #ff0000;">'No'</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Must Change Password: '</span> .</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">changePasswordAtNextLogin</span> ? <span style="color: #ff0000;">'Yes'</span> : <span style="color: #ff0000;">'No'</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Has Agreed To Terms: '</span> .</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">agreedToTerms</span> ? <span style="color: #ff0000;">'Yes'</span> : <span style="color: #ff0000;">'No'</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Users can also be retrieved by creating an + instance of <span class="classname">Zend_Gdata_Gapps_UserQuery</span>, setting its username + property to equal the username of the user that is to be + retrieved, and calling <span class="methodname">getUserEntry()</span> on a + service object with that query. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newUserQuery</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getUserEntry</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Username: '</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">userName</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Given Name: '</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">givenName</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Family Name: '</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">familyName</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Suspended: '</span> . <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">suspended</span> ? <span style="color: #ff0000;">'Yes'</span> : <span style="color: #ff0000;">'No'</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Admin: '</span> . <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">admin</span> ? <span style="color: #ff0000;">'Yes'</span> : <span style="color: #ff0000;">'No'</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Must Change Password: '</span> .</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">changePasswordAtNextLogin</span> ? <span style="color: #ff0000;">'Yes'</span> : <span style="color: #ff0000;">'No'</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Has Agreed To Terms: '</span> .</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">agreedToTerms</span> ? <span style="color: #ff0000;">'Yes'</span> : <span style="color: #ff0000;">'No'</span><span style="color: #66cc66;">)</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li></ol></div></div></div> + + + <p class="para"> + If the specified user cannot be located a ServiceException + will be thrown with an error code of + <b><tt>Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST</tt></b>. + ServiceExceptions will be covered in <a href="zend.gdata.gapps.html#zend.gdata.gapps.exceptions" class="link">the exceptions chapter</a>. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.users.retrievingAll" name="zend.gdata.gapps.users.retrievingAll"><div class="info"><h1 class="title">Retrieving all users in a domain</h1></div> + + + <p class="para"> + To retrieve all users in a domain, call the + <span class="methodname">retrieveAllUsers()</span> convenience method. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveAllUsers</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$user</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">" * "</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">username</span> . <span style="color: #ff0000;">' ('</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">givenName</span> .</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #ff0000;">' '</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">familyName</span> . <span style="color: #ff0000;">")<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_UserFeed</span> object which + holds each user on the domain. + </p> + + <p class="para"> + Alternatively, call <span class="methodname">getUserFeed()</span> with no + options. Keep in mind that on larger + domains this feed may be paged by the server. For more + information on paging, see <a href="" class="link">the paging chapter</a>. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getUserFeed</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$user</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">" * "</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">username</span> . <span style="color: #ff0000;">' ('</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">givenName</span> .</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #ff0000;">' '</span> . <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">familyName</span> . <span style="color: #ff0000;">")<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.users.updating" name="zend.gdata.gapps.users.updating"><div class="info"><h1 class="title">Updating a user account</h1></div> + + + <p class="para"> + The easiest way to update a user account is to retrieve the + user as described in the previous sections, make any desired + changes, then call <span class="methodname">save()</span> on that user. Any + changes made will be propagated to the server. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">givenName</span> = <span style="color: #ff0000;">'Foo'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">name</span>-><span style="color: #006600;">familyName</span> = <span style="color: #ff0000;">'Bar'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">save</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <div class="section" id="zend.gdata.gapps.users.updating.resettingPassword" name="zend.gdata.gapps.users.updating.resettingPassword"><div class="info"><h1 class="title">Resetting a user's password</h1></div> + + + <p class="para"> + A user's password can be reset to a new value by updating + the <strong class="command">login->password</strong> property. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">password</span> = <span style="color: #ff0000;">'••••••••'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">save</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Note that it is not possible to recover a password in this + manner as stored passwords are not made available via the + Provisioning <acronym class="acronym">API</acronym> for security reasons. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.users.updating.forcingPasswordChange" name="zend.gdata.gapps.users.updating.forcingPasswordChange"><div class="info"><h1 class="title">Forcing a user to change their password</h1></div> + + + <p class="para"> + A user can be forced to change their password at their + next login by setting the + <strong class="command">login->changePasswordAtNextLogin</strong> property to + <b><tt>TRUE</tt></b>. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">changePasswordAtNextLogin</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">save</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Similarly, this can be undone by setting the + <strong class="command">login->changePasswordAtNextLogin</strong> property to + <b><tt>FALSE</tt></b>. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.users.updating.suspendingAccount" name="zend.gdata.gapps.users.updating.suspendingAccount"><div class="info"><h1 class="title">Suspending a user account</h1></div> + + + <p class="para"> + Users can be restricted from logging in without deleting + their user account by instead + <em class="emphasis">suspending</em> their user account. + Accounts can be suspended or restored by using the + <span class="methodname">suspendUser()</span> and + <span class="methodname">restoreUser()</span> convenience methods: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">suspendUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">restoreUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Alternatively, you can set the UserEntry's + <strong class="command">login->suspended</strong> property to + <b><tt>TRUE</tt></b>. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">suspended</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">save</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + To restore the user's access, set the + <strong class="command">login->suspended</strong> property to + <b><tt>FALSE</tt></b>. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.users.updating.grantingAdminRights" name="zend.gdata.gapps.users.updating.grantingAdminRights"><div class="info"><h1 class="title">Granting administrative rights</h1></div> + + + <p class="para"> + Users can be granted the ability to administer your domain + by setting their <strong class="command">login->admin</strong> property to + <b><tt>TRUE</tt></b>. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">admin</span> = <span style="color: #000000; font-weight: bold;">true</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$user</span>-><span style="color: #006600;">save</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + And as expected, setting a user's <strong class="command">login->admin</strong> + property to <b><tt>FALSE</tt></b> revokes their + administrative rights. + </p> + </div> + </div> + + <div class="section" id="zend.gdata.gapps.users.deleting" name="zend.gdata.gapps.users.deleting"><div class="info"><h1 class="title">Deleting user accounts</h1></div> + + + <p class="para"> + Deleting a user account to which you already hold a UserEntry + is a simple as calling <span class="methodname">delete()</span> on that + entry. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$user</span>-><span style="color: #006600;">delete</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + If you do not have access to a UserEntry object for an + account, use the <span class="methodname">deleteUser()</span> convenience method. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">deleteUser</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + </div> + + <div class="section" id="zend.gdata.gapps.nicknames" name="zend.gdata.gapps.nicknames"><div class="info"><h1 class="title">Interacting with nicknames</h1></div> + + + <p class="para"> + Nicknames serve as email aliases for existing users. Each nickname + contains precisely two key properties: its name and its owner. Any + email addressed to a nickname is forwarded to the user who owns + that nickname. + </p> + + <p class="para"> + Nicknames are represented as an instances of + <span class="classname">Zend_Gdata_Gapps_NicknameEntry</span>. + </p> + + <div class="section" id="zend.gdata.gapps.nicknames.creating" name="zend.gdata.gapps.nicknames.creating"><div class="info"><h1 class="title">Creating a nickname</h1></div> + + + <p class="para"> + Nicknames can be created by calling the + <span class="methodname">createNickname()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">createNickname</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span>, <span style="color: #ff0000;">'bar'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Nicknames can also be created by instantiating NicknameEntry, + providing the nickname with a name and an owner, then calling + <span class="methodname">insertNickname()</span> on a service object to upload + the entry to the server. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$nickname</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newNicknameEntry</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">login</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newLogin</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">nickname</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newNickname</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$nickname</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">insertNickname</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$nickname</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.nicknames.retrieving" name="zend.gdata.gapps.nicknames.retrieving"><div class="info"><h1 class="title">Retrieving a nickname</h1></div> + + + <p class="para"> + Nicknames can be retrieved by calling the + <span class="methodname">retrieveNickname()</span> convenience method. This will + return <b><tt>NULL</tt></b> if a user is not found. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$nickname</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveNickname</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Nickname: '</span> . <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">nickname</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Owner: '</span> . <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">username</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Individual nicknames can also be retrieved by creating an + instance of <span class="classname">Zend_Gdata_Gapps_NicknameQuery</span>, setting its + nickname property to equal the nickname that is to be + retrieved, and calling <span class="methodname">getNicknameEntry()</span> on a + service object with that query. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newNicknameQuery</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$nickname</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getNicknameEntry</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Nickname: '</span> . <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">nickname</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'Owner: '</span> . <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">username</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li></ol></div></div></div> + + + <p class="para"> + As with users, if no corresponding nickname is found a + ServiceException will be thrown with an error code of + <b><tt>Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST</tt></b>. Again, these + will be discussed in <a href="zend.gdata.gapps.html#zend.gdata.gapps.exceptions" class="link">the exceptions chapter</a>. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.nicknames.retrievingUser" name="zend.gdata.gapps.nicknames.retrievingUser"><div class="info"><h1 class="title">Retrieving all nicknames for a user</h1></div> + + + <p class="para"> + To retrieve all nicknames associated with a given user, call + the convenience method <span class="methodname">retrieveNicknames()</span>. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveNicknames</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$nickname</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">nickname</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_NicknameFeed</span> object which + holds each nickname associated with the specified user. + </p> + + <p class="para"> + Alternatively, create a new <span class="classname">Zend_Gdata_Gapps_NicknameQuery</span>, + set its username property to the desired user, and submit the + query by calling <span class="methodname">getNicknameFeed()</span> on a service + object. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newNicknameQuery</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span>-><span style="color: #006600;">setUsername</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getNicknameFeed</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$nickname</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">nickname</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.nicknames.retrievingAll" name="zend.gdata.gapps.nicknames.retrievingAll"><div class="info"><h1 class="title">Retrieving all nicknames in a domain</h1></div> + + + <p class="para"> + To retrieve all nicknames in a feed, simply call the + convenience method <span class="methodname">retrieveAllNicknames()</span> + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveAllNicknames</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$nickname</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">nickname</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">' => '</span> .</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">username</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_NicknameFeed</span> object which + holds each nickname on the domain. + </p> + + <p class="para"> + Alternatively, call <span class="methodname">getNicknameFeed()</span> on a + service object with no arguments. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getNicknameFeed</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$nickname</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">nickname</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">' => '</span> .</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">login</span>-><span style="color: #006600;">username</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.nicknames.deleting" name="zend.gdata.gapps.nicknames.deleting"><div class="info"><h1 class="title">Deleting a nickname</h1></div> + + + <p class="para"> + Deleting a nickname to which you already hold a NicknameEntry + for is a simple as calling <span class="methodname">delete()</span> on that + entry. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$nickname</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveNickname</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$nickname</span>-><span style="color: #006600;">delete</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + For nicknames which you do not hold a NicknameEntry for, use + the <span class="methodname">deleteNickname()</span> convenience method. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">deleteNickname</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + </div> + + <div class="section" id="zend.gdata.gapps.groups" name="zend.gdata.gapps.groups"><div class="info"><h1 class="title">Interacting with groups</h1></div> + + + <p class="para"> + Google Groups allows people to post messages like an email list. Google + is depreciating the Email List <acronym class="acronym">API</acronym>. 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. + </p> + + <p class="para"> + Each group on a domain is represented as an instance of + <span class="classname">Zend_Gdata_Gapps_GroupEntry</span>. + </p> + + <div class="section" id="zend.gdata.gapps.groups.creating" name="zend.gdata.gapps.groups.creating"><div class="info"><h1 class="title">Creating a group</h1></div> + + + <p class="para"> + Groups can be created by calling the + <span class="methodname">createGroup()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">createGroup</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span>, <span style="color: #ff0000;">'The Friends Group'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Groups can also be created by instantiating + GroupEntry, providing a group id and name for the group, + then calling <span class="methodname">insertGroup()</span> on a service + object to upload the entry to the server. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$group</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newGroupEntry</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$properties</span><span style="color: #66cc66;">[</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">]</span> = <span style="color: #0000ff;">$this</span>-><span style="color: #006600;">newProperty</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$properties</span><span style="color: #66cc66;">[</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">]</span>-><span style="color: #006600;">name</span> = <span style="color: #ff0000;">'groupId'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$properties</span><span style="color: #66cc66;">[</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">]</span>-><span style="color: #006600;">value</span> = <span style="color: #ff0000;">'friends'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$properties</span><span style="color: #66cc66;">[</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">]</span> = <span style="color: #0000ff;">$this</span>-><span style="color: #006600;">newProperty</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$properties</span><span style="color: #66cc66;">[</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">]</span>-><span style="color: #006600;">name</span> = <span style="color: #ff0000;">'groupName'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$properties</span><span style="color: #66cc66;">[</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">]</span>-><span style="color: #006600;">value</span> = <span style="color: #ff0000;">'The Friends Group'</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$group</span>-><span style="color: #006600;">property</span> = <span style="color: #0000ff;">$properties</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$group</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">insertGroup</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$group</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.groups.retrieveGroup" name="zend.gdata.gapps.groups.retrieveGroup"><div class="info"><h1 class="title">Retrieving an individual group</h1></div> + + + <p class="para"> + To retrieve an individual group, call the + <span class="methodname">retrieveGroup()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$entry</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveGroup</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$entry</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_GroupEntry</span> + object which holds the properties about the group. + </p> + + <p class="para"> + Alternatively, create a new <span class="classname">Zend_Gdata_Gapps_GroupQuery</span>, + set its groupId property to the desired group id, and + submit the query by calling <span class="methodname">getGroupEntry()</span> + on a service object. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newGroupQuery</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span>-><span style="color: #006600;">setGroupId</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$entry</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getGroupEntry</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$entry</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.groups.retrievingAll" name="zend.gdata.gapps.groups.retrievingAll"><div class="info"><h1 class="title">Retrieving all groups in a domain</h1></div> + + + <p class="para"> + To retrieve all groups in a domain, call the convenience + method <span class="methodname">retrieveAllGroups()</span>. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveAllGroups</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span>-><span style="color: #006600;">entry</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$entry</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$entry</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_GroupFeed</span> + object which holds each group on the domain. + </p> + + <p class="para"> + Alternatively, call <span class="methodname">getGroupFeed()</span> on a + service object with no arguments. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getGroupFeed</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span>-><span style="color: #006600;">entry</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$entry</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$entry</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.groups.deleting" name="zend.gdata.gapps.groups.deleting"><div class="info"><h1 class="title">Deleting a group</h1></div> + + + <p class="para"> + To delete a group, call the <span class="methodname">deleteGroup()</span> convenience + method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">deleteGroup</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.groups.updating" name="zend.gdata.gapps.groups.updating"><div class="info"><h1 class="title">Updating a group</h1></div> + + + <p class="para"> + Groups can be updated by calling the + <span class="methodname">updateGroup()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">updateGroup</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'group-id-here'</span>, <span style="color: #ff0000;">'Group Name Here'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + 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. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.groups.retrieve" name="zend.gdata.gapps.groups.retrieve"><div class="info"><h1 class="title">Retrieving all groups to which a person is a member</h1></div> + + + <p class="para"> + To retrieve all groups to which a particular person is a + member, call the <span class="methodname">retrieveGroups()</span> + convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveGroups</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'baz@somewhere.com'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span>-><span style="color: #006600;">entry</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$entry</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$entry</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_GroupFeed</span> + object which holds each group associated with the specified member. + </p> + + <p class="para"> + Alternatively, create a new <span class="classname">Zend_Gdata_Gapps_GroupQuery</span>, + set its member property to the desired email address, and + submit the query by calling <span class="methodname">getGroupFeed()</span> + on a service object. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newGroupQuery</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span>-><span style="color: #006600;">setMember</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'baz@somewhere.com'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getGroupFeed</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span>-><span style="color: #006600;">entry</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$entry</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$entry</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> + </div> + + <div class="section" id="zend.gdata.gapps.groupMembers" name="zend.gdata.gapps.groupMembers"><div class="info"><h1 class="title">Interacting with group members</h1></div> + + + <p class="para"> + Each member subscribed to a group is represented by an + instance of <span class="classname">Zend_Gdata_Gapps_MemberEntry</span>. + Through this class, individual recipients can be added and removed + from groups. + </p> + + <div class="section" id="zend.gdata.gapps.groupMembers.adding" name="zend.gdata.gapps.groupMembers.adding"><div class="info"><h1 class="title">Adding a member to a group</h1></div> + + + <p class="para"> + To add a member to a group, simply call the + <span class="methodname">addMemberToGroup()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">addMemberToGroup</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar@somewhere.com'</span>, <span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.groupMembers.check" name="zend.gdata.gapps.groupMembers.check"><div class="info"><h1 class="title">Check to see if member belongs to group</h1></div> + + + <p class="para"> + To check to see if member belongs to group, simply call the + <span class="methodname">isMember()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$isMember</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">isMember</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar@somewhere.com'</span>, <span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/var_dump"><span style="color: #000066;">var_dump</span></a><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$isMember</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + The method returns a boolean value. If the member belongs to the + group specified, the method returns true, else it returns false. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.groupMembers.removing" name="zend.gdata.gapps.groupMembers.removing"><div class="info"><h1 class="title">Removing a member from a group</h1></div> + + + <p class="para"> + To remove a member from a group, call the + <span class="methodname">removeMemberFromGroup()</span> convenience + method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">removeMemberFromGroup</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'baz'</span>, <span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.groupMembers.retrieving" name="zend.gdata.gapps.groupMembers.retrieving"><div class="info"><h1 class="title">Retrieving the list of members to a group</h1></div> + + + <p class="para"> + The convenience method <span class="methodname">retrieveAllMembers()</span> + can be used to retrieve the list of members of a group: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveAllMembers</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$member</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$member</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + Alternatively, construct a new MemberQuery, set its groupId + property to match the desired group id, and call + <span class="methodname">getMemberFeed()</span> on a service object. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newMemberQuery</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span>-><span style="color: #006600;">setGroupId</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getMemberFeed</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$member</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$member</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_MemberFeed</span> + object which holds each member for the selected group. + </p> + </div> + </div> + + <div class="section" id="zend.gdata.gapps.groupOwners" name="zend.gdata.gapps.groupOwners"><div class="info"><h1 class="title">Interacting with group owners</h1></div> + + + <p class="para"> + Each owner associated with a group is represented by an + instance of <span class="classname">Zend_Gdata_Gapps_OwnerEntry</span>. + Through this class, individual owners can be added and removed + from groups. + </p> + + <div class="section" id="zend.gdata.gapps.groupOwners.adding" name="zend.gdata.gapps.groupOwners.adding"><div class="info"><h1 class="title">Adding an owner to a group</h1></div> + + + <p class="para"> + To add an owner to a group, simply call the + <span class="methodname">addOwnerToGroup()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">addOwnerToGroup</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar@somewhere.com'</span>, <span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.groupOwners.retrieving" name="zend.gdata.gapps.groupOwners.retrieving"><div class="info"><h1 class="title">Retrieving the list of the owner of a group</h1></div> + + + <p class="para"> + The convenience method <span class="methodname">retrieveGroupOwners()</span> + can be used to retrieve the list of the owners of a group: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveGroupOwners</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$owner</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$owner</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + Alternatively, construct a new OwnerQuery, set its groupId + property to match the desired group id, and call + <span class="methodname">getOwnerFeed()</span> on a service object. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newOwnerQuery</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span>-><span style="color: #006600;">setGroupId</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getOwnerFeed</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$owner</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$owner</span>-><span style="color: #006600;">property</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$p</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"Property Name: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">name</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>Property Value: "</span> . <span style="color: #0000ff;">$p</span>-><span style="color: #006600;">value</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_OwnerFeed</span> + object which holds each member for the selected group. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.groupOwners.check" name="zend.gdata.gapps.groupOwners.check"><div class="info"><h1 class="title">Check to see if an email is the owner of a group</h1></div> + + + <p class="para"> + To check to see if an email is the owner of a group, simply call + the <span class="methodname">isOwner()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$isOwner</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">isOwner</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar@somewhere.com'</span>, <span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/var_dump"><span style="color: #000066;">var_dump</span></a><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$isOwner</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + The method returns a boolean value. If the email is the owner of + the group specified, the method returns true, else it returns false. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.groupOwners.removing" name="zend.gdata.gapps.groupOwners.removing"><div class="info"><h1 class="title">Removing an owner from a group</h1></div> + + + <p class="para"> + To remove an owner from a group, call the + <span class="methodname">removeOwnerFromGroup()</span> convenience + method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">removeOwnerFromGroup</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'baz@somewhere.com'</span>, <span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + </div> + + <div class="section" id="zend.gdata.gapps.emailLists" name="zend.gdata.gapps.emailLists"><div class="info"><h1 class="title">Interacting with email lists</h1></div> + + + <p class="para"> + Email lists allow several users to retrieve email addressed to a + single email address. Users do not need to be a + member of this domain in order to subscribe to an email list + provided their complete email address (including domain) is used. + </p> + + <p class="para"> + Each email list on a domain is represented as an instance of + <span class="classname">Zend_Gdata_Gapps_EmailListEntry</span>. + </p> + + <div class="section" id="zend.gdata.gapps.emailLists.creating" name="zend.gdata.gapps.emailLists.creating"><div class="info"><h1 class="title">Creating an email list</h1></div> + + + <p class="para"> + Email lists can be created by calling the + <span class="methodname">createEmailList()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">createEmailList</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + + <p class="para"> + Email lists can also be created by instantiating + EmailListEntry, providing a name for the list, then calling + <span class="methodname">insertEmailList()</span> on a service object to upload + the entry to the server. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$list</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newEmailListEntry</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$list</span>-><span style="color: #006600;">emailList</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newEmailList</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$list</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">insertEmailList</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$list</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.emailList.retrieve" name="zend.gdata.gapps.emailList.retrieve"><div class="info"><h1 class="title">Retrieving all email lists to which a recipient is subscribed</h1></div> + + + <p class="para"> + To retrieve all email lists to which a particular recipient is + subscribed, call the <span class="methodname">retrieveEmailLists()</span> + convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveEmailLists</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'baz@somewhere.com'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$list</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$list</span>-><span style="color: #006600;">emailList</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_EmailListFeed</span> object + which holds each email list associated with the specified recipient. + </p> + + <p class="para"> + Alternatively, create a new <span class="classname">Zend_Gdata_Gapps_EmailListQuery</span>, + set its recipient property to the desired email address, and + submit the query by calling <span class="methodname">getEmailListFeed()</span> on + a service object. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newEmailListQuery</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span>-><span style="color: #006600;">setRecipient</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'baz@somewhere.com'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getEmailListFeed</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$list</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$list</span>-><span style="color: #006600;">emailList</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.emailLists.retrievingAll" name="zend.gdata.gapps.emailLists.retrievingAll"><div class="info"><h1 class="title">Retrieving all email lists in a domain</h1></div> + + + <p class="para"> + To retrieve all email lists in a domain, call the convenience + method <span class="methodname">retrieveAllEmailLists()</span>. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveAllEmailLists</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$list</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$list</span>-><span style="color: #006600;">emailList</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_EmailListFeed</span> object + which holds each email list on the domain. + </p> + + <p class="para"> + Alternatively, call <span class="methodname">getEmailListFeed()</span> on a + service object with no arguments. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getEmailListFeed</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$list</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$list</span>-><span style="color: #006600;">emailList</span>-><span style="color: #006600;">name</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.emailList.deleting" name="zend.gdata.gapps.emailList.deleting"><div class="info"><h1 class="title">Deleting an email list</h1></div> + + + <p class="para"> + To delete an email list, call the <span class="methodname">deleteEmailList()</span> + convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">deleteEmailList</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + </div> + + <div class="section" id="zend.gdata.gapps.emailListRecipients" name="zend.gdata.gapps.emailListRecipients"><div class="info"><h1 class="title">Interacting with email list recipients</h1></div> + + + <p class="para"> + Each recipient subscribed to an email list is represented by an + instance of <span class="classname">Zend_Gdata_Gapps_EmailListRecipient</span>. Through this + class, individual recipients can be added and removed from email + lists. + </p> + + <div class="section" id="zend.gdata.gapps.emailListRecipients.adding" name="zend.gdata.gapps.emailListRecipients.adding"><div class="info"><h1 class="title">Adding a recipient to an email list</h1></div> + + + <p class="para"> + To add a recipient to an email list, simply call the + <span class="methodname">addRecipientToEmailList()</span> convenience method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">addRecipientToEmailList</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'bar@somewhere.com'</span>, <span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + + <div class="section" id="zend.gdata.gapps.emailListRecipients.retrieving" name="zend.gdata.gapps.emailListRecipients.retrieving"><div class="info"><h1 class="title">Retrieving the list of subscribers to an email list</h1></div> + + + <p class="para"> + The convenience method <span class="methodname">retrieveAllRecipients()</span> + can be used to retrieve the list of subscribers to an email list: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">retrieveAllRecipients</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$recipient</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$recipient</span>-><span style="color: #006600;">who</span>-><span style="color: #006600;">email</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + Alternatively, construct a new EmailListRecipientQuery, set + its emailListName property to match the desired email list, + and call <span class="methodname">getEmailListRecipientFeed()</span> on a service + object. + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newEmailListRecipientQuery</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$query</span>-><span style="color: #006600;">setEmailListName</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$feed</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getEmailListRecipientFeed</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$feed</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$recipient</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">' * '</span> . <span style="color: #0000ff;">$recipient</span>-><span style="color: #006600;">who</span>-><span style="color: #006600;">email</span> . <span style="color: #ff0000;">"<span style="color: #000099; font-weight: bold;">\n</span>"</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + + <p class="para"> + This will create a <span class="classname">Zend_Gdata_Gapps_EmailListRecipientFeed</span> + object which holds each recipient for the selected email list. + </p> + </div> + + <div class="section" id="zend.gdata.gapps.emailListRecipients.removing" name="zend.gdata.gapps.emailListRecipients.removing"><div class="info"><h1 class="title">Removing a recipient from an email list</h1></div> + + + <p class="para"> + To remove a recipient from an email list, call the + <span class="methodname">removeRecipientFromEmailList()</span> convenience + method: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">removeRecipientFromEmailList</span><span style="color: #66cc66;">(</span><span style="color: #ff0000;">'baz@somewhere.com'</span>, <span style="color: #ff0000;">'friends'</span><span style="color: #66cc66;">)</span>;</div></li></ol></div></div></div> + + </div> + </div> + + <div class="section" id="zend.gdata.gapps.exceptions" name="zend.gdata.gapps.exceptions"><div class="info"><h1 class="title">Handling errors</h1></div> + + + <p class="para"> + In addition to the standard suite of exceptions thrown by + <span class="classname">Zend_Gdata</span>, requests using the Provisioning + <acronym class="acronym">API</acronym> may also throw a + <span class="classname">Zend_Gdata_Gapps_ServiceException</span>. These exceptions + indicate that a <acronym class="acronym">API</acronym> specific error occurred which prevents the + request from completing. + </p> + + <p class="para"> + Each ServiceException instance may hold one or more Error objects. + Each of these objects contains an error code, reason, and + (optionally) the input which triggered the exception. A complete + list of known error codes is provided in Zend Framework's <acronym class="acronym">API</acronym> + documentation under <span class="classname">Zend_Gdata_Gapps_Error</span>. Additionally, the + authoritative error list is available online at <a href="http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_d" class="link external">» Google + Apps Provisioning <acronym class="acronym">API</acronym> V2.0 Reference: Appendix D</a>. + </p> + + <p class="para"> + While the complete list of errors received is available within + ServiceException as an array by calling <span class="methodname">getErrors()</span>, + often it is convenient to know if one specific error occurred. For + these cases the presence of an error can be determined by calling + <span class="methodname">hasError()</span>. + </p> + + <p class="para"> + The following example demonstrates how to detect if a requested + resource doesn't exist and handle the fault gracefully: + </p> + + <div class="programlisting php"><div class="phpcode"><div class="php" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">function</span> retrieveUser <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$username</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #0000ff;">$query</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">newUserQuery</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$username</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> try <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #0000ff;">$user</span> = <span style="color: #0000ff;">$gdata</span>-><span style="color: #006600;">getUserEntry</span><span style="color: #66cc66;">(</span><span style="color: #0000ff;">$query</span><span style="color: #66cc66;">)</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span> catch <span style="color: #66cc66;">(</span>Zend_Gdata_Gapps_ServiceException <span style="color: #0000ff;">$e</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #808080; font-style: italic;">// Set the user to null if not found</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">(</span><span style="color: #0000ff;">$e</span>-><span style="color: #006600;">hasError</span><span style="color: #66cc66;">(</span>Zend_Gdata_Gapps_Error::<span style="color: #006600;">ENTITY_DOES_NOT_EXIST</span><span style="color: #66cc66;">)</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #0000ff;">$user</span> = <span style="color: #000000; font-weight: bold;">null</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">{</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> throw <span style="color: #0000ff;">$e</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #66cc66;">}</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$user</span>;</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">}</span></div></li></ol></div></div></div> + + </div> +</div> + <hr /> + + <table width="100%"> + <tr> + <td width="25%" style="text-align: left;"> + <a href="zend.gdata.spreadsheets.html">Using Google Spreadsheets</a> + </td> + + <td width="50%" style="text-align: center;"> + <div class="up"><span class="up"><a href="zend.gdata.html">Zend_Gdata</a></span><br /> + <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> + </td> + + <td width="25%" style="text-align: right;"> + <div class="next" style="text-align: right; float: right;"><a href="zend.gdata.photos.html">Using Picasa Web Albums</a></div> + </td> + </tr> + </table> +</td> + <td style="font-size: smaller;" width="15%"> <style type="text/css"> +#leftbar { + float: left; + width: 186px; + padding: 5px; + font-size: smaller; +} +ul.toc { + margin: 0px 5px 5px 5px; + padding: 0px; +} +ul.toc li { + font-size: 85%; + margin: 1px 0 1px 1px; + padding: 1px 0 1px 11px; + list-style-type: none; + background-repeat: no-repeat; + background-position: center left; +} +ul.toc li.header { + font-size: 115%; + padding: 5px 0px 5px 11px; + border-bottom: 1px solid #cccccc; + margin-bottom: 5px; +} +ul.toc li.active { + font-weight: bold; +} +ul.toc li a { + text-decoration: none; +} +ul.toc li a:hover { + text-decoration: underline; +} +</style> + <ul class="toc"> + <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li> + <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li> + <li class="header up"><a href="reference.html">Zend Gdata Reference</a></li> + <li class="header up"><a href="zend.gdata.html">Zend_Gdata</a></li> + <li><a href="zend.gdata.analytics.html">Using Google Analytics</a></li> + <li><a href="zend.gdata.authsub.html">Authenticating with AuthSub</a></li> + <li><a href="zend.gdata.books.html">Using the Book Search Data API</a></li> + <li><a href="zend.gdata.clientlogin.html">Authenticating with ClientLogin</a></li> + <li><a href="zend.gdata.calendar.html">Using Google Calendar</a></li> + <li><a href="zend.gdata.docs.html">Using Google Documents List Data API</a></li> + <li><a href="zend.gdata.spreadsheets.html">Using Google Spreadsheets</a></li> + <li class="active"><a href="zend.gdata.gapps.html">Using Google Apps Provisioning</a></li> + <li><a href="zend.gdata.photos.html">Using Picasa Web Albums</a></li> + <li><a href="zend.gdata.youtube.html">Using the YouTube Data API</a></li> + <li><a href="zend.gdata.exception.html">Catching Gdata Exceptions</a></li> + </ul> + </td> + </tr> +</table> +</body> +</html>
\ No newline at end of file |
