Beispiel #1
0
        public override void ProcessBeforeItemMove(object item, object moveTo, AddinExpress.MSO.ADXCancelEventArgs e)
        {
            if (item is Outlook._ContactItem)
            {
                Outlook._ContactItem movedContact = (Outlook._ContactItem)item;
                Outlook._Application outlookApp   = ((AddinModule)this.Module).OutlookApp;
                Outlook._JournalItem journalItem  = null;

                try
                {
                    journalItem = (Outlook._JournalItem)outlookApp.CreateItem(Outlook.OlItemType.olJournalItem);
                    if (moveTo != null)
                    {
                        Outlook.MAPIFolder targetFolder = (Outlook.MAPIFolder)moveTo;
                        journalItem.Subject = String.Format("You've moved {0} to {1}",
                                                            movedContact.FullName, targetFolder.FolderPath);
                        Marshal.ReleaseComObject(moveTo);
                    }
                    else
                    {
                        journalItem.Subject = String.Format("You've permanently deleted {0}",
                                                            movedContact.FullName);
                    }
                    journalItem.Save();
                }
                finally
                {
                    if (journalItem != null)
                    {
                        Marshal.ReleaseComObject(journalItem);
                    }
                }
            }
        }
Beispiel #2
0
        public override void ProcessItemAdd(object item)
        {
            if (item is Outlook._ContactItem)
            {
                Outlook._ContactItem newContact   = (Outlook._ContactItem)item;
                Outlook._Application outlookApp   = ((AddinModule)this.Module).OutlookApp;
                Outlook.MAPIFolder   targetFolder = (Outlook.MAPIFolder) this.FolderObj;
                Outlook._JournalItem journalItem  = null;

                try
                {
                    journalItem         = (Outlook._JournalItem)outlookApp.CreateItem(Outlook.OlItemType.olJournalItem);
                    journalItem.Subject = String.Format("You've added {0} to {1}",
                                                        newContact.FullName, targetFolder.FolderPath);
                    journalItem.Save();
                }
                finally
                {
                    if (journalItem != null)
                    {
                        Marshal.ReleaseComObject(journalItem);
                    }
                }
            }
        }
Beispiel #3
0
        public override void ProcessItemChange(object item)
        {
            if (item is Outlook._ContactItem)
            {
                Outlook._ContactItem changedContact = (Outlook._ContactItem)item;

                if (String.IsNullOrEmpty(changedContact.JobTitle))
                {
                    MessageBox.Show(String.Format("Please add a job title for {0}. All contacts must have proper titles",
                                                  changedContact.FullName), "Title Required");
                }
            }
        }
