共用方式為


Outlook) (NameSpace.GetFolderFromID 方法

如果有效) ,則會傳回指定專案識別碼所識別 (Folder 物件。

語法

運算式GetFolderFromID (EntryIDFolderEntryIDStore)

表達 代表 NameSpace 物件的 變數。

參數

名稱 必要/選用 資料類型 描述
EntryIDFolder 必要 字串 資料夾的 EntryID
EntryIDStore 選用 Variant 資料夾的 StoreID

傳回值

代表指定資料夾的 Folder 物件。

註解

這個方法可用來簡化 MAPI 與 OLE/Messaging 應用程式與 Microsoft Outlook 之間的轉換。

範例

這個 Visual Basic for Applications (VBA) 範例會取得預設Tasks 資料夾的EntryIDStoreID,然後使用這些值來呼叫GetFolderFromID方法,以取得相同的資料夾。 然後顯示該資料夾。

Sub GetWithID() 
 
 Dim myFolder As Outlook.Folder 
 
 Dim myEntryID As String 
 
 Dim myStoreID As String 
 
 Dim myNewFolder As Outlook.Folder 
 
 
 
 Set myFolder = Application.Session.GetDefaultFolder (olFolderTasks) 
 
 myEntryID = myFolder.EntryID 
 
 myStoreID = myFolder.StoreID 
 
 Set myNewFolder = Application.Session.GetFolderFromID (myEntryID, myStoreID) 
 
 myNewFolder.Display 
 
End Sub

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應