Anirudth,

Awesome support, thank you so much. I guess is the first time I've
found something wrong with the Gdata APIs.

Thanks again,

David

On 17 dic, 08:20, "Anirudh (Google)" <[email protected]> wrote:
> Hi David,
>
> The possible cause for EntityDoesNotExistException could be a wrong
> value for the command line parameter 'destination_user' while running
> the sample.
> Lack of API access should give a
> 'com.google.gdata.util.ServiceForbiddenException' with the following
> message:
> You are not authorized to access this API.
>
> Also, I tested the Email Settings Java client library and was able to
> reproduce the missing new lines problem. It is happening due the new
> line characters is not being HTML encoded to &#xA; by the client
> library.
>
> As a workaround, you can use the following code to update the
> signature using Java which is based on the raw XML 
> format:http://code.google.com/apis/apps/email_settings/developers_guide_prot...
>
> public void setSignature(String user, String domain, String authToken)
> {
>     HttpsURLConnection connection = (HttpsURLConnection) new URL(
>         "https://apps-apis.google.com/a/feeds/user/2.0/"; + domain +
> "/" + "user" + "/email/settings/signature")
>         .openConnection();
>     connection.setRequestMethod("PUT");
>     connection.setFollowRedirects(true);
>     connection.setRequestProperty("Authorization", "GoogleLogin auth="
> + authToken);
>     connection.setDoInput(true);
>     String encodedString = encodeHTML("java \n again");
>     connection.setDoOutput(true);
>     String request = "<?xml version=\"1.0\" encoding=\"utf-8\"?><atom:entry 
> xmlns:atom='http://www.w3.org/2005/Atom'
>
> xmlns:apps='http://schemas.google.com/apps/2006'>"
>         + "<apps:property name='signature' value='"
>         + encodedString
>         + "'/>"
>         + "</atom:entry>";
>     connection.setInstanceFollowRedirects(true);
>     String responseString = null;
>     connection.setRequestProperty("Content-Type", "application/atom
> +xml");
>     OutputStream ost = connection.getOutputStream();
>     DataOutputStream out = new DataOutputStream(ost);
>     out.writeBytes(request);
>     out.flush();
>     BufferedReader reader = new BufferedReader(new InputStreamReader
> (connection
>         .getInputStream()));
>     while ((responseString = reader.readLine()) != null)
>       System.out.println(responseString);
>     reader.close();
>     } catch (IOException io) {
>     io.printStackTrace();
>     }
>
> public String encodeHTML(String s) {
>     StringBuffer buf = new StringBuffer();
>     int len = (s == null ? -1 : s.length());
>
>     for (int i = 0; i < len; i++) {
>     char c = s.charAt(i);
>     if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c
> <= '9') {
>     buf.append(c);
>     } else {
>     buf.append("&#" + (int) c + ";");
>     }
>     }
>     return buf.toString();
>   }
>
> This is only a temporary measure until we fix the parsing code in the
> client library.
> Thanks for your patience and feedback.
>
> -Anirudh
>
> On Dec 15, 8:58 am, David Cifuentes <[email protected]>
> wrote:
>
> > I realized that for the Email Settings API to work the Provisioning
> > API checkbox in the admin panel has to be activated (it's not
> > documented anywhere). Anyway, it looks like there is a bug in the CLI
> > client only. I rectify, the GUI client works perfect.
>
> > I still have an issue, when I try to update a signature of multiples
> > lines it puts everything in one line when I checked in Gmail. I tried
> > using HTML breaks and doesn't work. Any help would be greatly
> > appreciated.
>
> > Thanks,
>
> > David Cifuentes
> > Eforcers.com
> > Bogotá, Colombia
>
> > On 13 dic, 12:26, David Cifuentes <[email protected]>
> > wrote:
>
> > > Hello,
> > > I'm trying to run the sample code in java gdata-samples 1.27 and both
> > > the Email Settings examples throw EntityDoesNotExistException, I tryed
> > > in different domains and users and the same problem persists. I
> > > activated all the API's in the admin panel.
>
> > > Thanks,
>
> > > David Cifuentes
> > > Eforcers.com
> > > Bogotá, Colombia
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Apps APIs" group.
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-apis?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to