Beispiel #4
0
 public void AccumulateFields(Microsoft.Office.Interop.Outlook._ContactItem OutlookContact)
 {
     if (OutlookContact.Account != "")
     {
         Account++;
     }
     if (OutlookContact.Anniversary != MyFields.EmptyDate)
     {
         Anniversary++;
     }
     if (OutlookContact.AssistantName != "")
     {
         AssistantName++;
     }
     if (OutlookContact.AssistantTelephoneNumber != "")
     {
         AssistantTelephoneNumber++;
     }
     if (OutlookContact.BillingInformation != "")
     {
         BillingInformation++;
     }
     if (OutlookContact.Birthday != MyFields.EmptyDate)
     {
         Birthday++;
     }
     if (OutlookContact.Body != "")
     {
         Body++;
     }
     if (OutlookContact.Business2TelephoneNumber != "")
     {
         Business2TelephoneNumber++;
     }
     if (OutlookContact.BusinessAddress != "")
     {
         BusinessAddress++;
     }
     if (OutlookContact.BusinessAddressCity != "")
     {
         BusinessAddressCity++;
     }
     if (OutlookContact.BusinessAddressCountry != "")
     {
         BusinessAddressCountry++;
     }
     if (OutlookContact.BusinessAddressPostalCode != "")
     {
         BusinessAddressPostalCode++;
     }
     if (OutlookContact.BusinessAddressPostOfficeBox != "")
     {
         BusinessAddressPostOfficeBox++;
     }
     if (OutlookContact.BusinessAddressState != "")
     {
         BusinessAddressState++;
     }
     if (OutlookContact.BusinessAddressStreet != "")
     {
         BusinessAddressStreet++;
     }
     if (OutlookContact.BusinessFaxNumber != "")
     {
         BusinessFaxNumber++;
     }
     if (OutlookContact.BusinessHomePage != "")
     {
         BusinessHomePage++;
     }
     if (OutlookContact.BusinessTelephoneNumber != "")
     {
         BusinessTelephoneNumber++;
     }
     if (OutlookContact.CallbackTelephoneNumber != "")
     {
         CallbackTelephoneNumber++;
     }
     if (OutlookContact.CarTelephoneNumber != "")
     {
         CarTelephoneNumber++;
     }
     if (OutlookContact.Categories != "")
     {
         Categories++;
     }
     if (OutlookContact.Children != "")
     {
         Children++;
     }
     if (OutlookContact.Companies != "")
     {
         Companies++;
     }
     if (OutlookContact.CompanyAndFullName != "")
     {
         CompanyAndFullName++;
     }
     if (OutlookContact.CompanyMainTelephoneNumber != "")
     {
         CompanyMainTelephoneNumber++;
     }
     if (OutlookContact.CompanyName != "")
     {
         CompanyName++;
     }
     if (OutlookContact.ComputerNetworkName != "")
     {
         ComputerNetworkName++;
     }
     if (OutlookContact.CreationTime != MyFields.EmptyDate)
     {
         CreationTime++;
     }
     if (OutlookContact.CustomerID != "")
     {
         CustomerID++;
     }
     if (OutlookContact.Department != "")
     {
         Department++;
     }
     if (OutlookContact.Email1Address != "")
     {
         Email1Address++;
     }
     if (OutlookContact.Email1AddressType != "")
     {
         Email1AddressType++;
     }
     if (OutlookContact.Email1DisplayName != "")
     {
         Email1DisplayName++;
     }
     if (OutlookContact.Email2Address != "")
     {
         Email2Address++;
     }
     if (OutlookContact.Email2AddressType != "")
     {
         Email2AddressType++;
     }
     if (OutlookContact.Email2DisplayName != "")
     {
         Email2DisplayName++;
     }
     if (OutlookContact.Email3Address != "")
     {
         Email3Address++;
     }
     if (OutlookContact.Email3AddressType != "")
     {
         Email3AddressType++;
     }
     if (OutlookContact.Email3DisplayName != "")
     {
         Email3DisplayName++;
     }
     if (OutlookContact.EntryID != "")
     {
         EntryID++;
     }
     if (OutlookContact.FileAs != "")
     {
         FileAs++;
     }
     if (OutlookContact.FirstName != "")
     {
         FirstName++;
     }
     if (OutlookContact.FTPSite != "")
     {
         FTPSite++;
     }
     if (OutlookContact.FullName != "")
     {
         FullName++;
     }
     if (OutlookContact.FullNameAndCompany != "")
     {
         FullNameAndCompany++;
     }
     if (OutlookContact.Gender != MyFields.EmptyGender)
     {
         Gender++;
     }
     if (OutlookContact.GovernmentIDNumber != "")
     {
         GovernmentIDNumber++;
     }
     if (OutlookContact.Hobby != "")
     {
         Hobby++;
     }
     if (OutlookContact.Home2TelephoneNumber != "")
     {
         Home2TelephoneNumber++;
     }
     if (OutlookContact.HomeAddress != "")
     {
         HomeAddress++;
     }
     if (OutlookContact.HomeAddressCity != "")
     {
         HomeAddressCity++;
     }
     if (OutlookContact.HomeAddressCountry != "")
     {
         HomeAddressCountry++;
     }
     if (OutlookContact.HomeAddressPostalCode != "")
     {
         HomeAddressPostalCode++;
     }
     if (OutlookContact.HomeAddressPostOfficeBox != "")
     {
         HomeAddressPostOfficeBox++;
     }
     if (OutlookContact.HomeAddressState != "")
     {
         HomeAddressState++;
     }
     if (OutlookContact.HomeAddressStreet != "")
     {
         HomeAddressStreet++;
     }
     if (OutlookContact.HomeFaxNumber != "")
     {
         HomeFaxNumber++;
     }
     if (OutlookContact.HomeTelephoneNumber != "")
     {
         HomeTelephoneNumber++;
     }
     if (OutlookContact.Importance != MyFields.EmptyImportance)
     {
         Importance++;
     }
     if (OutlookContact.Initials != "")
     {
         Initials++;
     }
     if (OutlookContact.ISDNNumber != "")
     {
         ISDNNumber++;
     }
     if (OutlookContact.JobTitle != "")
     {
         JobTitle++;
     }
     if (OutlookContact.Journal != MyFields.EmptyJournal)
     {
         Journal++;
     }
     if (OutlookContact.Language != "")
     {
         Language++;
     }
     if (OutlookContact.LastModificationTime != MyFields.EmptyDate)
     {
         LastModificationTime++;
     }
     if (OutlookContact.LastName != "")
     {
         LastName++;
     }
     if (OutlookContact.LastNameAndFirstName != "")
     {
         LastNameAndFirstName++;
     }
     if (OutlookContact.MailingAddress != "")
     {
         MailingAddress++;
     }
     if (OutlookContact.MailingAddressCity != "")
     {
         MailingAddressCity++;
     }
     if (OutlookContact.MailingAddressCountry != "")
     {
         MailingAddressCountry++;
     }
     if (OutlookContact.MailingAddressPostalCode != "")
     {
         MailingAddressPostalCode++;
     }
     if (OutlookContact.MailingAddressPostOfficeBox != "")
     {
         MailingAddressPostOfficeBox++;
     }
     if (OutlookContact.MailingAddressState != "")
     {
         MailingAddressState++;
     }
     if (OutlookContact.MailingAddressStreet != "")
     {
         MailingAddressStreet++;
     }
     if (OutlookContact.ManagerName != "")
     {
         ManagerName++;
     }
     if (OutlookContact.MessageClass != "")
     {
         MessageClass++;
     }
     if (OutlookContact.MiddleName != "")
     {
         MiddleName++;
     }
     if (OutlookContact.Mileage != "")
     {
         Mileage++;
     }
     if (OutlookContact.MobileTelephoneNumber != "")
     {
         MobileTelephoneNumber++;
     }
     if (OutlookContact.NickName != "")
     {
         NickName++;
     }
     if (OutlookContact.NoAging != MyFields.EmptyNoAging)
     {
         NoAging++;
     }
     if (OutlookContact.OfficeLocation != "")
     {
         OfficeLocation++;
     }
     if (OutlookContact.OrganizationalIDNumber != "")
     {
         OrganizationalIDNumber++;
     }
     if (OutlookContact.OtherAddress != "")
     {
         OtherAddress++;
     }
     if (OutlookContact.OtherAddressCity != "")
     {
         OtherAddressCity++;
     }
     if (OutlookContact.OtherAddressCountry != "")
     {
         OtherAddressCountry++;
     }
     if (OutlookContact.OtherAddressPostalCode != "")
     {
         OtherAddressPostalCode++;
     }
     if (OutlookContact.OtherAddressPostOfficeBox != "")
     {
         OtherAddressPostOfficeBox++;
     }
     if (OutlookContact.OtherAddressState != "")
     {
         OtherAddressState++;
     }
     if (OutlookContact.OtherAddressStreet != "")
     {
         OtherAddressStreet++;
     }
     if (OutlookContact.OtherFaxNumber != "")
     {
         OtherFaxNumber++;
     }
     if (OutlookContact.OtherTelephoneNumber != "")
     {
         OtherTelephoneNumber++;
     }
     if (OutlookContact.OutlookInternalVersion > 0)
     {
         OutlookInternalVersion++;
     }
     if (OutlookContact.OutlookVersion != "")
     {
         OutlookVersion++;
     }
     if (OutlookContact.PagerNumber != "")
     {
         PagerNumber++;
     }
     if (OutlookContact.PersonalHomePage != "")
     {
         PersonalHomePage++;
     }
     if (OutlookContact.PrimaryTelephoneNumber != "")
     {
         PrimaryTelephoneNumber++;
     }
     if (OutlookContact.Profession != "")
     {
         Profession++;
     }
     if (OutlookContact.RadioTelephoneNumber != "")
     {
         RadioTelephoneNumber++;
     }
     if (OutlookContact.ReferredBy != "")
     {
         ReferredBy++;
     }
     if (OutlookContact.Saved != MyFields.EmptySaved)
     {
         Saved++;
     }
     if (OutlookContact.SelectedMailingAddress != MyFields.EmptyMailingAddress)
     {
         SelectedMailingAddress++;
     }
     if (OutlookContact.Sensitivity != MyFields.EmptySensitivity)
     {
         Sensitivity++;
     }
     if (OutlookContact.Size != 0)
     {
         Size++;
     }
     if (OutlookContact.Spouse != "")
     {
         Spouse++;
     }
     if (OutlookContact.Subject != "")
     {
         Subject++;
     }
     if (OutlookContact.Suffix != "")
     {
         Suffix++;
     }
     if (OutlookContact.TelexNumber != "")
     {
         TelexNumber++;
     }
     if (OutlookContact.Title != "")
     {
         Title++;
     }
     if (OutlookContact.TTYTDDTelephoneNumber != "")
     {
         TTYTDDTelephoneNumber++;
     }
     if (OutlookContact.UnRead != MyFields.EmptyUnRead)
     {
         UnRead++;
     }
     if (OutlookContact.User1 != "")
     {
         User1++;
     }
     if (OutlookContact.User2 != "")
     {
         User2++;
     }
     if (OutlookContact.User3 != "")
     {
         User3++;
     }
     if (OutlookContact.User4 != "")
     {
         User4++;
     }
     if (OutlookContact.UserCertificate != "")
     {
         UserCertificate++;
     }
     if (OutlookContact.WebPage != "")
     {
         WebPage++;
     }
     if (OutlookContact.YomiCompanyName != "")
     {
         YomiCompanyName++;
     }
     if (OutlookContact.YomiFirstName != "")
     {
         YomiFirstName++;
     }
     if (OutlookContact.YomiLastName != "")
     {
         YomiLastName++;
     }
     //if (OutlookContact.ContactIndex                 != "") ContactIndex                 ++;
     //if (OutlookContact.Actions                      != "") Actions                      ++;
     //if (OutlookContact.Application                  != "") Application                  ++;
     //if (OutlookContact.Attachments                  != "") Attachments                  ++;
     //if (OutlookContact.Email1EntryID                != "") Email1EntryID                ++;
     //if (OutlookContact.Email2EntryID                != "") Email2EntryID                ++;
     //if (OutlookContact.Email3EntryID                != "") Email3EntryID                ++;
     //if (OutlookContact.FormDescription              != "") FormDescription              ++;
     //if (OutlookContact.GetInspector                 != "") GetInspector                 ++;
     //if (OutlookContact.Parent                       != "") Parent                       ++;
     //if (OutlookContact.UserProperties               != "") UserProperties               ++;
 }
 public OutlookContactItem(Outlook._ContactItem item)
 {
     _contactItem = item;
 }