Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
Questioncalling all datagridview experts Pin
Tom Paronis28-Sep-11 8:47
Tom Paronis28-Sep-11 8:47 
AnswerRe: calling all datagridview experts Pin
Eddy Vluggen28-Sep-11 9:40
professionalEddy Vluggen28-Sep-11 9:40 
GeneralRe: calling all datagridview experts Pin
Tom Paronis28-Sep-11 11:07
Tom Paronis28-Sep-11 11:07 
AnswerRe: calling all datagridview experts Pin
Luc Pattyn28-Sep-11 11:00
sitebuilderLuc Pattyn28-Sep-11 11:00 
GeneralRe: calling all datagridview experts Pin
BobJanova28-Sep-11 22:30
BobJanova28-Sep-11 22:30 
QuestionHelp Pin
mazroni28-Sep-11 8:34
mazroni28-Sep-11 8:34 
AnswerRe: Help Pin
Eddy Vluggen28-Sep-11 9:46
professionalEddy Vluggen28-Sep-11 9:46 
QuestionOutlook 2007 Add-In Crashes Occasionally Pin
Matt U.28-Sep-11 3:56
Matt U.28-Sep-11 3:56 
I have written an Outlook 2007 Add-In using Visual Studio 2010 and C# (.NET 4.0). All is well most of the time but I encounter a crash in Outlook once in a while. When the crash occurs it is ONLY when Outlook is disconnected from the Microsoft Exchange server. My work laptop connects wirelessly and my job requires that I connect to two different local wireless networks, depending on the task(s) which I must complete. While on the primary network, Outlook is connected to my employer's MS Exchange server. On the other network, it disconnects (goes into Offline mode). Every once in a while, when disconnecting from the primary network, Outlook crashes, though not every time.

Below is the only code which is executed by the add-in. It runs periodically (every ten minutes).

C#
private void CheckFolderItemsMU(Outlook.Folder folder)
        {
            if (folder.Folders.Count > 0)
            {
                // Check the sub-folders first
                foreach (Outlook.Folder f in folder.Folders)
                    CheckFolderItemsMU(f);
            }

            // Do not continue if the folder is not a mail folder or if the mail folder is not searchable
            if (folder.DefaultItemType != Outlook.OlItemType.olMailItem) return;
            if (folder.Name == "Deleted Items" || folder.Name == "Sent Items" || folder.Name == "Outbox") return;
            if (folder.Parent.Name != "*COMPANYNAME*") return;

            Outlook.Items items = folder.Items;
            Outlook.MailItem mailItem = null;
            foreach (object collectionItem in items)
            {
                mailItem = collectionItem as Outlook.MailItem;
                if (mailItem != null)
                {
                    string subject = mailItem.Subject.ToUpper();
                    subject = subject.Replace("FW: ", "");
                    subject = subject.Replace("FWD: ", "");
                    subject = subject.Replace("RE: ", "");

                    // Only update the category if a category is not already assigned
                    if (mailItem.SenderName == "*NAMEOMITTED*")
                    {
                        if (string.IsNullOrEmpty(mailItem.Categories))
                            mailItem.Categories = "*NAMEOMITTED*";
                    }
                    else if (mailItem.SenderName == "*NAMEOMITTED*")
                    {
                        if (string.IsNullOrEmpty(mailItem.Categories))
                            mailItem.Categories = "LPS Data";
                    }
                    else    // Do not process the item
                        continue;

                    if (mailItem.IsMarkedAsTask) continue;
                    if (mailItem.Importance != Outlook.OlImportance.olImportanceHigh)
                        mailItem.Importance = Outlook.OlImportance.olImportanceHigh;

                    // Setup the follow-up information
                    mailItem.MarkAsTask(Outlook.OlMarkInterval.olMarkToday);
                    mailItem.TaskStartDate = DateTime.Now;
                    mailItem.TaskDueDate = DateTime.Now.AddHours(1);
                    if ((DateTime.Now.Hour > 14) && (DateTime.Now.Minute > 45))
                    {
                        // Late in the day; follow-up on the following morning (as long as the following day is not a weekend)
                        DateTime dateDue = DateTime.Now.AddDays(1);
                        if (dateDue.DayOfWeek == DayOfWeek.Saturday) dateDue = dateDue.AddDays(2);
                        else if (dateDue.DayOfWeek == DayOfWeek.Sunday) dateDue = dateDue.AddDays(1);

                        dateDue = new DateTime(dateDue.Year, dateDue.Month, dateDue.Day, 7, 0, 0);
                        mailItem.TaskDueDate = dateDue;
                    }
                    else    // Follow-up today
                        mailItem.TaskDueDate = DateTime.Now.AddMinutes(20);

                    mailItem.Save();
                }
            }
        }


Is there anything here which appears to be a problem while Outlook is in Offline Mode?
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.

QuestionRe: Outlook 2007 Add-In Crashes Occasionally Pin
Eddy Vluggen28-Sep-11 7:36
professionalEddy Vluggen28-Sep-11 7:36 
AnswerRe: Outlook 2007 Add-In Crashes Occasionally Pin
Matt U.28-Sep-11 7:41
Matt U.28-Sep-11 7:41 
GeneralRe: Outlook 2007 Add-In Crashes Occasionally Pin
Eddy Vluggen28-Sep-11 7:48
professionalEddy Vluggen28-Sep-11 7:48 
QuestionNeeded: WinForms CheckBox/RadioButton with HTML Text Pin
Steve Harp28-Sep-11 2:53
Steve Harp28-Sep-11 2:53 
AnswerRe: Needed: WinForms CheckBox/RadioButton with HTML Text Pin
BobJanova28-Sep-11 3:56
BobJanova28-Sep-11 3:56 
AnswerRe: Needed: WinForms CheckBox/RadioButton with HTML Text Pin
BillWoodruff28-Sep-11 3:59
professionalBillWoodruff28-Sep-11 3:59 
GeneralRe: Needed: WinForms CheckBox/RadioButton with HTML Text Pin
Steve Harp28-Sep-11 4:16
Steve Harp28-Sep-11 4:16 
GeneralRe: Needed: WinForms CheckBox/RadioButton with HTML Text Pin
BillWoodruff28-Sep-11 4:41
professionalBillWoodruff28-Sep-11 4:41 
AnswerRe: Needed: WinForms CheckBox/RadioButton with HTML Text Pin
Luc Pattyn28-Sep-11 4:31
sitebuilderLuc Pattyn28-Sep-11 4:31 
AnswerRe: Needed: WinForms CheckBox/RadioButton with HTML Text Pin
Eddy Vluggen28-Sep-11 9:30
professionalEddy Vluggen28-Sep-11 9:30 
QuestionUsing SIP CallOut and SIP UA examples Pin
DEEBETT27-Sep-11 22:53
DEEBETT27-Sep-11 22:53 
QuestionClient to Client TCP Chat program Pin
nitin_ion27-Sep-11 20:32
nitin_ion27-Sep-11 20:32 
AnswerRe: Client to Client TCP Chat program Pin
Richard MacCutchan27-Sep-11 22:23
mveRichard MacCutchan27-Sep-11 22:23 
AnswerRe: Client to Client TCP Chat program Pin
walterhevedeich27-Sep-11 22:34
professionalwalterhevedeich27-Sep-11 22:34 
AnswerRe: Client to Client TCP Chat program Pin
BobJanova27-Sep-11 22:38
BobJanova27-Sep-11 22:38 
GeneralRe: Client to Client TCP Chat program Pin
nitin_ion28-Sep-11 1:39
nitin_ion28-Sep-11 1:39 
GeneralRe: Client to Client TCP Chat program Pin
BobJanova28-Sep-11 3:21
BobJanova28-Sep-11 3:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.