Workflow Soluiton

 View Only
  • 1.  How to save an Outlook attachment to a particular path with a WF component

    Posted Jan 26, 2012 05:50 AM

    Hello,

    Using Workflow 7.1, I need  to copy a file attached to a Outlook mail (Outlook 2007 / Windows 7) to a disk folder to further treatment.

    Can someone help me to find the right WF component, my knowledge of the product being for the moment very limited.

    Thanks 



  • 2.  RE: How to save an Outlook attachment to a particular path with a WF component
    Best Answer

    Posted Jan 26, 2012 07:10 AM

    Write File is the component that will write a FileDataType on your stream to a file on the file system.

    There's components in the LogicBase.Components.Email library to read mail (it's not loaded by default). There should be a GetComponent for POP and a GetComponent for IMAP. The result of these components are EmailDataTypes. Each EmailDataType contains an array of FileDataTypes called Attachments.

    You can get the email messages, loop through each message, then loop through the attchments of each message and write to the file system.



  • 3.  RE: How to save an Outlook attachment to a particular path with a WF component

    Posted Jan 26, 2012 10:16 AM

    In the debugger, it will work fine. When you move it to production, it will likely fail at the write file component. The reason is the file will be written using the credentials of the IIS application pool. Typically, this is a local service account that does NOT have any permissions to write files to a network share or to a local folder unless you explicitly give it permisssions.

    For a local folder on the WF server you can simply grant the account permissions to the local folder.

    For wiritng to a network share, I created an application pool with a named domain account that has permissions to the location and assisgned that App pool to the IIS virtual application.

     

    Rob



  • 4.  RE: How to save an Outlook attachment to a particular path with a WF component

    Posted Jan 26, 2012 10:31 AM

    Thanks Reecardo but it remains more or less "obscure".

    I can find components prefixed by Pop3 or Imap4 (Get, List , Mark, ...)

    Is it in this way I have to investigate ?

    Couldn't you show me an example ? 



  • 5.  RE: How to save an Outlook attachment to a particular path with a WF component

    Posted Jan 26, 2012 12:05 PM

    OK Attached is a screenshot of what this looks like:

    1. For the IMAP Get Component, I just made the output "Emails"

    2. For the Loop Through Emails, I specified Emails as the collection (it's type is EmailDataType, found in the Email library). I specified the indexer var as "e"

    3. For the Loop Through Attachments of Email, I specified e.Attachments as the collection (it's type is FileDataType). I specified the indexer var as "a"

    4. For the Write File comp, use "a" as the File Variable Name. Now the tricky part: you'lll have to build some Output path that's unique to each attachment so you don't overwrite the same file over and over. You can build a path beforehand, or use a Dynamic Model to build a name.

    Hope this helps.

    You might be able to get around this by using one For Each Item in Collection comp as well. You can use FileDataType as the type, and specify Emails.*.Attachments as the collection. Either way should work.



  • 6.  RE: How to save an Outlook attachment to a particular path with a WF component

    Posted Jan 26, 2012 12:13 PM

    For the "Loop Through Attachments of Email" component, shouldn't the "Finished" path route back to the "Loop Through Emails" component? Otherwise, you'll only be processing the attachments for the first email in the collection.



  • 7.  RE: How to save an Outlook attachment to a particular path with a WF component

    Posted Jan 27, 2012 10:08 AM

    You're absolutely right... what you get when you drag comps in a hurry. This is what it should look like


     



  • 8.  RE: How to save an Outlook attachment to a particular path with a WF component

    Posted Jan 30, 2012 09:25 AM

    Hi Reecardo,

     

    I'm progressing into this solution but I've a problem with the IMAP Get component Output tab: I don't see what you mean by << I just made the output "Emails">>.

     

    Is it simply Emails in the fileld Result Variable Name ?



  • 9.  RE: How to save an Outlook attachment to a particular path with a WF component

    Posted Jan 30, 2012 01:20 PM

    Basically I named the output Emails (it may do this by default, I can't recall). What you have up there in the window at the bottom (Result Variable Name is Emails) is correct.