0

I'm adding calendar folders as below (C#):

folder = parentFolder.Folders.Add(name, Outlook.OlDefaultFolders.olFolderCalendar);

Sometimes (with no visible pattern, it's quite random), the folder appears in Outlook calendar list, sometimes it doesn't. I'd say it's fifty/fifty. When I create several folders, it can fail for the 1st one in a row, or 3rd, or 2nd. Again, no pattern.

If I restart Outlook, the missing folder finally appear in calendar list. Also, these missing folders cannot be added to navigation groups programmatically (COMException with "try again later" text occurs).

When I check and compare properties of newly created Outlook.Folder in debug windows, I see they are identical for those which are ok and which are not. In particular, DefaultItemType and DefaultMessageClass are the same as for full-on calendar folders.

At the same time, these folder do appear in Outlook folder list (which you access by clicking "..." button and then "Folders" in the context menu). They can be selected there, their contents viewed, etc. But their icon is shown as for normal folder, not calendar folder. Also, on right-click menu, I see actions specific for normal folders, like "IMAP Folders". Upon Outlook restart, their icon changes to calendar's icon.

enter image description here

C1 and two other folders were created fine right from the start, several others (like t2) - have this issue.

All 8 folders are created with the same code within the same loop under the same conditions at the same time.

So, looks like sometimes Outlook creates a folder but without assigning its status as Calendar (more exactly, this assignment is delayed until Outlook restart). And it's absolutely intermittent.

Can this be worked around somehow? To "force" Outlook to assign the calendar status for a folder immediately?

The issue seems to be specific for Outlook 2016, the same never occurred for me with 2010 version. Honestly saying, it looks like a bug in Outlook but I need to work it around anyway and was hoping if someone may come with any suggestions.

EDIT: The issue reproduces even if I create a folder with MFCMAPI tool, no VSTO addin or Outlook COM API involved at all. Certainly a bug in Outlook 2016.

Even if create a calendar directly in Outlook UI with New Calendar command, it happens sometimes.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Alex
  • 2,469
  • 3
  • 28
  • 61
  • Where are these folders? Primary mailbox, PF store? a Delegate mailbox? When and where does your code run? – Dmitry Streblechenko Feb 23 '18 at 15:27
  • Primary mailbox (in an IMAP account), nothing special. Outlook 2016 32-bit on a Windows 10 64-bit box. The code is being run in VSTO add-in on UI thread. – Alex Feb 23 '18 at 15:33
  • I also checked the folders with MFCMapi. Good and bad ones have the same set of params, all flags are the same, etc. So there is no difference on MAPI level either. – Alex Feb 23 '18 at 16:00
  • 1
    IMAP4 is the worst store provider you can ever have in Outlook. Your won't have much luck... – Dmitry Streblechenko Feb 26 '18 at 15:40
  • Seems I'll have to ask the user to restart Outlook. As Outlook seems to be have the same issue (so that folders just created don't appear in Calendar until restart), I'm now confident the issue is not my bad coding and that's enough for me for the time being. – Alex Feb 27 '18 at 11:16

0 Answers0