powershell - Finding a CID reference for attachments in Exchange Contacts -


i'm crafting powershell program using ews that:

  • recover data backup contact folder (telephone, url, notes field,...)
  • set values in default contact folder in new contact

everything work except, of course, attachents added notes fields, still i'm able download them.

        foreach ($attch in $item.attachments)         {             $downloaddirectory = ".\attachments"             $attch.load()             $fifile = new-object system.io.filestream(($downloaddirectory + “\” + $attch.name.tostring()), [system.io.filemode]::create)             $fifile.write($attch.content, 0, $attch.content.length)             $fifile.close()             write-host "downloaded attachment : " + (($downloaddirectory + “\” + $attch.name.tostring()))           } 

or upload them. (it's static here test purpose)

$att = $item.attachments.addfileattachment("c:\scripts\myscript\attachments\powershell_transcript.20140506143510.txt") $att.contentid = 'test' $att.isinline=$false 

ideally, looking matching cid references , uplading attachments using same one.

    <div><font face="calibri" size="2"><span style="font-size:11pt;"> <img src="cid:0df540471453b832e300400ff03b0900cfec1201@1">      <a href="cid:74d8eea6180ad131b48dc59373fabbabd7e361bb@1">somedoc.docx</a>     </span></font></div> 

of course, when object retrieved exchange, doesn't have contentid (i have guess should cid value).

<objs version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04">   <obj refid="0">     <tn refid="0">       <t>microsoft.exchange.webservices.data.fileattachment</t>       <t>microsoft.exchange.webservices.data.attachment</t>       <t>microsoft.exchange.webservices.data.complexproperty</t>       <t>system.object</t>     </tn>     <tostring>microsoft.exchange.webservices.data.fileattachment</tostring>     <props>       <nil n="filename" />       <ba n="content"></ba>       <b n="iscontactphoto">false</b>       <s n="id">aamkaddmmdbkotk4ltnlyzmtndk1ms05ztdhlwjmoge.....</s>       <s n="name">somedoc.docx</s>       <s n="contenttype">application/vnd.openxmlformats-officedocument.wordprocessingml.document</s>       <nil n="contentid" /> <=== value :'(       <nil n="contentlocation" />       <i32 n="size">1764632</i32>       <dt n="lastmodifiedtime">2016-01-26t15:08:03+00:00</dt>       <b n="isinline">false</b>     </props>   </obj> </objs> 

does know way retrieve value ?

  • server/mailbox: exchange 2013 sp1

thank !

it doesn't have contentid (i have guess should cid value).

an attachment have cid if on inline attachment in mime message https://www.ietf.org/rfc/rfc2111.txt in contact never valid (eg contact picture doesn't have cid) dealing exchange data type.

cheers glen


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -