Skip to content

Commit 290aa85

Browse files
committed
Added Mailitem Lists to BeginListLoop
1 parent cbe2249 commit 290aa85

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

taskt/Core/Automation/Commands/BeginListLoopCommand.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Windows.Forms;
77
using taskt.UI.Forms;
88
using taskt.UI.CustomControls;
9+
using Microsoft.Office.Interop.Outlook;
910

1011
namespace taskt.Core.Automation.Commands
1112
{
@@ -59,7 +60,7 @@ public override void RunCommand(object sender, Core.Script.ScriptAction parentCo
5960
//if still null then throw exception
6061
if (complexVariable == null)
6162
{
62-
throw new Exception("Complex Variable '" + v_LoopParameter + "' or '" + v_LoopParameter.ApplyVariableFormatting() + "' not found. Ensure the variable exists before attempting to modify it.");
63+
throw new System.Exception("Complex Variable '" + v_LoopParameter + "' or '" + v_LoopParameter.ApplyVariableFormatting() + "' not found. Ensure the variable exists before attempting to modify it.");
6364
}
6465

6566
dynamic listToLoop;
@@ -75,6 +76,10 @@ public override void RunCommand(object sender, Core.Script.ScriptAction parentCo
7576
{
7677
listToLoop = ((DataTable)complexVariable.VariableValue).Rows;
7778
}
79+
else if (complexVariable.VariableValue is List<MailItem>)
80+
{
81+
listToLoop = (List<MailItem>)complexVariable.VariableValue;
82+
}
7883
else if ((complexVariable.VariableValue.ToString().StartsWith("[")) && (complexVariable.VariableValue.ToString().EndsWith("]")) && (complexVariable.VariableValue.ToString().Contains(",")))
7984
{
8085
//automatically handle if user has given a json array
@@ -92,7 +97,7 @@ public override void RunCommand(object sender, Core.Script.ScriptAction parentCo
9297
}
9398
else
9499
{
95-
throw new Exception("Complex Variable List Type<T> Not Supported");
100+
throw new System.Exception("Complex Variable List Type<T> Not Supported");
96101
}
97102

98103

taskt/Core/Automation/Commands/GetDictionaryValueCommand.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public override List<Control> Render(frmCommandEditor editor)
102102

103103
public override string GetDisplayValue()
104104
{
105-
return base.GetDisplayValue();
105+
return base.GetDisplayValue() + $" [From: {v_InputData}, Get: {v_Key}, Store In: {v_OutputVariable}]";
106106
}
107107
}
108108
}

taskt/Core/Automation/Commands/OutlookGetEmailsCommand.cs

+9-5
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,17 @@ private void ProcessEmail(MailItem mail, string msgDirectory, string attDirector
158158
{
159159
mail.UnRead = false;
160160
}
161-
if (v_SaveMessagesAndAttachments == "Yes" && System.IO.Directory.Exists(msgDirectory) && System.IO.Directory.Exists(attDirectory))
161+
if (v_SaveMessagesAndAttachments == "Yes")
162162
{
163-
mail.SaveAs(System.IO.Path.Combine(msgDirectory, mail.Subject + ".msg"));
164-
foreach (Attachment attachment in mail.Attachments)
163+
if (System.IO.Directory.Exists(msgDirectory))
164+
mail.SaveAs(System.IO.Path.Combine(msgDirectory, mail.Subject + ".msg"));
165+
if (System.IO.Directory.Exists(attDirectory))
165166
{
166-
attachment.SaveAsFile(System.IO.Path.Combine(attDirectory, attachment.FileName));
167-
}
167+
foreach (Attachment attachment in mail.Attachments)
168+
{
169+
attachment.SaveAsFile(System.IO.Path.Combine(attDirectory, attachment.FileName));
170+
}
171+
}
168172
}
169173
}
170174

0 commit comments

Comments
 (0)