How to use MSOutlook 2013 in Pres Workflow?

I wanted to use email from MSOutlook as input but i ran to error saying that there were no default MSOutlook profile found.

Here is the error show:


WPROC: Process1 (thread id: 4868) - 01:03:10

INFO : Retrieve MS Outlook email
ERROR: W3030 : Could not log into Microsoft Outlook session: W3028 : No default Microsoft Outlook profile found.
ERROR: Email Input: W1603 : Plugin failed - 01:03:10 (elapsed time: 00:00:00:073)

WPROC: Process1 (thread id: 4868) complete - 01:03:10 (elapsed time: 00:00:00:075)


Could someone help me on how to setting up MSOutlook to be use in workflow.

Thank you.

AFAIK, Outlook 2013 is currently unsupported in Workflow 8 but here’s a script that uses Outlook’s API directly. This script works correctly with Outlook 2010 so it probably works on 2013 too. There’s probably some minor changes you need to do like the directory path and the usernames.

Set myOlApp     = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNameSpace("MAPI")
Set MyMessages  = myNameSpace.GetDefaultFolder(6).Items

Set fso = CreateObject("Scripting.FileSystemObject")

Set myMessage = myMessages.GetFirst()

Do while not myMessage is Nothing
  Watch.Log "To: "+MyMessage.To,2
  Watch.Log "Subject: "+MyMessage.Subject,2
  Watch.Log "Sender name: "+MyMessage.SenderName,2
  Watch.Log "Sender address: "+MyMessage.SenderEmailAddress,2
  'if To contains "" and Sender email address contains "" and message has attachment then
  If InStr(MyMessage.to, user_name_as_seen_in_outlook_client_doublequoted) > 0 And InStr(MyMessage.SenderEmailAddress, user_name_before_the_@_in_the_email) > 0 And MyMessage.Attachments.count > 0 then
    For i=1 to MyMessage.Attachments.count
      Watch.Log "Save attachment: "+MyMessage.Attachments(i).DisplayName,3
      ' copy the attachments to a transit folder (be sure to not replace an existing one
      MyMessage.Attachments(i).SaveAsFile "C:\Out\" & MyMessage.Attachments(i).DisplayName
      ' or, if there is only one attachment, it can replace the jobfile
      fso.DeleteFile Watch.GetJobFileName
      fso.MoveFile "C:\Out\" & MyMessage.Attachments(i).DisplayName,Watch.GetJobFileName
      ' move file in Delete folder
      MyMessage.Attachments(i).Delete
      exit do 'exit to process one success email at the time (when using attachment as new jobfile)
    Next
  end if
  Set myMessage = myMessages.getNext()
Loop

Thank you so much for your reply.

I’ll try to use the script.

Thank you.

Hi BeaudoinD,

The codes able to connect with MSOutlook but

Could you help me specify this line :

If InStr(MyMessage.to, user_name_as_seen_in_outlook_client_doublequoted) > 0 And InStr(MyMessage.SenderEmailAddress, user_name_before_the_@_in_the_email)

What exactly i should put in the "user_name_as_seen_in_outlook_client_doublequoted"?

i have an email account called ex: Admin@OLMAIL.com

Here what i put in my code :

If InStr(MyMessage.to, “Admin”) > 0 And InStr(MyMessage.SenderEmailAddress, Admin) > 0

Correct me if i’m wrong and really appreciate your help.

Thank you

That would be the name as it’s shown when you receive an email. For example in my case, the first parameter would be “Dave” and the second would be “BeaudoinD”. I think it does not have to be the full name, only a string that is to be found in the mailbox’s name. Yours may be simply “Admin” so you could try with that.