access addresses from external?
-
Hi @shcshc ,
there is no ready made solution (or api or interface) for this. Your best choice to achieve what you are searching for is implementing this in python-kopano.
-
thank you. it works! great thing
-
how can i get the photo from contact item?
-
Hi @shcshc ,
there is currently no builtin way to easily get the associated picture of a contact. I’ve spoken to one of the developers and he added to his todo list to investigate this a bit.
Edit:
I got the following example from the developer:
from MAPI.Tags import PR_ATTACHMENT_CONTACTPHOTO import kopano for item in kopano.user('user1').contacts: print item for att in item.attachments(): if att.get_value(PR_ATTACHMENT_CONTACTPHOTO): print 'CONTACTPHOTO:', att, repr(att.data)[:256]
He also adds:
unfortunately it’s a bit of a hassle to get out all the properties, so something like item.vcf() might be easier, although I’m not sure how complete that is (for example, does it include the contactphoto, no idea)
Have you already looked at the vcf exporter? what is your current approach, are you reading out individual properties and writing them over in mysql/ldap?
Edit2:
just in case you are not aware of it already:
for prop in item: print prop, prop.value
dumps all the properties of a given item. this will give you probably a lot of stuff you don’t need, but gives you an easy overview of all the available properties.
-
thank you very mutch.
can you tell me how i can insert “repr(att.data)[:256]” to mysql blob filed?i know its mysql…
-
i need att.data in binär variable for
INSERT INTO Adressen (Bild) VALUES (att.data) -
now i use LOAD_FILE(File) in mysql to load image to mysql.
but the data in File is not OK. how can i save the data to file in right format? -
i save the picture like this:
prop_PR_HASATTACH=item.get_value(PR_HASATTACH)
if prop_PR_HASATTACH == True:
for att in item.attachments():
if att.get_value(PR_ATTACHMENT_CONTACTPHOTO):
prop_contact_picture=att.data
with open("/tmp/bild.jpg", “wb”) as mypicklefile:
pickle.dump(prop_contact_picture, mypicklefile)but the file data is not bin:
S'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x00\x00\x01\x00\x01\x00\x00\xff\xdb\x00C\x00\x02\x01\x01\x01\x01\x01\x02\x01\x01\x01\x02\x02\x02\x02\x02\x04\x03\x02\x02\x02\x02\x05\x04\x04\x03\x04\x06\x05\x06\x06\x06\x05\x06\x06\x06\x07\t\x08\x06\x07\t\x07\x06\x06\x08\x0b\x08\t\n\n\n\n\n\x06\x08\x0b\x0c\x0b\n\x0c\t\n\n\n\xff\xdb\x00C\x01\x02\x02\x02\x02\x02\x02\x05\x03\x03\x05\n\x07\x06\x07\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\xff\xc0\x00\x11\x08\x00`\x00M\x03\x01"\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1e\x00\x00\x01\x04\x02\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x01\x03\x06\x07\x02\t\x00\x04\x05\n\xff\xc4\x00?\x10\x00\x01\x02\x04\x03\x05\x04\x07\x05\x07\x05\x01\x00\x00\x00\x00\x02\x03\x04\x00\x05\x06\x12\x01\x07"\x08\x11\x132B\x14Rb\x92\t\x15!#3r\x82\x16$1A\x81\x17%C\xa2\xc2\xd2\xe2Qac\x83\xb2\xf0\xff\xc4\x00\x1b\x01\x00\x02\x02\x03\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x06\x03\x04\x00\x01\x07\x02\xff\xc4\x00.\x11\x00\x01\x04\x00\x04\x04\x05\x02\x07\x00\x00\x00\x00\x00\x00\x00\x02\x00\x01\x03\x04\x05\x11\x12!\x13"12\x06ABq\xa1\x15a\x16Q\x91\xb1\xd1\xf0\xf1\xff\xda\x00\x0c\x03\x01\x00\x02\x11\x03\x11\x00?\x00\xdba\x7f\xa2\x800\xa3\xa4\xb5\xea\x87\x04LH\xb7\xf4\xc6i\xa7\x81\x16\xb0\xdf\xa3\xaa$\x11V\x13"\'\x88\x96\xeeQ\x845\x11\x11,1\xf6\x07YC\x13\xc9\xc4\x9e\x9a\x92\xba\xa8g\xcf\xd1h\xc1\x8bU\x1c<t\xb1Z\t\xa6\x98\x91\x11\x11t\x88\x8e\xa8\xd4n\xde>\x99\x8c\xc5\xcd\xca\x96e\x94[0"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5N\x1f0#T\xf1I\'\x94b\x97\xf5]-\xb5\xa4kU\x9bf2s2\xd6\xdeOL\x88$\x89j\x12X\x94X\xbf\xa8a\x99Nj=\xa4f\xc8\xb3\xcb\xdc\xc5RSRH\xc8\x97\xe0\xcaf\xc4\x83\xa4Q-E\xcaW\x08\xeaO\xcd\x1e\x0emW\xd5UMW\x9c\xec\x1e"\xe2\xa0xd\xbc\xd1\xe0\xa5q7\x12\xb7\x82\xdcG\x96\xe1\x1dE\xcd\xf1-\xe9\xd3LM2s2\xd4\xcc\xa0\xcd\x19%E\xfb\xd9ED\xdc(\xeb\xe1\xad\xd3iwF\xdd6\xdbov,C\x0b\xf05:\xa1\x88O\x9d\x87\xd0\x8d\x86>\x95M\xba\xa9\x16\xe8?\xa7\xb3=\x19\xafco\xefe\xb3\xc9J.E\xe5\xa3p\xfb\xcbEK\xad\x12\xfe&\xa8!\xf2\x8b\xd3\xcf\x97\x95\x0e_J\xe69\xa7\x97\x02\xcan\xa3$\xc9\xd1K\xa6\xa2\x9a\n)\xba\xd3\xc0\x05l1!\xc3\x02\x1cp\xb6\xe2\xdd\xbf~\xff\x00l\x00\xf2\xd9+\xc5\x17\x06\xcf\x11\x14T\xe1\n\xa7o.\xadD>h\x8eH\xb2\x89\xdbe\x9e\xa0\xcay\x8bd\x8d\xd9,\x90$[\xf0\xc0K\xf2\xfd\x08K\x1f\xd6&\x8c\xa5\x1e\x84\xa9\x941\x1fp\xaf\xff\xd9' p0 .
-
i have it:
with open("/tmp/bild.jpg", “wb”) as mypicklefile:
mypicklefile.write(prop_contact_picture)works fine
-
Hi @shcshc ,
great to hear that you found a solution. I’ve seen your updates along the way, but did not have any time yet to really thing about possible solutions.
Edit: in case you decide to make your project publicly available you could also add a link to it to https://stash.z-hub.io/projects/COM/repos/projects-and-resources/browse, so that other can more easily find it.