I am in EST, but it shouldn't matter because the dates are passed around as
formatted strings.
Here is a test program I wrote in Java. Its sets the vacation responder with
the API using a hardcoded entry, then pulls back the entry and prints it
out:
public class VacationTest {
public static void main(String[] args) {
System.out.println("Program start");
setVacation();
getVacation();
System.out.println("Program finish");
}
public static void setVacation(){
GmailSettingsService serv = null;
try{
serv = new GmailSettingsService("your-apps", "XXXXXX.XXX",
"XXXXXX", "XXXXXX");
}catch(Exception e){
e.printStackTrace();
System.out.println("new service threw exception");
}
System.out.println("Creating entry");
GenericEntry ent = new GenericEntry();
ent.addProperty("enable", "true");
ent.addProperty("contactsOnly", "true");
ent.addProperty("domainOnly", "false");
ent.addProperty("subject", "Test");
ent.addProperty("message", "test");
ent.addProperty("startDate", "2011-08-23");
ent.addProperty("endDate", "2011-08-27");
ent.validate();
URL url = null;
try{
url = new
URL("https://apps-apis.google.com/a/feeds/emailsettings/2.0/XXXXXX.XXX/XXXXXX/XXXXXX");
}catch(Exception e){
e.printStackTrace();
System.out.println("new url threw exception");
}
try{
System.out.println("Sending entry");
serv.update(url, ent);
}catch(Exception e){
e.printStackTrace();
System.out.println("update threw exception");
}
}
public static void getVacation(){
GmailSettingsService serv = null;
try{
serv = new GmailSettingsService("your-apps", "XXXXXX.XXX",
"XXXXXX", "XXXXXX");
}catch(Exception e){
e.printStackTrace();
}
URL url = null;
try{
url = new URL("https://apps-apis.google.com/a/feeds
/emailsettings/2.0/XXXXXX.XXX/XXXXXX/XXXXXX");
}catch(Exception e){
e.printStackTrace();
}
GenericEntry entry = null;
try{
entry = serv.getEntry(url, GenericEntry.class);
}catch(Exception e){
e.printStackTrace();
}
Map map = entry.getAllProperties();
Iterator iterator = map.keySet().iterator();
System.out.println("Printing entry");
while (iterator.hasNext()) {
String key = iterator.next().toString();
String value = map.get(key).toString();
System.out.println(key + " : " + value);
}
}
}
Here is a screen clip of my output window:
<https://lh6.googleusercontent.com/-vf-AqIxg5m0/TlaNMb7KfgI/AAAAAAAAAAU/Cjr22wlvFrc/outputClip.PNG>
And here is a screen clip of the actual Gmail Settings page:
<https://lh4.googleusercontent.com/-v0POpPjTwyY/TlaOELAt3MI/AAAAAAAAAAg/CJRU8QGIorE/responderClip.PNG>
--
You received this message because you are subscribed to the Google Groups
"Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-apps-mgmt-apis/-/Kzt8ilYXpNYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.