diff --git a/ListViewEx/GeneratedAssemblyInfo.cs b/ListViewEx/GeneratedAssemblyInfo.cs new file mode 100644 index 00000000..6f998cd0 --- /dev/null +++ b/ListViewEx/GeneratedAssemblyInfo.cs @@ -0,0 +1,12 @@ +// Assembly ListViewEx, Version 1.0.1753.24378 + +[assembly: System.Reflection.AssemblyKeyName("")] +[assembly: System.Reflection.AssemblyKeyFile("")] +[assembly: System.Reflection.AssemblyDelaySign(false)] +[assembly: System.Reflection.AssemblyTrademark("")] +[assembly: System.Reflection.AssemblyCopyright("")] +[assembly: System.Reflection.AssemblyProduct("")] +[assembly: System.Reflection.AssemblyCompany("")] +[assembly: System.Reflection.AssemblyConfiguration("")] +[assembly: System.Reflection.AssemblyDescription("")] +[assembly: System.Reflection.AssemblyTitle("")] diff --git a/ListViewEx/ListViewEx.ListViewEx.resources b/ListViewEx/ListViewEx.ListViewEx.resources new file mode 100644 index 00000000..d42e5555 Binary files /dev/null and b/ListViewEx/ListViewEx.ListViewEx.resources differ diff --git a/ListViewEx/ListViewEx.csproj b/ListViewEx/ListViewEx.csproj new file mode 100644 index 00000000..de09d561 --- /dev/null +++ b/ListViewEx/ListViewEx.csproj @@ -0,0 +1,46 @@ + + + true + full + bin\Debug\ + false + + + false + pdbonly + bin\Release\ + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ListViewEx/ListViewEx/ListViewEx.cs b/ListViewEx/ListViewEx/ListViewEx.cs new file mode 100644 index 00000000..4c572822 --- /dev/null +++ b/ListViewEx/ListViewEx/ListViewEx.cs @@ -0,0 +1,282 @@ +namespace ListViewEx +{ + using System; + using System.ComponentModel; + using System.Drawing; + using System.Runtime.CompilerServices; + using System.Runtime.InteropServices; + using System.Windows.Forms; + + public class ListViewEx : ListView + { + private bool _doubleClickActivation = false; + private Control _editingControl; + private ListViewItem _editItem; + private int _editSubItem; + private Container components = null; + private const int HDN_BEGINDRAG = -310; + private const int HDN_FIRST = -300; + private const int HDN_ITEMCHANGINGA = -300; + private const int HDN_ITEMCHANGINGW = -320; + private const int LVM_FIRST = 0x1000; + private const int LVM_GETCOLUMNORDERARRAY = 0x103b; + private const int WM_HSCROLL = 0x114; + private const int WM_NOTIFY = 0x4e; + private const int WM_SIZE = 5; + private const int WM_VSCROLL = 0x115; + + public event SubItemEventHandler SubItemBeginEditing; + + public event SubItemEventHandler SubItemClicked; + + public event SubItemEndEditingEventHandler SubItemEndEditing; + + public ListViewEx() + { + this.InitializeComponent(); + base.FullRowSelect = true; + base.View = View.Details; + base.AllowColumnReorder = true; + } + + private void _editControl_KeyPress(object sender, KeyPressEventArgs e) + { + switch (e.KeyChar) + { + case '\r': + this.EndEditing(true); + break; + + case '\x001b': + this.EndEditing(false); + break; + } + } + + private void _editControl_Leave(object sender, EventArgs e) + { + this.EndEditing(true); + } + + protected override void Dispose(bool disposing) + { + if (disposing && (this.components != null)) + { + this.components.Dispose(); + } + base.Dispose(disposing); + } + + private void EditSubitemAt(Point p) + { + ListViewItem item; + int subItem = this.GetSubItemAt(p.X, p.Y, out item); + if (subItem >= 0) + { + this.OnSubItemClicked(new SubItemEventArgs(item, subItem)); + } + } + + public void EndEditing(bool AcceptChanges) + { + if (this._editingControl != null) + { + SubItemEndEditingEventArgs e = new SubItemEndEditingEventArgs(this._editItem, this._editSubItem, AcceptChanges ? this._editingControl.Text : this._editItem.SubItems[this._editSubItem].Text, !AcceptChanges); + this.OnSubItemEndEditing(e); + this._editItem.SubItems[this._editSubItem].Text = e.DisplayText; + this._editingControl.Leave -= new EventHandler(this._editControl_Leave); + this._editingControl.KeyPress -= new KeyPressEventHandler(this._editControl_KeyPress); + this._editingControl.Visible = false; + this._editingControl = null; + this._editItem = null; + this._editSubItem = -1; + } + } + + public int[] GetColumnOrder() + { + IntPtr lPar = Marshal.AllocHGlobal((int) (Marshal.SizeOf(typeof(int)) * base.Columns.Count)); + if (SendMessage(base.Handle, 0x103b, new IntPtr(base.Columns.Count), lPar).ToInt32() == 0) + { + Marshal.FreeHGlobal(lPar); + return null; + } + int[] destination = new int[base.Columns.Count]; + Marshal.Copy(lPar, destination, 0, base.Columns.Count); + Marshal.FreeHGlobal(lPar); + return destination; + } + + public int GetSubItemAt(int x, int y, out ListViewItem item) + { + item = base.GetItemAt(x, y); + if (item != null) + { + int[] columnOrder = this.GetColumnOrder(); + int left = item.GetBounds(ItemBoundsPortion.Entire).Left; + for (int i = 0; i < columnOrder.Length; i++) + { + ColumnHeader header = base.Columns[columnOrder[i]]; + if (x < (left + header.Width)) + { + return header.Index; + } + left += header.Width; + } + } + return -1; + } + + public Rectangle GetSubItemBounds(ListViewItem Item, int SubItem) + { + int[] columnOrder = this.GetColumnOrder(); + if (SubItem >= columnOrder.Length) + { + throw new IndexOutOfRangeException("SubItem " + SubItem + " out of range"); + } + if (Item == null) + { + throw new ArgumentNullException("Item"); + } + Rectangle bounds = Item.GetBounds(ItemBoundsPortion.Entire); + int left = bounds.Left; + int index = 0; + while (index < columnOrder.Length) + { + ColumnHeader header = base.Columns[columnOrder[index]]; + if (header.Index == SubItem) + { + break; + } + left += header.Width; + index++; + } + return new Rectangle(left, bounds.Top, base.Columns[columnOrder[index]].Width, bounds.Height); + } + + private void InitializeComponent() + { + this.components = new Container(); + } + + protected override void OnDoubleClick(EventArgs e) + { + base.OnDoubleClick(e); + if (this.DoubleClickActivation) + { + Point p = base.PointToClient(Cursor.Position); + this.EditSubitemAt(p); + } + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + if (!this.DoubleClickActivation) + { + this.EditSubitemAt(new Point(e.X, e.Y)); + } + } + + protected void OnSubItemBeginEditing(SubItemEventArgs e) + { + if (this.SubItemBeginEditing != null) + { + this.SubItemBeginEditing(this, e); + } + } + + protected void OnSubItemClicked(SubItemEventArgs e) + { + if (this.SubItemClicked != null) + { + this.SubItemClicked(this, e); + } + } + + protected void OnSubItemEndEditing(SubItemEndEditingEventArgs e) + { + if (this.SubItemEndEditing != null) + { + this.SubItemEndEditing(this, e); + } + } + + [DllImport("user32.dll", CharSet=CharSet.Ansi)] + private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int len, ref int[] order); + [DllImport("user32.dll")] + private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wPar, IntPtr lPar); + public void StartEditing(Control c, ListViewItem Item, int SubItem) + { + this.OnSubItemBeginEditing(new SubItemEventArgs(Item, SubItem)); + Rectangle subItemBounds = this.GetSubItemBounds(Item, SubItem); + if (subItemBounds.X < 0) + { + subItemBounds.Width += subItemBounds.X; + subItemBounds.X = 0; + } + if ((subItemBounds.X + subItemBounds.Width) > base.Width) + { + subItemBounds.Width = base.Width - subItemBounds.Left; + } + subItemBounds.Offset(base.Left, base.Top); + Point p = new Point(0, 0); + Point point2 = base.Parent.PointToScreen(p); + Point point3 = c.Parent.PointToScreen(p); + subItemBounds.Offset(point2.X - point3.X, point2.Y - point3.Y); + c.Bounds = subItemBounds; + c.Text = Item.SubItems[SubItem].Text; + c.Visible = true; + c.BringToFront(); + c.Focus(); + this._editingControl = c; + this._editingControl.Leave += new EventHandler(this._editControl_Leave); + this._editingControl.KeyPress += new KeyPressEventHandler(this._editControl_KeyPress); + this._editItem = Item; + this._editSubItem = SubItem; + } + + protected override void WndProc(ref Message msg) + { + switch (msg.Msg) + { + case 0x114: + case 0x115: + case 5: + this.EndEditing(false); + break; + + case 0x4e: + { + NMHDR nmhdr = (NMHDR) Marshal.PtrToStructure(msg.LParam, typeof(NMHDR)); + if (((nmhdr.code == -310) || (nmhdr.code == -300)) || (nmhdr.code == -320)) + { + this.EndEditing(false); + } + break; + } + } + base.WndProc(ref msg); + } + + public bool DoubleClickActivation + { + get + { + return this._doubleClickActivation; + } + set + { + this._doubleClickActivation = value; + } + } + + [StructLayout(LayoutKind.Sequential)] + private struct NMHDR + { + public IntPtr hwndFrom; + public int idFrom; + public int code; + } + } +} diff --git a/ListViewEx/ListViewEx/SubItemEndEditingEventArgs.cs b/ListViewEx/ListViewEx/SubItemEndEditingEventArgs.cs new file mode 100644 index 00000000..776fbe21 --- /dev/null +++ b/ListViewEx/ListViewEx/SubItemEndEditingEventArgs.cs @@ -0,0 +1,43 @@ +namespace ListViewEx +{ + using System; + using System.Windows.Forms; + + public class SubItemEndEditingEventArgs : SubItemEventArgs + { + private bool _cancel; + private string _text; + + public SubItemEndEditingEventArgs(ListViewItem item, int subItem, string display, bool cancel) : base(item, subItem) + { + this._text = string.Empty; + this._cancel = true; + this._text = display; + this._cancel = cancel; + } + + public bool Cancel + { + get + { + return this._cancel; + } + set + { + this._cancel = value; + } + } + + public string DisplayText + { + get + { + return this._text; + } + set + { + this._text = value; + } + } + } +} diff --git a/ListViewEx/ListViewEx/SubItemEndEditingEventHandler.cs b/ListViewEx/ListViewEx/SubItemEndEditingEventHandler.cs new file mode 100644 index 00000000..b09f68c1 --- /dev/null +++ b/ListViewEx/ListViewEx/SubItemEndEditingEventHandler.cs @@ -0,0 +1,7 @@ +namespace ListViewEx +{ + using System; + using System.Runtime.CompilerServices; + + public delegate void SubItemEndEditingEventHandler(object sender, SubItemEndEditingEventArgs e); +} diff --git a/ListViewEx/ListViewEx/SubItemEventArgs.cs b/ListViewEx/ListViewEx/SubItemEventArgs.cs new file mode 100644 index 00000000..ac9d7bd7 --- /dev/null +++ b/ListViewEx/ListViewEx/SubItemEventArgs.cs @@ -0,0 +1,33 @@ +namespace ListViewEx +{ + using System; + using System.Windows.Forms; + + public class SubItemEventArgs : EventArgs + { + private ListViewItem _item = null; + private int _subItemIndex = -1; + + public SubItemEventArgs(ListViewItem item, int subItem) + { + this._subItemIndex = subItem; + this._item = item; + } + + public ListViewItem Item + { + get + { + return this._item; + } + } + + public int SubItem + { + get + { + return this._subItemIndex; + } + } + } +} diff --git a/ListViewEx/ListViewEx/SubItemEventHandler.cs b/ListViewEx/ListViewEx/SubItemEventHandler.cs new file mode 100644 index 00000000..febc1323 --- /dev/null +++ b/ListViewEx/ListViewEx/SubItemEventHandler.cs @@ -0,0 +1,7 @@ +namespace ListViewEx +{ + using System; + using System.Runtime.CompilerServices; + + public delegate void SubItemEventHandler(object sender, SubItemEventArgs e); +} diff --git a/ListViewEx/_Module_.cs b/ListViewEx/_Module_.cs new file mode 100644 index 00000000..e69de29b diff --git a/README.md b/README.md index 736e093b..e2700bf5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ### What's in this repository ### -SuiteCRM Outlook Plug-In v1.2.0 +SuiteCRM Outlook Plug-In v2.0 This repository has been created to allow community members to collaborate and contribute to the project. diff --git a/SugarCRMClient/Properties/Settings.Designer.cs b/SugarCRMClient/Properties/Settings.Designer.cs index e7996639..88d12622 100644 --- a/SugarCRMClient/Properties/Settings.Designer.cs +++ b/SugarCRMClient/Properties/Settings.Designer.cs @@ -22,15 +22,5 @@ public static Settings Default { return defaultInstance; } } - - [global::System.Configuration.ApplicationScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] - [global::System.Configuration.DefaultSettingValueAttribute("http://suitecrm.com/suitedemo/service/v4_1/soap.php")] - public string SugarCRMClient_SuitecrmSoapTest_sugarsoap { - get { - return ((string)(this["SugarCRMClient_SuitecrmSoapTest_sugarsoap"])); - } - } } } diff --git a/SugarCRMClient/Properties/Settings.settings b/SugarCRMClient/Properties/Settings.settings index 297e9601..8e615f25 100644 --- a/SugarCRMClient/Properties/Settings.settings +++ b/SugarCRMClient/Properties/Settings.settings @@ -1,9 +1,5 @@  - + - - - http://suitecrm.com/suitedemo/service/v4_1/soap.php - - + \ No newline at end of file diff --git a/SugarCRMClient/SuiteCRMClient.csproj b/SugarCRMClient/SuiteCRMClient.csproj index 5cc5f39c..3b82223e 100644 --- a/SugarCRMClient/SuiteCRMClient.csproj +++ b/SugarCRMClient/SuiteCRMClient.csproj @@ -99,11 +99,6 @@ - - True - True - Reference.map - @@ -112,84 +107,6 @@ Settings.Designer.cs - - Reference.map - - - Reference.map - - - Reference.map - - - Reference.map - - - Reference.map - - - Designer - - - Designer - - - Reference.map - - - Reference.map - - - Reference.map - - - Reference.map - - - Reference.map - - - Reference.map - - - Reference.map - - - Reference.map - - - Reference.map - - - MSDiscoCodeGenerator - Reference.cs - - - Reference.map - - - - Reference.map - - - - - - - - - - - Dynamic - Web References\SuitecrmSoapTest\ - https://suitecrm.com/suitedemo/service/v4_1/soap.php%3fwsdl - - - - - Settings - SugarCRMClient_SuitecrmSoapTest_sugarsoap - - .\ListViewEx.dll + + False + ..\SugarCRMClient\bin\Debug\Newtonsoft.Json.dll + + @@ -195,6 +199,7 @@ AddressBook.cs + diff --git a/SuiteCRMAddIn/ThisAddIn.cs b/SuiteCRMAddIn/ThisAddIn.cs index b93c9d46..ad7ac0aa 100644 --- a/SuiteCRMAddIn/ThisAddIn.cs +++ b/SuiteCRMAddIn/ThisAddIn.cs @@ -35,6 +35,10 @@ using SuiteCRMClient.RESTObjects; using SuiteCRMClient; using System.IO; +using System.Windows.Forms; +using System.Threading; +using System.Threading.Tasks; +using Newtonsoft.Json; namespace SuiteCRMAddIn { @@ -48,6 +52,22 @@ public partial class ThisAddIn public Office.CommandBarButton btnSettings; List lstOutlookFolders; public int CurrentVersion; + List lCalItems; + private string sDelCalId = ""; + private string sDelCalModule = ""; + private bool SyncInProgress = false; + private bool IsCalendarView = false; + private string PrevCalSID = ""; + + List lTaskItems; + private string sDelTaskId = ""; + private bool IsTaskView = false; + private string PrevTaskID = ""; + + List lContactItems; + private string sDelContactId = ""; + private bool IsContactView = false; + private string PrevContactID = ""; public Office.IRibbonUI RibbonUI { get; set; } private void ThisAddIn_Startup(object sender, System.EventArgs e) @@ -56,6 +76,8 @@ private void ThisAddIn_Startup(object sender, System.EventArgs e) this.objExplorer = Globals.ThisAddIn.Application.ActiveExplorer(); SuiteCRMClient.clsSuiteCRMHelper.InstallationPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\SuiteCRMOutlookAddIn"; this.settings = new clsSettings(); + this.objExplorer.FolderSwitch -= objExplorer_FolderSwitch; + this.objExplorer.FolderSwitch += objExplorer_FolderSwitch; if (this.settings.AutoArchive) { this.objExplorer.Application.NewMailEx += new Outlook.ApplicationEvents_11_NewMailExEventHandler(this.Application_NewMail); @@ -86,7 +108,8 @@ private void ThisAddIn_Startup(object sender, System.EventArgs e) this.btnSettings.BeginGroup = true; this.btnSettings.TooltipText = "SuiteCRM Settings"; this.btnSettings.Enabled = true; - this.btnSettings.Picture = RibbonImageHelper.Convert(Resources.Settings); + this.btnSettings.Picture = RibbonImageHelper.Convert(Resources.Settings); + objSuiteCRMMenuBar2007.Visible = true; } } @@ -97,12 +120,1006 @@ private void ThisAddIn_Startup(object sender, System.EventArgs e) //app.FolderContextMenuDisplay += new Outlook.ApplicationEvents_11_FolderContextMenuDisplayEventHander(this.app_FolderContextMenuDisplay); } SuiteCRMAuthenticate(); + Sync(); + } + + void objExplorer_FolderSwitch() + { + if (this.objExplorer.CurrentFolder.DefaultItemType == GetDefaultFolder("appointments").DefaultItemType) + IsCalendarView = true; + else + IsCalendarView = false; + if (this.objExplorer.CurrentFolder.DefaultItemType == GetDefaultFolder("tasks").DefaultItemType) + IsTaskView = true; + else + IsTaskView = false; + if (this.objExplorer.CurrentFolder.DefaultItemType == GetDefaultFolder("contacts").DefaultItemType) + IsContactView = true; + else + IsContactView = false; + } + + public async void Sync() + //public void Sync() + { + while (1 == 1) + { + if (SuiteCRMUserSession != null && SuiteCRMUserSession.id != "") + { + if (settings.SyncCalendar) + { + //StartCalendarSync(); + Thread oThread = new Thread(() => StartCalendarSync()); + oThread.Start(); + //StartTaskSync(); + Thread oThread1 = new Thread(() => StartTaskSync()); + oThread1.Start(); + } + if (settings.SyncContacts) + { + //StartContactSync(); + Thread oThread = new Thread(() => StartContactSync()); + oThread.Start(); + } + } + await Task.Delay(300000); //5 mins delay + } + } + private void StartContactSync() + { + Outlook.NameSpace oNS = this.Application.GetNamespace("mapi"); + Outlook.MAPIFolder contactsFolder = GetDefaultFolder("contacts"); + Outlook.Items items = contactsFolder.Items; + + items.ItemAdd -= CItems_ItemAdd; + items.ItemChange -= CItems_ItemChange; + items.ItemRemove -= CItems_ItemRemove; + items.ItemAdd += CItems_ItemAdd; + items.ItemChange += CItems_ItemChange; + items.ItemRemove += CItems_ItemRemove; + + Outlook.MAPIFolderEvents_12_Event oCalendarEvents; + oCalendarEvents = contactsFolder as Outlook.MAPIFolderEvents_12_Event; + if (oCalendarEvents != null) + { + oCalendarEvents.BeforeItemMove -= CoCalendarEvents_BeforeItemMove; + oCalendarEvents.BeforeItemMove += CoCalendarEvents_BeforeItemMove; + } + + SyncInProgress = true; + GetOutlookCItems(contactsFolder); + SyncContacts(contactsFolder); + SyncInProgress = false; + + } + private void SyncContacts(Outlook.MAPIFolder contactFolder) + { + eGetEntryListResult _result2 = clsSuiteCRMHelper.GetEntryList("Contacts", "", + 0, "date_entered DESC", 0, false, clsSuiteCRMHelper.GetSugarFields("Contacts")); + if (_result2 != null) + { + foreach (var oResult in _result2.entry_list) + { + try + { + dynamic dResult = JsonConvert.DeserializeObject(oResult.name_value_object.ToString()); + var oItem = lContactItems.Where(a => a.SEntryID == dResult.id.value.ToString()).FirstOrDefault(); + if (oItem == default(cContactItem)) + { + Outlook.ContactItem cItem = contactFolder.Items.Add(Outlook.OlItemType.olContactItem); + cItem.FirstName = dResult.first_name.value.ToString(); + cItem.LastName = dResult.last_name.value.ToString(); + cItem.Email1Address = dResult.email1.value.ToString(); + cItem.BusinessTelephoneNumber = dResult.phone_work.value.ToString(); + cItem.HomeTelephoneNumber = dResult.phone_home.value.ToString(); + cItem.MobileTelephoneNumber = dResult.phone_mobile.value.ToString(); + cItem.JobTitle = dResult.title.value.ToString(); + cItem.Department = dResult.department.value.ToString(); + cItem.BusinessAddressCity = dResult.primary_address_city.value.ToString(); + cItem.BusinessAddressCountry = dResult.primary_address_country.value.ToString(); + cItem.BusinessAddressPostalCode = dResult.primary_address_postalcode.value.ToString(); + cItem.BusinessAddressState = dResult.primary_address_state.value.ToString(); + cItem.BusinessAddressStreet = dResult.primary_address_street.value.ToString(); + cItem.Body = dResult.description.value.ToString(); + if (dResult.account_name != null) + { + cItem.Account = dResult.account_name.value.ToString(); + cItem.CompanyName = dResult.account_name.value.ToString(); + } + cItem.BusinessFaxNumber = dResult.phone_fax.value.ToString(); + cItem.Title = dResult.salutation.value.ToString(); + + Outlook.UserProperty oProp = cItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = dResult.date_modified.value.ToString(); + Outlook.UserProperty oProp2 = cItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = dResult.id.value.ToString(); + cItem.Save(); + lContactItems.Add(new cContactItem + { + oItem = cItem, + OModifiedDate = dResult.date_modified.value.ToString(), + SEntryID = dResult.id.value.ToString(), + Touched = true + }); + } + else + { + oItem.Touched = true; + Outlook.ContactItem cItem = oItem.oItem; + Outlook.UserProperty oProp = cItem.UserProperties["SOModifiedDate"]; + + if (oProp.Value != dResult.date_modified.value.ToString()) + { + cItem.FirstName = dResult.first_name.value.ToString(); + cItem.LastName = dResult.last_name.value.ToString(); + cItem.Email1Address = dResult.email1.value.ToString(); + cItem.BusinessTelephoneNumber = dResult.phone_work.value.ToString(); + cItem.HomeTelephoneNumber = dResult.phone_home.value.ToString(); + cItem.MobileTelephoneNumber = dResult.phone_mobile.value.ToString(); + cItem.JobTitle = dResult.title.value.ToString(); + cItem.Department = dResult.department.value.ToString(); + cItem.BusinessAddressCity = dResult.primary_address_city.value.ToString(); + cItem.BusinessAddressCountry = dResult.primary_address_country.value.ToString(); + cItem.BusinessAddressPostalCode = dResult.primary_address_postalcode.value.ToString(); + cItem.BusinessAddressState = dResult.primary_address_state.value.ToString(); + cItem.BusinessAddressStreet = dResult.primary_address_street.value.ToString(); + cItem.Body = dResult.description.value.ToString(); + cItem.Account = dResult.account_name.value.ToString(); + cItem.CompanyName = dResult.account_name.value.ToString(); + cItem.BusinessFaxNumber = dResult.phone_fax.value.ToString(); + cItem.Title = dResult.salutation.value.ToString(); + if (oProp == null) + oProp = cItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = dResult.date_modified.value.ToString(); + Outlook.UserProperty oProp2 = cItem.UserProperties["SEntryID"]; + if (oProp2 == null) + oProp2 = cItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = dResult.id.value.ToString(); + cItem.Save(); + } + } + } + catch + { } + } + } + + try + { + var lItemToBeDeletedO = lContactItems.Where(a => !a.Touched && !string.IsNullOrWhiteSpace(a.OModifiedDate)).ToList(); + foreach (var oItem in lItemToBeDeletedO) + { + oItem.oItem.Delete(); + } + lContactItems.RemoveAll(a => !a.Touched && !string.IsNullOrWhiteSpace(a.OModifiedDate)); + + var lItemToBeAddedToS = lContactItems.Where(a => !a.Touched && string.IsNullOrWhiteSpace(a.OModifiedDate)).ToList(); + foreach (var oItem in lItemToBeAddedToS) + { + AddContactToS(oItem.oItem); + } + } + catch + { } + } + private void GetOutlookCItems(Outlook.MAPIFolder taskFolder) + { + if (lContactItems == null) + { + lContactItems = new List(); + Outlook.Items items = taskFolder.Items.Restrict("[MessageClass] = 'IPM.Contact'"); + foreach (Outlook.ContactItem oItem in items) + { + if (oItem.Sensitivity != Outlook.OlSensitivity.olPrivate) + { + Outlook.UserProperty oProp = oItem.UserProperties["SOModifiedDate"]; + if (oProp != null) + { + Outlook.UserProperty oProp2 = oItem.UserProperties["SEntryID"]; + lContactItems.Add(new cContactItem + { + oItem = oItem, + OModifiedDate = oProp.Value.ToString(), + SEntryID = oProp2.Value.ToString() + }); + } + else + { + lContactItems.Add(new cContactItem + { + oItem = oItem + }); + } + } + } + } + } + + void CItems_ItemChange(object Item) + { + if (!SyncInProgress && IsContactView) + { + bool SyncOldStatus = SyncInProgress; + SyncInProgress = true; + var oItem = Item as Outlook.ContactItem; + if (PrevContactID != oItem.EntryID) + { + Outlook.UserProperty oProp1 = oItem.UserProperties["SEntryID"]; + if (oProp1 != null) + { + AddContactToS(oItem, oProp1.Value.ToString()); + } + } + SyncInProgress = SyncOldStatus; + } + } + + void CItems_ItemAdd(object Item) + { + if (!SyncInProgress && IsContactView) + { + AddContactToS(Item as Outlook.ContactItem); + } + } + private void AddContactToS(Outlook.ContactItem oItem, string sID = "") + { + if (oItem != null) + { + try + { + PrevContactID = oItem.EntryID; + string _result = ""; + eNameValue[] data = new eNameValue[18]; + + data[0] = clsSuiteCRMHelper.SetNameValuePair("email1", oItem.Email1Address); + data[1] = clsSuiteCRMHelper.SetNameValuePair("title", oItem.JobTitle); + data[2] = clsSuiteCRMHelper.SetNameValuePair("phone_work", oItem.BusinessTelephoneNumber); + data[3] = clsSuiteCRMHelper.SetNameValuePair("phone_home", oItem.HomeTelephoneNumber); + data[4] = clsSuiteCRMHelper.SetNameValuePair("phone_mobile", oItem.MobileTelephoneNumber); + data[5] = clsSuiteCRMHelper.SetNameValuePair("phone_fax", oItem.BusinessFaxNumber); + data[6] = clsSuiteCRMHelper.SetNameValuePair("department", oItem.Department); + data[7] = clsSuiteCRMHelper.SetNameValuePair("primary_address_city", oItem.BusinessAddressCity); + data[8] = clsSuiteCRMHelper.SetNameValuePair("primary_address_state", oItem.BusinessAddressState); + data[9] = clsSuiteCRMHelper.SetNameValuePair("primary_address_postalcode", oItem.BusinessAddressPostalCode); + data[10] = clsSuiteCRMHelper.SetNameValuePair("primary_address_country", oItem.BusinessAddressCountry); + data[11] = clsSuiteCRMHelper.SetNameValuePair("primary_address_street", oItem.BusinessAddressStreet); + data[12] = clsSuiteCRMHelper.SetNameValuePair("description", oItem.Body); + data[13] = clsSuiteCRMHelper.SetNameValuePair("last_name", oItem.LastName); + data[14] = clsSuiteCRMHelper.SetNameValuePair("first_name", oItem.FirstName); + data[15] = clsSuiteCRMHelper.SetNameValuePair("account_name", oItem.CompanyName); + data[16] = clsSuiteCRMHelper.SetNameValuePair("salutation", oItem.Title); + + if (sID == "") + data[17] = clsSuiteCRMHelper.SetNameValuePair("assigned_user_id", clsSuiteCRMHelper.GetUserId()); + else + data[17] = clsSuiteCRMHelper.SetNameValuePair("id", sID); + + _result = clsSuiteCRMHelper.SetEntry(data, "Contacts"); + Outlook.UserProperty oProp = oItem.UserProperties["SOModifiedDate"]; + if (oProp == null) + oProp = oItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = "Fresh"; + Outlook.UserProperty oProp2 = oItem.UserProperties["SEntryID"]; + if (oProp2 == null) + oProp2 = oItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = _result; + oItem.Save(); + var sItem = lContactItems.Where(a => a.oItem.EntryID == oItem.EntryID).FirstOrDefault(); + if (sItem != default(cContactItem)) + { + sItem.oItem = oItem; + sItem.OModifiedDate = "Fresh"; + sItem.SEntryID = _result; + } + else + lContactItems.Add(new cContactItem { SEntryID = _result, OModifiedDate = "Fresh", oItem = oItem }); + } + catch + { } + } + } + void CItems_ItemRemove() + { + if (!SyncInProgress && IsContactView) + { + if (sDelContactId != "") + { + try + { + eNameValue[] data = new eNameValue[2]; + data[0] = clsSuiteCRMHelper.SetNameValuePair("id", sDelContactId); + data[1] = clsSuiteCRMHelper.SetNameValuePair("deleted", "1"); + clsSuiteCRMHelper.SetEntry(data, "Contacts"); + lContactItems.RemoveAll(a => a.SEntryID == sDelContactId); + } + catch + { } + } + sDelContactId = ""; + } + } + void CoCalendarEvents_BeforeItemMove(object Item, Outlook.MAPIFolder MoveTo, ref bool Cancel) + { + if (!SyncInProgress && IsContactView) + { + sDelContactId = ""; + Outlook.ContactItem oContact = Item as Outlook.ContactItem; + if (oContact.UserProperties != null) + { + Outlook.UserProperty oProp = oContact.UserProperties["SEntryID"]; + if (oProp != null) + { + sDelContactId = oProp.Value.ToString(); + } + } + } } + private void StartTaskSync() + { + Outlook.NameSpace oNS = this.Application.GetNamespace("mapi"); + Outlook.MAPIFolder taskFolder = GetDefaultFolder("tasks"); + Outlook.Items items = taskFolder.Items; + + items.ItemAdd -= TItems_ItemAdd; + items.ItemChange -= TItems_ItemChange; + items.ItemRemove -= TItems_ItemRemove; + items.ItemAdd += TItems_ItemAdd; + items.ItemChange += TItems_ItemChange; + items.ItemRemove += TItems_ItemRemove; + + Outlook.MAPIFolderEvents_12_Event oCalendarEvents; + oCalendarEvents = taskFolder as Outlook.MAPIFolderEvents_12_Event; + if (oCalendarEvents != null) + { + oCalendarEvents.BeforeItemMove -= ToCalendarEvents_BeforeItemMove; + oCalendarEvents.BeforeItemMove += ToCalendarEvents_BeforeItemMove; + } + + SyncInProgress = true; + GetOutlookTItems(taskFolder); + SyncTasks(taskFolder); + SyncInProgress = false; + + } + private Outlook.OlImportance GetImportance(string sImportance) + { + Outlook.OlImportance oPriority = Outlook.OlImportance.olImportanceLow; + switch (sImportance) + { + case "High": + oPriority = Outlook.OlImportance.olImportanceHigh; + break; + case "Medium": + oPriority = Outlook.OlImportance.olImportanceNormal; + break; + } + return oPriority; + } + private Outlook.OlTaskStatus GetStatus(string sStatus) + { + Outlook.OlTaskStatus oStatus = Outlook.OlTaskStatus.olTaskNotStarted; + switch (sStatus) + { + case "In Progress": + oStatus = Outlook.OlTaskStatus.olTaskInProgress; + break; + case "Completed": + oStatus = Outlook.OlTaskStatus.olTaskComplete; + break; + case "Deferred": + oStatus = Outlook.OlTaskStatus.olTaskDeferred; + break; + + } + return oStatus; + } + private void SyncTasks(Outlook.MAPIFolder tasksFolder) + { + eGetEntryListResult _result2 = clsSuiteCRMHelper.GetEntryList("Tasks", "", + 0, "date_entered DESC", 0, false, clsSuiteCRMHelper.GetSugarFields("Tasks")); + if (_result2 != null) + { + foreach (var oResult in _result2.entry_list) + { + try + { + dynamic dResult = JsonConvert.DeserializeObject(oResult.name_value_object.ToString()); + var oItem = lTaskItems.Where(a => a.SEntryID == dResult.id.value.ToString()).FirstOrDefault(); + if (oItem == default(cTaskItem)) + { + Outlook.TaskItem tItem = tasksFolder.Items.Add(Outlook.OlItemType.olTaskItem); + tItem.Subject = dResult.name.value.ToString(); + tItem.Body = dResult.description.value.ToString(); + if (!string.IsNullOrWhiteSpace(dResult.date_start.value.ToString())) + { + tItem.StartDate = DateTime.Parse(dResult.date_start.value.ToString()); + } + if (!string.IsNullOrWhiteSpace(dResult.date_due.value.ToString())) + { + tItem.DueDate = DateTime.Parse(dResult.date_due.value.ToString()); + } + + tItem.Status = GetStatus(dResult.status.value.ToString()); + tItem.Importance = GetImportance(dResult.priority.value.ToString()); + + Outlook.UserProperty oProp = tItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = dResult.date_modified.value.ToString(); + Outlook.UserProperty oProp2 = tItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = dResult.id.value.ToString(); + tItem.Save(); + lTaskItems.Add(new cTaskItem + { + oItem = tItem, + OModifiedDate = dResult.date_modified.value.ToString(), + SEntryID = dResult.id.value.ToString(), + Touched = true + }); + } + else + { + oItem.Touched = true; + Outlook.TaskItem tItem = oItem.oItem; + Outlook.UserProperty oProp = tItem.UserProperties["SOModifiedDate"]; + + if (oProp.Value != dResult.date_modified.value.ToString()) + { + tItem.Subject = dResult.name.value.ToString(); + tItem.Body = dResult.description.value.ToString(); + if (!string.IsNullOrWhiteSpace(dResult.date_start.value.ToString())) + { + tItem.StartDate = DateTime.Parse(dResult.date_start.value.ToString()); + } + if (!string.IsNullOrWhiteSpace(dResult.date_due.value.ToString())) + { + tItem.DueDate = DateTime.Parse(dResult.date_due.value.ToString()); + } - //void app_FolderContextMenuDisplay(Office.CommandBar CommandBar, Outlook.MAPIFolder Folder) - //{ - // RibbonUI.InvalidateControlMso("FolderPropertiesContext"); - //} + tItem.Status = GetStatus(dResult.status.value.ToString()); + tItem.Importance = GetImportance(dResult.priority.value.ToString()); + if (oProp == null) + oProp = tItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = dResult.date_modified.value.ToString(); + Outlook.UserProperty oProp2 = tItem.UserProperties["SEntryID"]; + if (oProp2 == null) + oProp2 = tItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = dResult.id.value.ToString(); + tItem.Save(); + } + } + } + catch + { } + } + } + + try + { + var lItemToBeDeletedO = lTaskItems.Where(a => !a.Touched && !string.IsNullOrWhiteSpace(a.OModifiedDate)).ToList(); + foreach (var oItem in lItemToBeDeletedO) + { + oItem.oItem.Delete(); + } + lTaskItems.RemoveAll(a => !a.Touched && !string.IsNullOrWhiteSpace(a.OModifiedDate)); + + var lItemToBeAddedToS = lTaskItems.Where(a => !a.Touched && string.IsNullOrWhiteSpace(a.OModifiedDate)).ToList(); + foreach (var oItem in lItemToBeAddedToS) + { + AddTaskToS(oItem.oItem); + } + } + catch + { } + } + private void GetOutlookTItems(Outlook.MAPIFolder taskFolder) + { + if (lTaskItems == null) + { + lTaskItems = new List(); + Outlook.Items items = taskFolder.Items.Restrict("[MessageClass] = 'IPM.Task'"); + foreach (Outlook.TaskItem oItem in items) + { + Outlook.UserProperty oProp = oItem.UserProperties["SOModifiedDate"]; + if (oProp != null) + { + Outlook.UserProperty oProp2 = oItem.UserProperties["SEntryID"]; + lTaskItems.Add(new cTaskItem + { + oItem = oItem, + OModifiedDate = oProp.Value.ToString(), + SEntryID = oProp2.Value.ToString() + }); + } + else + { + lTaskItems.Add(new cTaskItem + { + oItem = oItem + }); + } + } + } + } + + void TItems_ItemChange(object Item) + { + if (!SyncInProgress && IsTaskView) + { + bool SyncOldStatus = SyncInProgress; + SyncInProgress = true; + var oItem = Item as Outlook.TaskItem; + if (PrevTaskID != oItem.EntryID) + { + Outlook.UserProperty oProp1 = oItem.UserProperties["SEntryID"]; + if (oProp1 != null) + { + AddTaskToS(oItem, oProp1.Value.ToString()); + } + } + SyncInProgress = SyncOldStatus; + } + } + + void TItems_ItemAdd(object Item) + { + if (!SyncInProgress && IsTaskView) + { + AddTaskToS(Item as Outlook.TaskItem); + } + } + private void AddTaskToS(Outlook.TaskItem oItem, string sID = "") + { + if (oItem != null) + { + try + { + PrevTaskID = oItem.EntryID; + string _result = ""; + eNameValue[] data = new eNameValue[7]; + string strStatus = ""; + string strImportance = ""; + switch (oItem.Status) + { + case Outlook.OlTaskStatus.olTaskNotStarted: + strStatus = "Not Started"; + break; + case Outlook.OlTaskStatus.olTaskInProgress: + strStatus = "In Progress"; + break; + case Outlook.OlTaskStatus.olTaskComplete: + strStatus = "Completed"; + break; + case Outlook.OlTaskStatus.olTaskDeferred: + strStatus = "Deferred"; + break; + } + switch (oItem.Importance) + { + case Outlook.OlImportance.olImportanceLow: + strImportance = "Low"; + break; + + case Outlook.OlImportance.olImportanceNormal: + strImportance = "Medium"; + break; + + case Outlook.OlImportance.olImportanceHigh: + strImportance = "High"; + break; + } + + DateTime uTCDateTime = new DateTime(); + DateTime time2 = new DateTime(); + uTCDateTime = this.GetUTCDateTime(oItem.StartDate); + time2 = this.GetUTCDateTime(oItem.DueDate); + string str = string.Format("{0:yyyy-MM-dd HH:mm:ss}", uTCDateTime); + string str2 = string.Format("{0:yyyy-MM-dd HH:mm:ss}", time2); + + data[0] = clsSuiteCRMHelper.SetNameValuePair("name", oItem.Subject); + data[1] = clsSuiteCRMHelper.SetNameValuePair("description", oItem.Body); + data[2] = clsSuiteCRMHelper.SetNameValuePair("status", strStatus); + data[3] = clsSuiteCRMHelper.SetNameValuePair("date_due", str2); + data[4] = clsSuiteCRMHelper.SetNameValuePair("date_start", str); + data[5] = clsSuiteCRMHelper.SetNameValuePair("priority", strImportance); + if (sID == "") + data[6] = clsSuiteCRMHelper.SetNameValuePair("assigned_user_id", clsSuiteCRMHelper.GetUserId()); + else + data[6] = clsSuiteCRMHelper.SetNameValuePair("id", sID); + + _result = clsSuiteCRMHelper.SetEntry(data, "Tasks"); + Outlook.UserProperty oProp = oItem.UserProperties["SOModifiedDate"]; + if (oProp == null) + oProp = oItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = "Fresh"; + Outlook.UserProperty oProp2 = oItem.UserProperties["SEntryID"]; + if (oProp2 == null) + oProp2 = oItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = _result; + oItem.Save(); + var sItem = lTaskItems.Where(a => a.oItem.EntryID == oItem.EntryID).FirstOrDefault(); + if (sItem != default(cTaskItem)) + { + sItem.oItem = oItem; + sItem.OModifiedDate = "Fresh"; + sItem.SEntryID = _result; + } + else + lTaskItems.Add(new cTaskItem { SEntryID = _result, OModifiedDate = "Fresh", oItem = oItem }); + } + catch + { } + } + } + void TItems_ItemRemove() + { + if (!SyncInProgress && IsTaskView) + { + if (sDelTaskId != "") + { + try + { + eNameValue[] data = new eNameValue[2]; + data[0] = clsSuiteCRMHelper.SetNameValuePair("id", sDelTaskId); + data[1] = clsSuiteCRMHelper.SetNameValuePair("deleted", "1"); + clsSuiteCRMHelper.SetEntry(data, "Tasks"); + lTaskItems.RemoveAll(a => a.SEntryID == sDelTaskId); + } + catch + { } + } + sDelTaskId = ""; + + } + } + void ToCalendarEvents_BeforeItemMove(object Item, Outlook.MAPIFolder MoveTo, ref bool Cancel) + { + if (!SyncInProgress && IsTaskView) + { + sDelTaskId = ""; + Outlook.TaskItem oTask = Item as Outlook.TaskItem; + if (oTask.UserProperties != null) + { + Outlook.UserProperty oProp = oTask.UserProperties["SEntryID"]; + if (oProp != null) + { + sDelTaskId = oProp.Value.ToString(); + } + } + } + } + private void StartCalendarSync() + { + Outlook.NameSpace oNS = this.Application.GetNamespace("mapi"); + Outlook.MAPIFolder appointmentsFolder = GetDefaultFolder("appointments"); + Outlook.Items items = appointmentsFolder.Items; + + items.ItemAdd -= Items_ItemAdd; + items.ItemChange -= Items_ItemChange; + items.ItemRemove -= Items_ItemRemove; + items.ItemAdd += Items_ItemAdd; + items.ItemChange += Items_ItemChange; + items.ItemRemove += Items_ItemRemove; + + Outlook.MAPIFolderEvents_12_Event oCalendarEvents; + oCalendarEvents = appointmentsFolder as Outlook.MAPIFolderEvents_12_Event; + if (oCalendarEvents != null) + { + oCalendarEvents.BeforeItemMove -= oCalendarEvents_BeforeItemMove; + oCalendarEvents.BeforeItemMove += oCalendarEvents_BeforeItemMove; + } + + SyncInProgress = true; + GetOutlookCalItems(appointmentsFolder); + SyncMeetings(appointmentsFolder, "Meetings"); + SyncMeetings(appointmentsFolder, "Calls"); + SyncInProgress = false; + + } + + void oCalendarEvents_BeforeItemMove(object Item, Outlook.MAPIFolder MoveTo, ref bool Cancel) + { + if (!SyncInProgress && IsCalendarView) + { + sDelCalId = ""; + sDelCalModule = ""; + Outlook.AppointmentItem oApp = Item as Outlook.AppointmentItem; + if (oApp.UserProperties != null) + { + Outlook.UserProperty oProp = oApp.UserProperties["SEntryID"]; + Outlook.UserProperty oProp1 = oApp.UserProperties["SType"]; + if (oProp != null && oProp1 != null) + { + sDelCalId = oProp.Value.ToString(); + sDelCalModule = oProp1.Value.ToString(); + } + } + } + } + + void Items_ItemRemove() + { + if (!SyncInProgress && IsCalendarView) + { + if (sDelCalId != "") + { + try + { + eNameValue[] data = new eNameValue[2]; + data[0] = clsSuiteCRMHelper.SetNameValuePair("id", sDelCalId); + data[1] = clsSuiteCRMHelper.SetNameValuePair("deleted", "1"); + clsSuiteCRMHelper.SetEntry(data, sDelCalModule); + lCalItems.RemoveAll(a => a.SEntryID == sDelCalId); + } + catch + { } + } + sDelCalId = ""; + sDelCalModule = ""; + } + } + + void Items_ItemChange(object Item) + { + if (!SyncInProgress && IsCalendarView) + { + bool SyncOldStatus = SyncInProgress; + SyncInProgress = true; + var aItem = Item as Outlook.AppointmentItem; + if (PrevCalSID != aItem.EntryID) + { + Outlook.UserProperty oProp = aItem.UserProperties["SType"]; + Outlook.UserProperty oProp1 = aItem.UserProperties["SEntryID"]; + if (oProp != null && oProp1 != null) + { + AddAppointmentToS(aItem, oProp.Value.ToString(), oProp1.Value.ToString()); + } + } + SyncInProgress = SyncOldStatus; + } + } + + void Items_ItemAdd(object Item) + { + if (!SyncInProgress && IsCalendarView) + { + AddAppointmentToS(Item as Outlook.AppointmentItem, "Meetings"); + } + } + + private void GetOutlookCalItems(Outlook.MAPIFolder appointmentsFolder) + { + if (lCalItems == null) + { + lCalItems = new List(); + Outlook.Items items = appointmentsFolder.Items.Restrict("[MessageClass] = 'IPM.Appointment'"); + foreach (Outlook.AppointmentItem aItem in items) + { + Outlook.UserProperty oProp = aItem.UserProperties["SOModifiedDate"]; + if (oProp != null) + { + Outlook.UserProperty oProp1 = aItem.UserProperties["SType"]; + Outlook.UserProperty oProp2 = aItem.UserProperties["SEntryID"]; + lCalItems.Add(new cAppItem + { + oItem = aItem, + OModifiedDate = oProp.Value.ToString(), + SType = oProp1.Value.ToString(), + SEntryID = oProp2.Value.ToString() + }); + } + else + { + lCalItems.Add(new cAppItem + { + oItem = aItem, + SType = "Meetings" + }); + } + } + } + } + private void SyncMeetings(Outlook.MAPIFolder appointmentsFolder, string sModule) + { + eGetEntryListResult _result2 = clsSuiteCRMHelper.GetEntryList(sModule, "", + 0, "date_entered DESC", 0, false, clsSuiteCRMHelper.GetSugarFields(sModule)); + if (_result2 != null) + { + foreach (var oResult in _result2.entry_list) + { + try + { + dynamic dResult = JsonConvert.DeserializeObject(oResult.name_value_object.ToString()); + var oItem = lCalItems.Where(a => a.SEntryID == dResult.id.value.ToString() && a.SType == sModule).FirstOrDefault(); + if (oItem == default(cAppItem)) + { + Outlook.AppointmentItem aItem = appointmentsFolder.Items.Add(Outlook.OlItemType.olAppointmentItem); + aItem.Subject = dResult.name.value.ToString(); + aItem.Body = dResult.description.value.ToString(); + if (!string.IsNullOrWhiteSpace(dResult.date_start.value.ToString())) + { + aItem.Start = DateTime.Parse(dResult.date_start.value.ToString()); + int iMin = 0, iHour = 0; + if (!string.IsNullOrWhiteSpace(dResult.duration_minutes.value.ToString())) + { + iMin = int.Parse(dResult.duration_minutes.value.ToString()); + } + if (!string.IsNullOrWhiteSpace(dResult.duration_hours.value.ToString())) + { + iHour = int.Parse(dResult.duration_hours.value.ToString()); + } + if (sModule == "Meetings") + { + aItem.Location = dResult.location.value.ToString(); + aItem.End = aItem.Start; + if (iHour > 0) + aItem.End.AddHours(iHour); + if (iMin > 0) + aItem.End.AddMinutes(iMin); + } + try + { + aItem.Duration = iMin + iHour * 60; + } + catch (Exception) + { } + } + Outlook.UserProperty oProp = aItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = dResult.date_modified.value.ToString(); + Outlook.UserProperty oProp1 = aItem.UserProperties.Add("SType", Outlook.OlUserPropertyType.olText); + oProp1.Value = sModule; + Outlook.UserProperty oProp2 = aItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = dResult.id.value.ToString(); + aItem.Save(); + lCalItems.Add(new cAppItem + { + oItem = aItem, + OModifiedDate = dResult.date_modified.value.ToString(), + SType = sModule, + SEntryID = dResult.id.value.ToString(), + Touched = true + }); + } + else + { + oItem.Touched = true; + Outlook.AppointmentItem aItem = oItem.oItem; + Outlook.UserProperty oProp = aItem.UserProperties["SOModifiedDate"]; + + if (oProp.Value != dResult.date_modified.value.ToString()) + { + aItem.Subject = dResult.name.value.ToString(); + aItem.Body = dResult.description.value.ToString(); + if (!string.IsNullOrWhiteSpace(dResult.date_start.value.ToString())) + { + aItem.Start = DateTime.Parse(dResult.date_start.value.ToString()); + int iMin = 0, iHour = 0; + if (!string.IsNullOrWhiteSpace(dResult.duration_minutes.value.ToString())) + { + iMin = int.Parse(dResult.duration_minutes.value.ToString()); + } + if (!string.IsNullOrWhiteSpace(dResult.duration_hours.value.ToString())) + { + iHour = int.Parse(dResult.duration_hours.value.ToString()); + } + if (sModule == "Meetings") + { + aItem.Location = dResult.location.value.ToString(); + aItem.End = aItem.Start; + if (iHour > 0) + aItem.End.AddHours(iHour); + if (iMin > 0) + aItem.End.AddMinutes(iMin); + } + try + { + aItem.Duration = iMin + iHour * 60; + } + catch (Exception) + { } + } + if (oProp == null) + oProp = aItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = dResult.date_modified.value.ToString(); + Outlook.UserProperty oProp1 = aItem.UserProperties["SType"]; + if (oProp1 == null) + oProp1 = aItem.UserProperties.Add("SType", Outlook.OlUserPropertyType.olText); + oProp1.Value = sModule; + Outlook.UserProperty oProp2 = aItem.UserProperties["SEntryID"]; + if (oProp2 == null) + oProp2 = aItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = dResult.id.value.ToString(); + aItem.Save(); + } + } + } + catch + { } + } + } + try + { + if (sModule == "Meetings") + { + var lItemToBeDeletedO = lCalItems.Where(a => !a.Touched && !string.IsNullOrWhiteSpace(a.OModifiedDate) && a.SType == sModule).ToList(); + foreach (var oItem in lItemToBeDeletedO) + { + oItem.oItem.Delete(); + } + lCalItems.RemoveAll(a => !a.Touched && !string.IsNullOrWhiteSpace(a.OModifiedDate) && a.SType == sModule); + } + var lItemToBeAddedToS = lCalItems.Where(a => !a.Touched && string.IsNullOrWhiteSpace(a.OModifiedDate) && a.SType == sModule).ToList(); + foreach (var oItem in lItemToBeAddedToS) + { + AddAppointmentToS(oItem.oItem, sModule); + } + } + catch + { } + } + private void AddAppointmentToS(Outlook.AppointmentItem aItem, string sModule, string sID = "") + { + if (aItem != null) + { + try + { + PrevCalSID = aItem.EntryID; + string _result = ""; + eNameValue[] data = new eNameValue[8]; + DateTime uTCDateTime = new DateTime(); + DateTime time2 = new DateTime(); + uTCDateTime = this.GetUTCDateTime(aItem.Start); + time2 = this.GetUTCDateTime(aItem.End); + string str = string.Format("{0:yyyy-MM-dd HH:mm:ss}", uTCDateTime); + string str2 = string.Format("{0:yyyy-MM-dd HH:mm:ss}", time2); + int num = aItem.Duration / 60; + int num2 = aItem.Duration % 60; + data[0] = clsSuiteCRMHelper.SetNameValuePair("name", aItem.Subject); + data[1] = clsSuiteCRMHelper.SetNameValuePair("description", aItem.Body); + data[2] = clsSuiteCRMHelper.SetNameValuePair("location", aItem.Location); + data[3] = clsSuiteCRMHelper.SetNameValuePair("date_start", str); + data[4] = clsSuiteCRMHelper.SetNameValuePair("date_end", str2); + data[5] = clsSuiteCRMHelper.SetNameValuePair("duration_minutes", num2.ToString()); + data[6] = clsSuiteCRMHelper.SetNameValuePair("duration_hours", num.ToString()); + if (sID == "") + data[7] = clsSuiteCRMHelper.SetNameValuePair("assigned_user_id", clsSuiteCRMHelper.GetUserId()); + else + data[7] = clsSuiteCRMHelper.SetNameValuePair("id", sID); + + _result = clsSuiteCRMHelper.SetEntry(data, sModule); + Outlook.UserProperty oProp = aItem.UserProperties["SOModifiedDate"]; + if (oProp == null) + oProp = aItem.UserProperties.Add("SOModifiedDate", Outlook.OlUserPropertyType.olText); + oProp.Value = "Fresh"; + Outlook.UserProperty oProp1 = aItem.UserProperties["SType"]; + if (oProp1 == null) + oProp1 = aItem.UserProperties.Add("SType", Outlook.OlUserPropertyType.olText); + oProp1.Value = sModule; + Outlook.UserProperty oProp2 = aItem.UserProperties["SEntryID"]; + if (oProp2 == null) + oProp2 = aItem.UserProperties.Add("SEntryID", Outlook.OlUserPropertyType.olText); + oProp2.Value = _result; + aItem.Save(); + var sItem = lCalItems.Where(a => a.oItem.EntryID == aItem.EntryID).FirstOrDefault(); + if (sItem != default(cAppItem)) + { + sItem.oItem = aItem; + sItem.OModifiedDate = "Fresh"; + sItem.SEntryID = _result; + } + else + { + lCalItems.Add(new cAppItem { SEntryID = _result, SType = sModule, OModifiedDate = "Fresh", oItem = aItem }); + } + } + catch + { } + } + } + public DateTime GetUTCDateTime(DateTime dateTime) + { + return dateTime.ToUniversalTime(); + } + + private void cbtnArchive_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault) { ManualArchive(); @@ -228,15 +1245,18 @@ private void Application_ItemSend(object item, ref bool target) { try { - if (item is Outlook.MailItem) + if (settings.AutoArchive) { - Outlook.MailItem objMail = (Outlook.MailItem)item; - if (objMail.UserProperties["SuiteCRM"] == null) + if (item is Outlook.MailItem) { - ArchiveEmail(objMail, 3, this.settings.ExcludedEmails); - objMail.UserProperties.Add("SuiteCRM", Outlook.OlUserPropertyType.olText, true, Outlook.OlUserPropertyType.olText); - objMail.UserProperties["SuiteCRM"].Value = "True"; - objMail.Save(); + Outlook.MailItem objMail = (Outlook.MailItem)item; + if (objMail.UserProperties["SuiteCRM"] == null) + { + ArchiveEmail(objMail, 3, this.settings.ExcludedEmails); + objMail.UserProperties.Add("SuiteCRM", Outlook.OlUserPropertyType.olText, true, Outlook.OlUserPropertyType.olText); + objMail.UserProperties["SuiteCRM"].Value = "True"; + objMail.Save(); + } } } } @@ -259,16 +1279,19 @@ private void Application_NewMail(string EntryID) { try { - var objItem = Globals.ThisAddIn.Application.Session.GetItemFromID(EntryID); - if (objItem is Outlook.MailItem) + if (settings.AutoArchive) { - Outlook.MailItem objMail = (Outlook.MailItem)objItem; - if (objMail.UserProperties["SuiteCRM"] == null) + var objItem = Globals.ThisAddIn.Application.Session.GetItemFromID(EntryID); + if (objItem is Outlook.MailItem) { - ArchiveEmail(objMail, 2, this.settings.ExcludedEmails); - objMail.UserProperties.Add("SuiteCRM", Outlook.OlUserPropertyType.olText, true, Outlook.OlUserPropertyType.olText); - objMail.UserProperties["SuiteCRM"].Value = "True"; - objMail.Save(); + Outlook.MailItem objMail = (Outlook.MailItem)objItem; + if (objMail.UserProperties["SuiteCRM"] == null) + { + ArchiveEmail(objMail, 2, this.settings.ExcludedEmails); + objMail.UserProperties.Add("SuiteCRM", Outlook.OlUserPropertyType.olText, true, Outlook.OlUserPropertyType.olText); + objMail.UserProperties["SuiteCRM"].Value = "True"; + objMail.Save(); + } } } } @@ -417,9 +1440,9 @@ private void ArchiveEmail(Outlook.MailItem objMail, int intArchiveType, string s { objEmail.Attachments.Add(new SuiteCRMClient.clsEmailAttachments { DisplayName = objMailAttachments.DisplayName, FileContentInBase64String = Base64Encode(objMailAttachments, objMail) }); } - System.Threading.Thread objThread = new System.Threading.Thread(() => ArchiveEmailThread(objEmail, intArchiveType, strExcludedEmails)); objThread.Start(); + } catch (Exception ex) { @@ -442,11 +1465,11 @@ private void ArchiveEmailThread(SuiteCRMClient.clsEmailArchive objEmail, int int try { if (SuiteCRMUserSession != null) - { + { while (SuiteCRMUserSession.AwaitingAuthentication == true) { System.Threading.Thread.Sleep(1000); - } + } if (SuiteCRMUserSession.id != "") { objEmail.SuiteCRMUserSession = SuiteCRMUserSession; @@ -542,7 +1565,21 @@ public byte[] Base64Encode(Outlook.Attachment objMailAttachment, Outlook.MailIte return strRet; } + public Outlook.MAPIFolder GetDefaultFolder(string type) + { + switch (type) + { + case "contacts": + return Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts); + + case "appointments": + return Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar); + case "tasks": + return Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderTasks); + } + return Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts); + } private void ArchiveFolderItems(Outlook.Folder objFolder, DateTime? dtAutoArchiveFrom = null) { try diff --git a/SuiteCRMAddIn/cItem.cs b/SuiteCRMAddIn/cItem.cs new file mode 100644 index 00000000..4433f770 --- /dev/null +++ b/SuiteCRMAddIn/cItem.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Outlook = Microsoft.Office.Interop.Outlook; + +namespace SuiteCRMAddIn +{ + public class cAppItem + { + public string SEntryID { get; set; } + public bool Touched { get; set; } + public string SType { get; set; } + public string OModifiedDate { get; set; } + public Outlook.AppointmentItem oItem { get; set; } + + } + + public class cTaskItem + { + public string SEntryID { get; set; } + public bool Touched { get; set; } + public string OModifiedDate { get; set; } + public Outlook.TaskItem oItem { get; set; } + + } + public class cContactItem + { + public string SEntryID { get; set; } + public bool Touched { get; set; } + public string OModifiedDate { get; set; } + public Outlook.ContactItem oItem { get; set; } + + } +} diff --git a/SuiteCRMAddIn/clsGlobals.cs b/SuiteCRMAddIn/clsGlobals.cs index a7c143f9..9667b9b2 100644 --- a/SuiteCRMAddIn/clsGlobals.cs +++ b/SuiteCRMAddIn/clsGlobals.cs @@ -109,5 +109,14 @@ public static string GetSenderAddress(MailItem mail, string type) } return mail.SenderEmailAddress; } + + public static string CleanHTML(string Input) + { + if (string.IsNullOrWhiteSpace(Input)) + return Input; + Input = Input.Replace("<", "<"); + Input = Input.Replace(">", ">"); + return Input; + } } } diff --git a/SuiteCRMAddIn/clsSettings.cs b/SuiteCRMAddIn/clsSettings.cs index 3f033c8a..43ff9c49 100644 --- a/SuiteCRMAddIn/clsSettings.cs +++ b/SuiteCRMAddIn/clsSettings.cs @@ -188,6 +188,30 @@ public bool AutoArchive this["AutoArchive"] = value; } } + [DefaultSettingValue("True"), DebuggerNonUserCode, UserScopedSetting] + public bool SyncCalendar + { + get + { + return (bool)this["SyncCalendar"]; + } + set + { + this["SyncCalendar"] = value; + } + } + [DefaultSettingValue("True"), DebuggerNonUserCode, UserScopedSetting] + public bool SyncContacts + { + get + { + return (bool)this["SyncContacts"]; + } + set + { + this["SyncContacts"] = value; + } + } [DefaultSettingValue(""), DebuggerNonUserCode, UserScopedSetting] public System.Collections.Generic.List AutoArchiveFolders { @@ -260,6 +284,34 @@ public bool ShowConfirmationMessageArchive { this["ShowConfirmationMessageArchive"] = value; } - } + } + [DebuggerNonUserCode, UserScopedSetting] + public StringCollection case_dropdown_priority + { + get + { + return (StringCollection)this["case_dropdown_priority"]; + } + set + { + this["case_dropdown_priority"] = value; + } + } + + [UserScopedSetting, DebuggerNonUserCode] + public StringCollection case_dropdown_status + { + get + { + return (StringCollection)this["case_dropdown_status"]; + } + set + { + this["case_dropdown_status"] = value; + } + } + + public static Hashtable accountEntrys = new Hashtable(); + public static AutoCompleteStringCollection accounts = new AutoCompleteStringCollection(); } } diff --git a/SuiteCRMAddIn/frmArchive.cs b/SuiteCRMAddIn/frmArchive.cs index 375b9550..2ff96e24 100644 --- a/SuiteCRMAddIn/frmArchive.cs +++ b/SuiteCRMAddIn/frmArchive.cs @@ -34,6 +34,7 @@ using System.Collections.Specialized; using Microsoft.Office.Interop.Outlook; using System.Runtime.InteropServices; +using System.Web; namespace SuiteCRMAddIn { @@ -277,7 +278,15 @@ public void Search(string query) str5 = "(accounts.name LIKE '%" + clsGlobals.MySqlEscape(usString) + "%') OR (accounts.id in (select eabr.bean_id from email_addr_bean_rel eabr INNER JOIN email_addresses ea on eabr.email_address_id = ea.id where eabr.bean_module = 'Accounts' and ea.email_address LIKE '%" + clsGlobals.MySqlEscape(query) + "%'))"; fields[4] = "account_name"; Label_0446: - _result = clsSuiteCRMHelper.GetEntryList(text, str5, settings.SyncMaxRecords, "date_entered DESC", 0, false, fields); + try + { + _result = clsSuiteCRMHelper.GetEntryList(text, str5, settings.SyncMaxRecords, "date_entered DESC", 0, false, fields); + } + catch (System.Exception ex1) + { + ex1.Data.Clear(); + _result = clsSuiteCRMHelper.GetEntryList(text, str5.Replace("%",""), settings.SyncMaxRecords, "date_entered DESC", 0, false, fields); + } if (_result.result_count > 0) { this.populateTree(_result, text, node); @@ -452,11 +461,17 @@ public string archiveEmail(MailItem itemFromID) goto Label_01A5; Label_017D: data[1] = clsSuiteCRMHelper.SetNameValuePair("date_sent", itemFromID.SentOn.ToString("yyyy-MM-dd HH:mm:ss")); - Label_01A5: - data[0] = clsSuiteCRMHelper.SetNameValuePair("name", subject); + Label_01A5: + TextBox oTB = new TextBox(); + oTB.Multiline = true; + oTB.WordWrap = false; + oTB.ScrollBars = ScrollBars.Both; + oTB.Text = itemFromID.Subject.Replace("&", "%26"); + data[0] = clsSuiteCRMHelper.SetNameValuePair("name", oTB.Text); data[2] = clsSuiteCRMHelper.SetNameValuePair("message_id", itemFromID.EntryID); data[3] = clsSuiteCRMHelper.SetNameValuePair("status", "archived"); - data[4] = clsSuiteCRMHelper.SetNameValuePair("description", body); + oTB.Text = itemFromID.Body.Replace("&", "%26"); + data[4] = clsSuiteCRMHelper.SetNameValuePair("description", oTB.Text); data[5] = clsSuiteCRMHelper.SetNameValuePair("description_html", hTMLBody); data[6] = clsSuiteCRMHelper.SetNameValuePair("from_addr", clsGlobals.GetSenderAddress(itemFromID, this.type)); data[7] = clsSuiteCRMHelper.SetNameValuePair("to_addrs", itemFromID.To); @@ -464,11 +479,11 @@ public string archiveEmail(MailItem itemFromID) data[9] = clsSuiteCRMHelper.SetNameValuePair("bcc_addrs", itemFromID.BCC); data[10] = clsSuiteCRMHelper.SetNameValuePair("reply_to_addr", itemFromID.ReplyRecipientNames); data[11] = clsSuiteCRMHelper.SetNameValuePair("assigned_user_id", clsSuiteCRMHelper.GetUserId()); - string str = clsSuiteCRMHelper.ArchiveEmail(data); + string str = clsSuiteCRMHelper.SetEntry(data); if (str.Length < 0x24) { - data[7] = clsSuiteCRMHelper.SetNameValuePair("description_html", ""); - str = clsSuiteCRMHelper.ArchiveEmail(data); + data[5] = clsSuiteCRMHelper.SetNameValuePair("description_html", ""); + str = clsSuiteCRMHelper.SetEntry(data); if (str.Length < 0x24) { return "-1"; diff --git a/SuiteCRMAddIn/frmSettings.Designer.cs b/SuiteCRMAddIn/frmSettings.Designer.cs index a5d00bdf..7ce99979 100644 --- a/SuiteCRMAddIn/frmSettings.Designer.cs +++ b/SuiteCRMAddIn/frmSettings.Designer.cs @@ -88,6 +88,8 @@ private void InitializeComponent() this.tabControl1 = new System.Windows.Forms.TabControl(); this.btnCancel = new System.Windows.Forms.Button(); this.btnSave = new System.Windows.Forms.Button(); + this.chkSyncCalendar = new System.Windows.Forms.CheckBox(); + this.chkSyncContacts = new System.Windows.Forms.CheckBox(); this.tabPage3.SuspendLayout(); this.tabPage2.SuspendLayout(); this.groupBox2.SuspendLayout(); @@ -101,6 +103,8 @@ private void InitializeComponent() // // tabPage3 // + this.tabPage3.Controls.Add(this.chkSyncContacts); + this.tabPage3.Controls.Add(this.chkSyncCalendar); this.tabPage3.Controls.Add(this.label7); this.tabPage3.Controls.Add(this.txtAutoSync); this.tabPage3.Controls.Add(this.tsResults); @@ -478,6 +482,26 @@ private void InitializeComponent() this.btnSave.UseVisualStyleBackColor = true; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // + // chkSyncCalendar + // + this.chkSyncCalendar.AutoSize = true; + this.chkSyncCalendar.Location = new System.Drawing.Point(15, 308); + this.chkSyncCalendar.Name = "chkSyncCalendar"; + this.chkSyncCalendar.Size = new System.Drawing.Size(95, 17); + this.chkSyncCalendar.TabIndex = 15; + this.chkSyncCalendar.Text = "Sync Calendar"; + this.chkSyncCalendar.UseVisualStyleBackColor = true; + // + // chkSyncContacts + // + this.chkSyncContacts.AutoSize = true; + this.chkSyncContacts.Location = new System.Drawing.Point(15, 332); + this.chkSyncContacts.Name = "chkSyncContacts"; + this.chkSyncContacts.Size = new System.Drawing.Size(95, 17); + this.chkSyncContacts.TabIndex = 16; + this.chkSyncContacts.Text = "Sync Contacts"; + this.chkSyncContacts.UseVisualStyleBackColor = true; + // // frmSettings // this.AcceptButton = this.btnSave; @@ -558,6 +582,8 @@ private void InitializeComponent() private System.Windows.Forms.Button btnSave; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.CheckBox chkShowConfirmationMessageArchive; + private System.Windows.Forms.CheckBox chkSyncContacts; + private System.Windows.Forms.CheckBox chkSyncCalendar; } } \ No newline at end of file diff --git a/SuiteCRMAddIn/frmSettings.cs b/SuiteCRMAddIn/frmSettings.cs index add753cf..1523f1d1 100644 --- a/SuiteCRMAddIn/frmSettings.cs +++ b/SuiteCRMAddIn/frmSettings.cs @@ -136,6 +136,8 @@ private void frmSettings_Load(object sender, EventArgs e) this.txtSyncMaxRecords.Text = this.settings.SyncMaxRecords.ToString(); this.checkBoxShowRightClick.Checked = this.settings.PopulateContextLookupList; this.chkAutoArchive.Checked = this.settings.AutoArchive; + this.chkSyncCalendar.Checked = this.settings.SyncCalendar; + this.chkSyncContacts.Checked = this.settings.SyncContacts; this.tsResults.AfterCheck += new TreeViewEventHandler(this.tree_search_results_AfterCheck); this.tsResults.AfterExpand += new TreeViewEventHandler(this.tree_search_results_AfterExpand); this.tsResults.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.tree_search_results_NodeMouseClick); @@ -290,7 +292,9 @@ private void btnTestLogin_Click(object sender, EventArgs e) Globals.ThisAddIn.SuiteCRMUserSession.AuthenticateLDAP(); } else + { Globals.ThisAddIn.SuiteCRMUserSession.Login(); + } if (Globals.ThisAddIn.SuiteCRMUserSession.id == "") { MessageBox.Show("Authentication failed!!!", "Authentication failed", MessageBoxButtons.OK, MessageBoxIcon.Error); @@ -336,11 +340,13 @@ private void chkEnableLDAPAuthentication_CheckedChanged(object sender, EventArgs { labelKey.Enabled = true; txtLDAPAuthenticationKey.Enabled = true; + txtLDAPAuthenticationKey.Text = settings.LDAPKey; } else { labelKey.Enabled = false; txtLDAPAuthenticationKey.Enabled = false; + txtLDAPAuthenticationKey.Text = ""; } } @@ -421,6 +427,8 @@ private void btnSave_Click(object sender, EventArgs e) } settings.AutoArchive = this.chkAutoArchive.Checked; + settings.SyncCalendar = this.chkSyncCalendar.Checked; + settings.SyncContacts = this.chkSyncContacts.Checked; settings.ShowConfirmationMessageArchive = this.chkShowConfirmationMessageArchive.Checked; if (this.txtSyncMaxRecords.Text != string.Empty) { diff --git a/SuiteCRMAddInSetup/SuiteCRMAddInSetup.isl b/SuiteCRMAddInSetup/SuiteCRMAddInSetup.isl index 17a21a73..adfb2bab 100644 --- a/SuiteCRMAddInSetup/SuiteCRMAddInSetup.isl +++ b/SuiteCRMAddInSetup/SuiteCRMAddInSetup.isl @@ -340,7 +340,8 @@ ISDotNetInstallerArgsUninstall ISDotNetInstallerArgsRollback ISX_DEFAULTCOMPONENT{47DC3583-1B85-4B83-8898-D4057742C505}INSTALLDIR217/LogFile=/LogFile=/LogFile=/LogFile= - Newtonsoft.Json.dll{13FB21D0-EDD1-47D8-AE25-2B7664FDFE08}INSTALLDIR2newtonsoft.json.dll17/LogFile=/LogFile=/LogFile=/LogFile= + ISX_DEFAULTCOMPONENT1{CF752638-4907-450F-A762-ED937A0E9D51}INSTALLDIR25817/LogFile=/LogFile=/LogFile=/LogFile= + Newtonsoft.Json.dll{8F129954-4BFF-4523-BFD1-9355815F4A5A}INSTALLDIR2newtonsoft.json.dll17/LogFile=/LogFile=/LogFile=/LogFile= SuiteCRMAddIn.Primary_output{C3AFF890-EE54-47A7-8D90-39F2BF44D01E}INSTALLDIR2suitecrmaddin.primary_output17/LogFile=/LogFile=/LogFile=/LogFile= @@ -1050,6 +1051,7 @@ Directory_Component_ +
INSTALLDIRISX_DEFAULTCOMPONENT1
@@ -1860,6 +1862,7 @@ Feature_Component_ +
AlwaysInstallISX_DEFAULTCOMPONENTAlwaysInstallISX_DEFAULTCOMPONENT1 AlwaysInstallNewtonsoft.Json.dll AlwaysInstallSuiteCRMAddIn.Primary_output
@@ -1876,10 +1879,10 @@ ISBuildSourcePath ISAttributes ISComponentSubFolder_ - newtonsoft.json.dllNewtonsoft.Json.dllNEWTON~1.DLL|Newtonsoft.Json.dll01D:\Mohan Kumar\Projects\Greg\SuiteCRMOutlookAddIn - V2 (Has both AE and VSTO version of V1)\SuiteCRMAddIn\bin\Debug\Newtonsoft.Json.dll1 - suitecrmaddin.dll.manifestISX_DEFAULTCOMPONENTSUITEC~1.MAN|SuiteCRMAddIn.dll.manifest01D:\Mohan Kumar\Projects\Greg\SuiteCRMOutlookAddIn - V2 (Has both AE and VSTO version of V1)\SuiteCRMAddIn\bin\Debug\SuiteCRMAddIn.dll.manifest1 + newtonsoft.json.dllNewtonsoft.Json.dllNEWTON~1.DLL|Newtonsoft.Json.dll01D:\SuiteCRM\Working Copy\SuiteCRMOutlookAddIn\SuiteCRMAddIn\bin\Debug\Newtonsoft.Json.dll1 + suitecrmaddin.dll.manifestISX_DEFAULTCOMPONENTSUITEC~1.MAN|SuiteCRMAddIn.dll.manifest01D:\SuiteCRM\Working Copy\SuiteCRMOutlookAddIn\SuiteCRMAddIn\bin\Debug\SuiteCRMAddIn.dll.manifest1 suitecrmaddin.primary_outputSuiteCRMAddIn.Primary_outputSuiteCRMAddIn.Primary output001<SuiteCRMAddIn>|Built3 - suitecrmaddin.vstoISX_DEFAULTCOMPONENTSUITEC~1.VST|SuiteCRMAddIn.vsto01D:\Mohan Kumar\Projects\Greg\SuiteCRMOutlookAddIn - V2 (Has both AE and VSTO version of V1)\SuiteCRMAddIn\bin\Debug\SuiteCRMAddIn.vsto1 + suitecrmaddin.vstoISX_DEFAULTCOMPONENTSUITEC~1.VST|SuiteCRMAddIn.vsto01D:\SuiteCRM\Working Copy\SuiteCRMOutlookAddIn\SuiteCRMAddIn\bin\Debug\SuiteCRMAddIn.vsto1 @@ -2025,7 +2028,8 @@ HTTPLocationMiscellaneous
ISX_DEFAULTCOMPONENT_30B7A77B_5D1A_4D6F_BD4D_E2B0995BFFFF_FILTER - Newtonsoft.Json.dll_D9CB9BA7_6D56_4E06_88A9_71BF8B49A29C_FILTER + ISX_DEFAULTCOMPONENT1_AEA5FF0E_7F99_4D23_86ED_B81515D69189_FILTER + Newtonsoft.Json.dll_8B1FE9AB_7FCA_4EB5_BC34_DFD0BAF5FC98_FILTER SuiteCRMAddIn.Primary_output_99EC7A64_5F26_47A4_8927_317EF14A2FB2_FILTER
@@ -2611,7 +2615,7 @@ Order ISSetupLocation ISReleaseFlags - _470891EF_1BF5_47AE_9BBA_DA2872FEAF38_Visual Studio 2010 Tools for Office Runtime.prq2 + _87BC9124_660F_4ED2_B17C_E31E8FE7BCD2_Microsoft VSTO 2010 Runtime.prq2 _D89610ED_62EC_4583_BEF4_136546520A99_Microsoft .NET Framework 4.5 Full.prq2 @@ -2646,7 +2650,7 @@ Encoded Comment TimeStamp - COMPANY_NAME1033SalesAgility0-1700637910 + COMPANY_NAME1033SalesAgility0-2128312591 DN_AlwaysInstall1033Always Install0849486892 IDPROP_EXPRESS_LAUNCH_CONDITION_COLOR1033The color settings of your system are not adequate for running [ProductName].0849486892 IDPROP_EXPRESS_LAUNCH_CONDITION_OS1033The operating system is not adequate for running [ProductName].0849486892 @@ -3746,9 +3750,9 @@ IDS__TargetReq_DESC_PROCESSOR1033The processor is not adequate for running [ProductName].0849486892 IDS__TargetReq_DESC_RAM1033The amount of RAM is not adequate for running [ProductName].0849486892 IDS__TargetReq_DESC_RESOLUTION1033The screen resolution is not adequate for running [ProductName].0849486892 - ID_STRING11033http://www.SalesAgility.com0-1700637910 - ID_STRING21033SalesAgility0-1700637910 - ID_STRING31033http://www.SalesAgility.com0-1700637910 + ID_STRING11033http://www.SalesAgility.com0-2128312591 + ID_STRING21033SalesAgility0-2128312591 + ID_STRING31033http://www.SalesAgility.com0-2128312591 ID_STRING41033http://www.salesagility.com0849487596 ID_STRING51033SuiteCRM Outlook AddIn0849508076 IIDS_UITEXT_FeatureUninstalled1033This feature will remain uninstalled.0849486892 @@ -4298,6 +4302,7 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA= Property Value ISComments + ALLUSERS1 ARPCOMMENTS##ID_STRING5## ARPCONTACT##ID_STRING4## ARPHELPLINK##ID_STRING3## @@ -4342,6 +4347,7 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA= InstallChoiceAR LAUNCHPROGRAM1 LAUNCHREADME1 + MSIFASTINSTALL2 Manufacturer##COMPANY_NAME## PIDKEY PIDTemplate12345<###-%%%%%%%>@@@@@ @@ -4370,7 +4376,7 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA= PROGMSG_IIS_ROLLBACKWEBSERVICEEXTENSIONS##IDS_PROGMSG_IIS_ROLLBACKWEBSERVICEEXTENSIONS## ProductCode{7D2339B3-980B-4AF0-8428-56ABB4CD7EF0} ProductNameSuiteCRMAddIn - ProductVersion1.1.0.7 + ProductVersion2.0.0.0 ProgressType0install ProgressType1Installing ProgressType2installed @@ -4437,11 +4443,15 @@ UwBpAG4AZwBsAGUASQBtAGEAZwBlAAEARQB4AHAAcgBlAHMAcwA= Value Component_ ISAttributes - Registry101SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInManifestfile:///[INSTALLDIR]SuiteCRMAddIn.vsto|vstolocalISX_DEFAULTCOMPONENT0 - Registry21SOFTWARE\Microsoft\Office\Outlook\AddinsISX_DEFAULTCOMPONENT1 - Registry71SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInDescriptionSuiteCRM Outlook AddInISX_DEFAULTCOMPONENT0 - Registry81SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInFriendlyNameSuiteCRM Outlook AddInISX_DEFAULTCOMPONENT0 - Registry91SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInLoadBehavior#3ISX_DEFAULTCOMPONENT0 + Registry12SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInManifestfile:///[INSTALLDIR]SuiteCRMAddIn.vsto|vstolocalISX_DEFAULTCOMPONENT0 + Registry112SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInDescriptionSuiteCRM Outlook AddInISX_DEFAULTCOMPONENT10 + Registry122SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInFriendlyNameSuiteCRM Outlook AddInISX_DEFAULTCOMPONENT10 + Registry132SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInLoadBehavior#3ISX_DEFAULTCOMPONENT10 + Registry21SOFTWAREISX_DEFAULTCOMPONENT1 + Registry32SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInDescriptionSuiteCRM Outlook AddInISX_DEFAULTCOMPONENT0 + Registry42SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInFriendlyNameSuiteCRM Outlook AddInISX_DEFAULTCOMPONENT0 + Registry52SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInLoadBehavior#3ISX_DEFAULTCOMPONENT0 + Registry62SOFTWARE\Microsoft\Office\Outlook\Addins\SalesAgility.SuiteCRMAddInManifestfile:///[INSTALLDIR]SuiteCRMAddIn.vsto|vstolocalISX_DEFAULTCOMPONENT10 diff --git a/SuiteCRMOutlookAddIn.sln b/SuiteCRMOutlookAddIn.sln index 23a8af67..fd841b04 100644 --- a/SuiteCRMOutlookAddIn.sln +++ b/SuiteCRMOutlookAddIn.sln @@ -1,6 +1,8 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuiteCRMClient", "SugarCRMClient\SuiteCRMClient.csproj", "{383E8EE7-604D-447D-A2C2-C50080D28F69}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuiteCRMAddIn", "SuiteCRMAddIn\SuiteCRMAddIn.csproj", "{8EF51293-040D-4A83-AFC3-9EA8C328B653}" @@ -11,10 +13,6 @@ Project("{6141683F-8A12-4E36-9623-2EB02B2C2303}") = "SuiteCRMAddInSetup", "Suite EndProjectSection EndProject Global - GlobalSection(SubversionScc) = preSolution - Svn-Managed = True - Manager = AnkhSVN - Subversion Support for Visual Studio - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution CD_ROM|Any CPU = CD_ROM|Any CPU CD_ROM|Mixed Platforms = CD_ROM|Mixed Platforms @@ -91,8 +89,8 @@ Global {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.CD_ROM|x86.Build.0 = CD_ROM {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.Debug|Any CPU.ActiveCfg = DVD-5 {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.Debug|Any CPU.Build.0 = DVD-5 - {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.Debug|Mixed Platforms.ActiveCfg = DVD-5 - {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.Debug|Mixed Platforms.Build.0 = DVD-5 + {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.Debug|Mixed Platforms.ActiveCfg = SingleImage + {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.Debug|Mixed Platforms.Build.0 = SingleImage {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.Debug|x86.ActiveCfg = DVD-5 {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.Debug|x86.Build.0 = DVD-5 {068824B4-9D40-4ACB-B21A-1F0BFA9C0D74}.DVD-5|Any CPU.ActiveCfg = DVD-5 @@ -117,4 +115,8 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(SubversionScc) = preSolution + Svn-Managed = True + Manager = AnkhSVN - Subversion Support for Visual Studio + EndGlobalSection EndGlobal diff --git a/SuiteCRMOutlookAddIn.v12.suo b/SuiteCRMOutlookAddIn.v12.suo new file mode 100644 index 00000000..d2bb5012 Binary files /dev/null and b/SuiteCRMOutlookAddIn.v12.suo differ diff --git a/UpgradeLog.htm b/UpgradeLog.htm new file mode 100644 index 00000000..3183bb4b Binary files /dev/null and b/UpgradeLog.htm differ diff --git a/setup.exe b/setup.exe index dfa6336a..c840d0b4 100644 Binary files a/setup.exe and b/setup.exe differ