Jump to content

Welcome! You're currently a Guest.

If you'd like to join in the Discussion, or access additional features in our forums, please sign in with your Evernote Account here. Have an Evernote Account but forgot your password? Reset it! Don't have an account yet? Create One! You'll need to set your Display Name before your first post.

maker

Member Since 29 Feb 2012
Offline Last Active Sep 13 2012 09:35 AM
-----

Topics I've Started

about resources with same hash

01 July 2012 - 02:33 PM

What i have done is
1. create a note "mm" on web client, attach a file "a.abc".
2. copy "a.abc" to "b.abc"
3. edit note "mm", attach "b.abc"
4. what i get is not "a.abc" and "b.abc" in note "mm", but 2 "b.abc".

This happened also if i use Android API to do the same thing.

What can i do to save two file with same content in a note?

Can I get the Guid of my inserted resource?

14 March 2012 - 09:52 AM

after adding resource and update by using:

Note note = getNoteStore().getNote(getAuthToken(), noteGuid , true, false, false, false);
note.addToResources(resource);
getNoteStore().updateNote(getAuthToken(), note);

how can i get the Guid of the added resource?

Problem about adding Resource to Note

29 February 2012 - 04:39 PM

Hello, I use following code to add a file to Note as attachment. After that I can see the resource on my own app, but not in Web. And the file is not correct if I download it. Can someone help?


File file = new File(f);
// Hash the data in the image file. The hash is used to reference the
// file in the ENML note content.
InputStream in = new BufferedInputStream(new FileInputStream(f));
FileData data = new FileData(EDAMUtil.hash(in), new File(f));
in.close();

// Create a new Resource
Resource resource = new Resource();
resource.setData(data);
resource.setMime(this.mimeType);
ResourceAttributes attributes = new ResourceAttributes();
attributes.setFileName(file.getName());
attributes.setAttachment(true);
resource.setAttributes(attributes);


Note note = getNoteStore().getNote(getAuthToken(), noteGuid , true, false, false, false);
note.addToResources(resource);
String content = note.getContent();
content.replace(NOTE_SUFFIX, "");
content += "<div><en-media type=\"" + this.mimeType + "\" hash=\"" +
EDAMUtil.bytesToHex(resource.getData().getBodyHash()) + "\"/></div>" +
NOTE_SUFFIX;

getNoteStore().updateNote(getAuthToken(), note);