diff --git a/CustomActivity.Appointment.sln b/CustomActivity.Appointment.sln
new file mode 100644
index 0000000..b466b27
--- /dev/null
+++ b/CustomActivity.Appointment.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.645
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomActivity.Appointment", "FDF.CustomActivity.Appointment\CustomActivity.Appointment.csproj", "{9375C8FC-26B0-4701-A70C-75C69EE7F031}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9375C8FC-26B0-4701-A70C-75C69EE7F031}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9375C8FC-26B0-4701-A70C-75C69EE7F031}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9375C8FC-26B0-4701-A70C-75C69EE7F031}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9375C8FC-26B0-4701-A70C-75C69EE7F031}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {4CEEEBCA-2872-4CD3-8781-23C42FC59080}
+ EndGlobalSection
+EndGlobal
diff --git a/CustomActivity.Appointment/CustomActivity.Appointment.csproj b/CustomActivity.Appointment/CustomActivity.Appointment.csproj
new file mode 100644
index 0000000..3ea3168
--- /dev/null
+++ b/CustomActivity.Appointment/CustomActivity.Appointment.csproj
@@ -0,0 +1,107 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {9375C8FC-26B0-4701-A70C-75C69EE7F031}
+ Library
+ Properties
+ CustomActivity.Appointment
+ CustomActivity.Appointment
+ v4.6.2
+ 512
+ true
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ true
+
+
+ ossamaA.snk
+
+
+
+ ..\packages\DDay.iCal.1.0.2.575\lib\DDay.iCal.dll
+
+
+ ..\packages\Microsoft.CrmSdk.CoreAssemblies.9.0.2.3\lib\net452\Microsoft.Crm.Sdk.Proxy.dll
+ False
+
+
+ ..\packages\Microsoft.CrmSdk.CoreAssemblies.9.0.2.3\lib\net452\Microsoft.Xrm.Sdk.dll
+ False
+
+
+ ..\packages\Microsoft.CrmSdk.Workflow.9.0.2.29\lib\net462\Microsoft.Xrm.Sdk.Workflow.dll
+ False
+
+
+
+
+
+
+
+
+
+
+ ..\packages\System.Reflection.4.1.0\lib\net462\System.Reflection.dll
+
+
+ ..\packages\System.Reflection.TypeExtensions.4.1.0\lib\net462\System.Reflection.TypeExtensions.dll
+
+
+
+ ..\packages\System.Runtime.Serialization.Primitives.4.3.0\lib\net46\System.Runtime.Serialization.Primitives.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CustomActivity.Appointment/CustomActivity.Appointment/SendAppointment.cs b/CustomActivity.Appointment/CustomActivity.Appointment/SendAppointment.cs
new file mode 100644
index 0000000..43aa278
--- /dev/null
+++ b/CustomActivity.Appointment/CustomActivity.Appointment/SendAppointment.cs
@@ -0,0 +1,125 @@
+using Microsoft.Xrm.Sdk;
+using Microsoft.Xrm.Sdk.Workflow;
+using Microsoft.Xrm.Sdk.Query;
+using System;
+using System.Activities;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using DDay.iCal;
+using DDay.iCal.Serialization.iCalendar;
+using System.Net.Mail;
+
+namespace CustomActivity.Appointment
+{
+ public class SendAppointment : CodeActivity
+ {
+ [RequiredArgument]
+ [Input("Start Date")]
+ public InArgument From { get; set; }
+ [RequiredArgument]
+ [Input("EndDate")]
+ public InArgument To { get; set; }
+ [RequiredArgument]
+ [Input("Email")]
+ public InArgument Email { get; set; }
+ [RequiredArgument]
+ [Input("Subject")]
+ public InArgument Subject { get; set; }
+ [RequiredArgument]
+ [Input("Location")]
+ public InArgument Location { get; set; }
+ [RequiredArgument]
+ [Input("EnableSSL")]
+ public InArgument IsEnableSSL { get; set; }
+ [RequiredArgument]
+ [Input("SMTP Configuration")]
+ [ReferenceTarget("os_emailconfiguration")]
+ public InArgument Configuration { get; set; }
+ protected override void Execute(CodeActivityContext context)
+ {
+ ITracingService tracingService = context.GetExtension();
+ var workflowContext = context.GetExtension();
+ var serviceFactory = context.GetExtension();
+ var orgService = serviceFactory.CreateOrganizationService(workflowContext.UserId);
+ DateTime AcStartDate = this.From.Get(context);
+ DateTime AcEndDate = this.To.Get(context);
+ string _email = this.Email.Get(context);
+ string _subject = this.Subject.Get(context);
+ string _location = this.Location.Get(context);
+ var _isSSL = this.IsEnableSSL.Get(context);
+ //Get the Configuration
+ EntityReference _config = this.Configuration.Get(context);
+ var ConfigData = orgService.Retrieve(_config.LogicalName, _config.Id, new ColumnSet(true));
+ var _smtpIP = ConfigData.GetAttributeValue("os_smtpip");
+ var _username = ConfigData.GetAttributeValue("os_username");
+ var _pass = ConfigData.GetAttributeValue("os_password");
+ var _sender = ConfigData.GetAttributeValue("emailaddress");
+ var _orgName = ConfigData.GetAttributeValue("os_name");
+ var _port = ConfigData.GetAttributeValue("os_port");
+ IICalendar iCal = new iCalendar();
+ iCal.Method = "Request";
+ IEvent evt = iCal.Create();
+ evt.Summary = _subject;
+ evt.Start = new iCalDateTime(AcStartDate);
+ evt.End = new iCalDateTime(AcEndDate);
+ evt.Description = _subject;
+ evt.Location = _location;
+ tracingService.Trace("evt done");
+ //evt.Name = _subject;
+ //evt.Organizer = new Organizer("MAILTO:" + _sender);
+ //evt.Organizer.CommonName = _orgName;
+ Alarm alarm = new Alarm();
+
+ // Display the alarm somewhere on the screen.
+ alarm.Action = AlarmAction.Display;
+
+ // This is the text that will be displayed for the alarm.
+ alarm.Summary = _subject;
+
+ // The alarm is set to occur 30 minutes before the event
+ alarm.Trigger = new Trigger(TimeSpan.FromMinutes(-30));
+ var serializer = new iCalendarSerializer(iCal);
+ var iCalString = serializer.SerializeToString(iCal);
+ var msg = new MailMessage();
+ msg.Subject = _subject;
+ msg.Body = _subject;
+ msg.From = new MailAddress(_sender);
+ msg.To.Add(_email);
+
+ tracingService.Trace("mail done");
+ // Create the Alternate view object with Calendar MIME type
+ var ct = new System.Net.Mime.ContentType("text/calendar");
+ if (ct.Parameters != null) ct.Parameters.Add("method", "REQUEST");
+
+ //Provide the framed string here
+ AlternateView avCal = AlternateView.CreateAlternateViewFromString(iCalString, ct);
+ msg.AlternateViews.Add(avCal);
+
+ // Send email
+ try
+ {
+ SendSMTP(_smtpIP, _port, _username, _pass, _isSSL);
+ tracingService.Trace("done");
+
+ }
+ catch (Exception ex) { throw new InvalidPluginExecutionException("Error " + ex.Message); }
+
+ }
+ void SendSMTP(string SMTPHost, int Port, string Username, string Password, bool isSSL)
+ {
+ SmtpClient smtp = new SmtpClient();
+ smtp.Host = SMTPHost;
+
+ smtp.Port = Port;
+ smtp.UseDefaultCredentials = false;
+ //smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
+
+ if (isSSL)
+ smtp.EnableSsl = true;
+ smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
+ smtp.Credentials = new System.Net.NetworkCredential(Username, Password);
+ }
+ }
+}
diff --git a/CustomActivity.Appointment/CustomActivity.Appointment/ossamaA.snk b/CustomActivity.Appointment/CustomActivity.Appointment/ossamaA.snk
new file mode 100644
index 0000000..a2c4751
Binary files /dev/null and b/CustomActivity.Appointment/CustomActivity.Appointment/ossamaA.snk differ
diff --git a/CustomActivity.Appointment/CustomActivity.Appointment/packages.config b/CustomActivity.Appointment/CustomActivity.Appointment/packages.config
new file mode 100644
index 0000000..4d8620c
--- /dev/null
+++ b/CustomActivity.Appointment/CustomActivity.Appointment/packages.config
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CustomActivity.Appointment/bin/Debug/CustomActivity.Appointment.dll b/CustomActivity.Appointment/bin/Debug/CustomActivity.Appointment.dll
new file mode 100644
index 0000000..a3bd9ec
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/CustomActivity.Appointment.dll differ
diff --git a/CustomActivity.Appointment/bin/Debug/CustomActivity.Appointment.pdb b/CustomActivity.Appointment/bin/Debug/CustomActivity.Appointment.pdb
new file mode 100644
index 0000000..e7c7a5c
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/CustomActivity.Appointment.pdb differ
diff --git a/CustomActivity.Appointment/bin/Debug/DDay.iCal.dll b/CustomActivity.Appointment/bin/Debug/DDay.iCal.dll
new file mode 100644
index 0000000..aa93dae
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/DDay.iCal.dll differ
diff --git a/CustomActivity.Appointment/bin/Debug/FDF.CustomActivity.Appointment.dll b/CustomActivity.Appointment/bin/Debug/FDF.CustomActivity.Appointment.dll
new file mode 100644
index 0000000..81ccf54
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/FDF.CustomActivity.Appointment.dll differ
diff --git a/CustomActivity.Appointment/bin/Debug/FDF.CustomActivity.Appointment.pdb b/CustomActivity.Appointment/bin/Debug/FDF.CustomActivity.Appointment.pdb
new file mode 100644
index 0000000..aa5a4a0
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/FDF.CustomActivity.Appointment.pdb differ
diff --git a/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.dll b/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.dll
new file mode 100644
index 0000000..1c17433
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.dll differ
diff --git a/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.merge.json b/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.merge.json
new file mode 100644
index 0000000..466eef8
--- /dev/null
+++ b/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.merge.json
@@ -0,0 +1 @@
+{"General":{"OutputFile":"C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\FDF.CustomActivity.Appointment\\bin\\Debug\\ILMerge\\CustomActivity.Appointment.dll","TargetPlatform":"v4,C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319","KeyFile":"C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\FDF.CustomActivity.Appointment\\ossamaA.snk","AlternativeILMergePath":null,"InputAssemblies":["C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\FDF.CustomActivity.Appointment\\bin\\Debug\\CustomActivity.Appointment.dll","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\DDay.iCal.1.0.2.575\\lib\\DDay.iCal.dll","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\System.Reflection.4.1.0\\lib\\net462\\System.Reflection.dll","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\System.Reflection.TypeExtensions.4.1.0\\lib\\net462\\System.Reflection.TypeExtensions.dll","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\System.Runtime.Serialization.Primitives.4.3.0\\lib\\net46\\System.Runtime.Serialization.Primitives.dll"]},"Advanced":{"AllowMultipleAssemblyLevelAttributes":false,"AllowWildCards":false,"AllowZeroPeKind":false,"AttributeFile":null,"Closed":false,"CopyAttributes":true,"DebugInfo":true,"DelaySign":false,"DeleteCopiesOverwriteTarget":false,"ExcludeFile":"","FileAlignment":512,"Internalize":false,"Log":false,"LogFile":null,"PublicKeyTokens":true,"TargetKind":null,"UnionMerge":false,"Version":null,"XmlDocumentation":false,"AllowDuplicateType":null,"SearchDirectories":["C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.2\\","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\FDF.CustomActivity.Appointment\\bin\\Debug\\","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\Microsoft.CrmSdk.CoreAssemblies.9.0.2.3\\lib\\net452\\","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\Microsoft.CrmSdk.Workflow.9.0.2.29\\lib\\net462\\"]}}
\ No newline at end of file
diff --git a/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.pdb b/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.pdb
new file mode 100644
index 0000000..6d0cfc9
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/ILMerge/CustomActivity.Appointment.pdb differ
diff --git a/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.dll b/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.dll
new file mode 100644
index 0000000..f074d4d
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.dll differ
diff --git a/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.merge.json b/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.merge.json
new file mode 100644
index 0000000..cbfb533
--- /dev/null
+++ b/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.merge.json
@@ -0,0 +1 @@
+{"General":{"OutputFile":"C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\FDF.CustomActivity.Appointment\\bin\\Debug\\ILMerge\\FDF.CustomActivity.Appointment.dll","TargetPlatform":"v4,C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319","KeyFile":"C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\FDF.CustomActivity.Appointment\\ossamaA.snk","AlternativeILMergePath":null,"InputAssemblies":["C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\FDF.CustomActivity.Appointment\\bin\\Debug\\FDF.CustomActivity.Appointment.dll","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\DDay.iCal.1.0.2.575\\lib\\DDay.iCal.dll","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\System.Reflection.4.1.0\\lib\\net462\\System.Reflection.dll","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\System.Reflection.TypeExtensions.4.1.0\\lib\\net462\\System.Reflection.TypeExtensions.dll","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\System.Runtime.Serialization.Primitives.4.3.0\\lib\\net46\\System.Runtime.Serialization.Primitives.dll"]},"Advanced":{"AllowMultipleAssemblyLevelAttributes":false,"AllowWildCards":false,"AllowZeroPeKind":false,"AttributeFile":null,"Closed":false,"CopyAttributes":true,"DebugInfo":true,"DelaySign":false,"DeleteCopiesOverwriteTarget":false,"ExcludeFile":"","FileAlignment":512,"Internalize":false,"Log":false,"LogFile":null,"PublicKeyTokens":true,"TargetKind":null,"UnionMerge":false,"Version":null,"XmlDocumentation":false,"AllowDuplicateType":null,"SearchDirectories":["C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.2\\","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\FDF.CustomActivity.Appointment\\bin\\Debug\\","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\Microsoft.CrmSdk.CoreAssemblies.9.0.2.3\\lib\\net452\\","C:\\Users\\SalmanTariq\\Documents\\FDF.CustomActivity.Appointment\\packages\\Microsoft.CrmSdk.Workflow.9.0.2.29\\lib\\net462\\"]}}
\ No newline at end of file
diff --git a/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.pdb b/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.pdb
new file mode 100644
index 0000000..13e8dd9
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/ILMerge/FDF.CustomActivity.Appointment.pdb differ
diff --git a/CustomActivity.Appointment/bin/Debug/System.Reflection.TypeExtensions.dll b/CustomActivity.Appointment/bin/Debug/System.Reflection.TypeExtensions.dll
new file mode 100644
index 0000000..7fc7ac5
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/System.Reflection.TypeExtensions.dll differ
diff --git a/CustomActivity.Appointment/bin/Debug/System.Reflection.dll b/CustomActivity.Appointment/bin/Debug/System.Reflection.dll
new file mode 100644
index 0000000..73a837d
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/System.Reflection.dll differ
diff --git a/CustomActivity.Appointment/bin/Debug/System.Runtime.Serialization.Primitives.dll b/CustomActivity.Appointment/bin/Debug/System.Runtime.Serialization.Primitives.dll
new file mode 100644
index 0000000..0daf235
Binary files /dev/null and b/CustomActivity.Appointment/bin/Debug/System.Runtime.Serialization.Primitives.dll differ