title: How to identify "my" custom folder in an Outlook AddIn
body: <p>I'm trying to develop an AddIn - or rather, just a proof-of-concept for now, to see if what I have in mind is actually even possible - for Outlook (2010, to be exact), in .NET/C# and I'm facing the following problem:</p>
  
  <p>The AddIn is supposed to offer a new custom Folder (on the top level of the hierarchy, i.e. next to all the other main items, like Tasks, Calendar, Contacts, etc.) in which to offer items to the user. So I figured that in the Startup method of the AddIn I could simply do something like</p>
  
  <pre><code>Outlook.Folder parent = inBox.Parent as Outlook.Folder;
  Outlook.Folder myCustomFolder = (Outlook.Folder)parent.Folders.Add("My Custom Folder");
  </code></pre>
  
  <p>... and that does in fact work. However, there's a problem after quitting Outlook and starting it again. Since the folder is being persisted by Outlook, it is still there the next time Outlook launches and initializes the AddIn again, so the creation of the folder fails because an object of the same name already exists. But I don't see any way how to tell that this is "my" folder from last time.</p>
  
  <p>I don't want to rely on its <em>name</em> to identify the folder (that's just too unreliable to even consider; users might want to rename it, other AddIns might exist that create a folder of the same name, not to mention localization problems etc.), but what else can I use to determine that the custom folder has already been created?</p>
  
  <p>I would either have to be able to somehow add a "tag" do the folder so I can later recognize it as "mine" - or alternatively would need some kind of id that uniquely identifies the folder (and which remains constant even between launches of Outlook!) so I can recognize it by that.</p>
  
  <p>I have been looking at the <code>EntryID</code> and <code>StoreID</code> fields of the <code>[MAPI]Folder</code> object, but from the (sadly, not very detailed) description at the MSDN, I'm not sure if I can rely on them, because apparently they can change under certain conditions.</p>
  
  <p>Any suggestions?</p>