<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Outlook rule to save attachments to a web directory</title>
	<atom:link href="http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/feed/" rel="self" type="application/rss+xml" />
	<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/</link>
	<description>Design.  Develop.  Defy.</description>
	<lastBuildDate>Thu, 02 Feb 2012 19:32:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: DavidA</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-369</link>
		<dc:creator>DavidA</dc:creator>
		<pubDate>Thu, 02 Feb 2012 19:32:39 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-369</guid>
		<description>Thanks for sharing. I am using this to file my receipts: I want to take a picture from my phone and send it to myself. I had to edit the folder location where I wanted my attachments saved as well as the attachment extension. It is working great.</description>
		<content:encoded><![CDATA[<p>Thanks for sharing. I am using this to file my receipts: I want to take a picture from my phone and send it to myself. I had to edit the folder location where I wanted my attachments saved as well as the attachment extension. It is working great.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-367</link>
		<dc:creator>David</dc:creator>
		<pubDate>Sun, 22 Jan 2012 21:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-367</guid>
		<description>This isn&#039;t working for me. The rule is moving the emails to a folder, but it isn&#039;t saving the attachments. The first time I manually ran the rule it asked for permission to run the script due to security, and I allowed it. This is the line I have edited in the code. It&#039;s a valid path. Nothing is being saved to disk.
strRootFolderPath = &quot;e:\backup\&quot;</description>
		<content:encoded><![CDATA[<p>This isn&#8217;t working for me. The rule is moving the emails to a folder, but it isn&#8217;t saving the attachments. The first time I manually ran the rule it asked for permission to run the script due to security, and I allowed it. This is the line I have edited in the code. It&#8217;s a valid path. Nothing is being saved to disk.<br />
strRootFolderPath = &#8220;e:\backup\&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Smith</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-352</link>
		<dc:creator>Scott Smith</dc:creator>
		<pubDate>Mon, 27 Jun 2011 04:01:02 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-352</guid>
		<description>This code was exactly waht I was looking for.  However I want to add one thing.   How do I run a an mdb file after I have this code save a txt file?

I am going to use this to save incoming text files, but I need to run an mdb file to add them to my database.

Scott</description>
		<content:encoded><![CDATA[<p>This code was exactly waht I was looking for.  However I want to add one thing.   How do I run a an mdb file after I have this code save a txt file?</p>
<p>I am going to use this to save incoming text files, but I need to run an mdb file to add them to my database.</p>
<p>Scott</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thantos</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-340</link>
		<dc:creator>Thantos</dc:creator>
		<pubDate>Sat, 09 Apr 2011 22:07:03 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-340</guid>
		<description>This definitely sounds doable.  You should be able to embed the code that you supplied into my code.  The hard part is parsing the PDF file and saving each page as part of the TIFF, though, and then saving everything in the designated directory.  Here is my attached code; I merged the two code snippets together, but PLEASE NOTE that I have not tested it.  I am sure that it will need some tweaking, but it will hopefully point you in the right direction.  Once I get a bit more free time (my apologies, as I am swamped now), I will see if I can get this working 100%.


&lt;blockquote&gt;Sub SaveAttachmentsToDisk(Item As Outlook.MailItem)
Dim olkFolder As Outlook.MAPIFolder, _
olkAttachment As Outlook.Attachment, _
objFSO As Object, _
strRootFolderPath As String, _
strFilename As String, _
intCount As Integer
Dim noAppend As TiffEncoder = New TiffEncoder(TiffCompression.Default, True)
Dim pdf As PdfDecoder = New PdfDecoder(XXX)
Dim i As Integer=0
&#039;Change the following path to match your environment
strRootFolderPath = &quot;z:\www\departments\webreports\&quot;
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set olkFolder = Application.ActiveExplorer.CurrentFolder
If Item.Attachments.Count &gt; 0 Then
For Each olkAttachment In Item.Attachments
If objFSO.GetExtensionName(LCase(olkAttachment.FileName)) = &quot;pdf&quot; Then
strFilename = olkAttachment.FileName

&#039;Begin conversion of PDF to TIFF
Do While i&lt; numPages
	Dim img As AtalaImage = pdfDecoder.Read(strFilename,i,Nothing)
	noAppend.Save(outStream, img, Nothing)
	img.Dispose(XXX)
	outStream.Seek(0, SeekOrigin.Begin)
	i += 1
Loop		
intCount = 0
Do While True
If objFSO.FileExists(strRootFolderPath &amp; strFilename) Then
intCount = intCount + 1
objFSO.deletefile (strRootFolderPath &amp; strFilename)
Else
Exit Do
End If
Loop
&#039;Save TIFF
img.SaveAsFile strRootFolderPath &amp; strFilename
olkAttachment.SaveAsFile strRootFolderPath &amp; strFilename
End If
Next
End If
Set objFSO = Nothing
Set olkAttachment = Nothing
Set olkFolder = Nothing
End Sub&lt;/blockquote&gt;

</description>
		<content:encoded><![CDATA[<p>This definitely sounds doable.  You should be able to embed the code that you supplied into my code.  The hard part is parsing the PDF file and saving each page as part of the TIFF, though, and then saving everything in the designated directory.  Here is my attached code; I merged the two code snippets together, but PLEASE NOTE that I have not tested it.  I am sure that it will need some tweaking, but it will hopefully point you in the right direction.  Once I get a bit more free time (my apologies, as I am swamped now), I will see if I can get this working 100%.</p>
<blockquote><p>Sub SaveAttachmentsToDisk(Item As Outlook.MailItem)<br />
Dim olkFolder As Outlook.MAPIFolder, _<br />
olkAttachment As Outlook.Attachment, _<br />
objFSO As Object, _<br />
strRootFolderPath As String, _<br />
strFilename As String, _<br />
intCount As Integer<br />
Dim noAppend As TiffEncoder = New TiffEncoder(TiffCompression.Default, True)<br />
Dim pdf As PdfDecoder = New PdfDecoder(XXX)<br />
Dim i As Integer=0<br />
&#8216;Change the following path to match your environment<br />
strRootFolderPath = &#8220;z:\www\departments\webreports\&#8221;<br />
Set objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
Set olkFolder = Application.ActiveExplorer.CurrentFolder<br />
If Item.Attachments.Count > 0 Then<br />
For Each olkAttachment In Item.Attachments<br />
If objFSO.GetExtensionName(LCase(olkAttachment.FileName)) = &#8220;pdf&#8221; Then<br />
strFilename = olkAttachment.FileName</p>
<p>&#8216;Begin conversion of PDF to TIFF<br />
Do While i< numPages<br />
	Dim img As AtalaImage = pdfDecoder.Read(strFilename,i,Nothing)<br />
	noAppend.Save(outStream, img, Nothing)<br />
	img.Dispose(XXX)<br />
	outStream.Seek(0, SeekOrigin.Begin)<br />
	i += 1<br />
Loop<br />
intCount = 0<br />
Do While True<br />
If objFSO.FileExists(strRootFolderPath &#038; strFilename) Then<br />
intCount = intCount + 1<br />
objFSO.deletefile (strRootFolderPath &#038; strFilename)<br />
Else<br />
Exit Do<br />
End If<br />
Loop<br />
'Save TIFF<br />
img.SaveAsFile strRootFolderPath &#038; strFilename<br />
olkAttachment.SaveAsFile strRootFolderPath &#038; strFilename<br />
End If<br />
Next<br />
End If<br />
Set objFSO = Nothing<br />
Set olkAttachment = Nothing<br />
Set olkFolder = Nothing<br />
End Sub</p></blockquote>
</blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sue</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-332</link>
		<dc:creator>Sue</dc:creator>
		<pubDate>Wed, 23 Mar 2011 18:18:42 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-332</guid>
		<description>I am using your code above to save PDF attachments to folder.  My goal however is to extract PDF attachments from e-mail, convert them to multi-page TIFF image before saving to a folder.  Would it be possible to combine this code with yours to attain my goal? http://www.ehow.com/how_7645423_convert-pdf-tiff-vbnet.html</description>
		<content:encoded><![CDATA[<p>I am using your code above to save PDF attachments to folder.  My goal however is to extract PDF attachments from e-mail, convert them to multi-page TIFF image before saving to a folder.  Would it be possible to combine this code with yours to attain my goal? <a href="http://www.ehow.com/how_7645423_convert-pdf-tiff-vbnet.html" rel="nofollow">http://www.ehow.com/how_7645423_convert-pdf-tiff-vbnet.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thantos</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-321</link>
		<dc:creator>Thantos</dc:creator>
		<pubDate>Thu, 10 Feb 2011 19:38:07 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-321</guid>
		<description>ben,
Try changing this line:

If objFSO.GetExtensionName(LCase(olkAttachment.FileName)) = &quot;htm&quot; Then


to:

If objFSO.GetExtensionName(LCase(olkAttachment.FileName)) = &quot;pdf&quot; Then

What did we change?  The &quot;htm&quot; attachment specification to &quot;pdf&quot;</description>
		<content:encoded><![CDATA[<p>ben,<br />
Try changing this line:</p>
<p>If objFSO.GetExtensionName(LCase(olkAttachment.FileName)) = &#8220;htm&#8221; Then</p>
<p>to:</p>
<p>If objFSO.GetExtensionName(LCase(olkAttachment.FileName)) = &#8220;pdf&#8221; Then</p>
<p>What did we change?  The &#8220;htm&#8221; attachment specification to &#8220;pdf&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ben</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-266</link>
		<dc:creator>ben</dc:creator>
		<pubDate>Thu, 13 Jan 2011 18:50:31 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-266</guid>
		<description>I want to move emails with only PDF attachments to a folder.  Does anyone know if it is possible to specify which type of attachments triggers a rule?</description>
		<content:encoded><![CDATA[<p>I want to move emails with only PDF attachments to a folder.  Does anyone know if it is possible to specify which type of attachments triggers a rule?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reta</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-223</link>
		<dc:creator>Reta</dc:creator>
		<pubDate>Mon, 27 Dec 2010 17:00:03 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-223</guid>
		<description>I figured it out! I modified two lines for my purposes: 

If objFSO.GetExtensionName(LCase(olkAttachment.FileName)) = &quot;pdf&quot; Then

‘This line creates the filename from the email subject and adds the current date
strFilename = Item.Subject &amp; &quot; &quot; &amp; Format(CDate(Now), &quot;yyyy_MM_dd&quot;) &amp; &quot;.pdf&quot;</description>
		<content:encoded><![CDATA[<p>I figured it out! I modified two lines for my purposes: </p>
<p>If objFSO.GetExtensionName(LCase(olkAttachment.FileName)) = &#8220;pdf&#8221; Then</p>
<p>‘This line creates the filename from the email subject and adds the current date<br />
strFilename = Item.Subject &amp; &#8221; &#8221; &amp; Format(CDate(Now), &#8220;yyyy_MM_dd&#8221;) &amp; &#8220;.pdf&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reta</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-212</link>
		<dc:creator>Reta</dc:creator>
		<pubDate>Wed, 22 Dec 2010 17:37:17 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-212</guid>
		<description>This works perfectly! It would be even MORE perfect if it could be possible to have the attachment saved with another filename - something more meaningful than, say, 0979_001.pdf. Specifically, could the filename be compiled from the subject line and the date of the email?</description>
		<content:encoded><![CDATA[<p>This works perfectly! It would be even MORE perfect if it could be possible to have the attachment saved with another filename &#8211; something more meaningful than, say, 0979_001.pdf. Specifically, could the filename be compiled from the subject line and the date of the email?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mister M</title>
		<link>http://lightyeardesign.com/2009/04/outlook-rule-to-extract-attachments-to-a-web-directory/comment-page-1/#comment-205</link>
		<dc:creator>Mister M</dc:creator>
		<pubDate>Fri, 17 Dec 2010 13:55:42 +0000</pubDate>
		<guid isPermaLink="false">http://lightyeardesign.com/?p=13#comment-205</guid>
		<description>abhay, can you post the code that you are using?</description>
		<content:encoded><![CDATA[<p>abhay, can you post the code that you are using?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

