1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
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>
|