Hi Lukas
Thanks for the response. I followed your tips but It didn't work here is my code :
TSyError res = this->ui.GetValueByID(this,
                                aItemKey,
                                  valueId,                                 
                                idx,
                                sysync::VALTYPE_BUF,
                                NULL,
                                0,
                                &valsize
                                );
 if(!res && valsize){
                                data = SharedBuffer(new char[valsize*1024*1024 + 1], valsize);
                                data[valsize] = 0;
                                res = this->ui.GetValueByID(this,
                                                                 aItemKey,
                                                                 valueId,
                                                                 idx,
                                                                 sysync::VALTYPE_BUF,
                                                                 data.get(),
                                                                 valsize + 1,
                                                                 &valsize
                                                                 );
}


I ve got size = 2759 but i always extract 4 bytes.
Can you help me please?
Thank you in advance
Regards

2011/9/22 Lukas Zeller <luz@plan44.ch>
Hello Roger,

On Sep 22, 2011, at 16:25 , Roger KeIrad wrote:

> Hello,
> It is me again.
> I have some troubles with PHOTO for synchronised contact.
> I used the same idea to extract encoded value to decode it.
> I tried with GetValue and  GetValueByID but no chance.

Both should work (the PHOTO is not an array field).

Just pass VALTYPE_BUF as type, and provide a buffer large enough to get the binary photo data.

To find out in advance how large the buffer needs to be, just call GetValue once with a NULL pointer as buffer or zero buffer size. This will return the needed size in the aValSize parameter, which you can use to allocate a buffer large enough to get the entire PHOTO.

If you pass a buffer that is too small for the entire PHOTO data, you'll get LOCERR_TRUNCATED status.

The data you get is binary data, usually a JPG. If you save the data 1:1 into a file, any image viewer program should be able to show it.

Best Regards,

Lukas


Lukas Zeller, plan44.ch
luz@plan44.ch - www.plan44.ch