title: Accessing folders in Outlook with VBA
body: <p>I'm using the following to move a mail to a folder in Outlook.</p>
  
  <pre><code>Dim chemin() as String
  
  chemin = Split(path, "/")
  Set myNameSpace = Application.GetNamespace("MAPI")
  Set myFolder = myNameSpace.Folders("LiveLink").Folders("Livelink HQE").Folders("Entreprise").Folders(chemin(1)).Folders(chemin(2)).Folders(chemin(3))
  
  myEntryID = myFolder.EntryID
  myEntryID = myFolder.StoreID
  
  objMail.Move myNameSpace.GetFolderFromID(myEntryID, storeID)    
  </code></pre>
  
  <p>Everything is actually working. As you can see, the folder is located into Livelink. And the Livelink server is actually quite slow to respond, and I can't do anything about it.</p>
  
  <p>My concern is about using the .Folders() so many times while it would be A LOT faster doing something like <code>.Folders("Livelink/root/folder1/folder2/")</code>. But this isn't working obviously, and because the .Folders command needs to ping the Livelink server everytime, it actually takes a whole 10 seconds just to execute this line of code (and the deeper is the folder, the longer it is to reach it).</p>
  
  <p>Is there any other way to directly access a specific folder in Outlook to move a mail? I know there is some kind of Outlook ID for each folders (even those in Livelink) but I don't see any way to make use of it. I've tried the following, but it's not working yet:</p>
  
  <pre><code>Dim folder As MAPIFolder
  Dim myNameSpace As Outlook.NameSpace
  Set myNameSpace = Application.GetNamespace("MAPI")
  Set folder = myNameSpace.GetFolderFromID(target, Application.GetNamespace("MAPI").Folders("LiveLink").storeID)
  </code></pre>
  
  <p>This gives me an error when doing GetFolderfromID(). The var <code>target</code> is actually the EntryID of the folder I want to copy the mail to.</p>