命名空间 GetSharedDefaultFolder 方法 (Outlook)NameSpace.GetSharedDefaultFolder method (Outlook)

返回一个**Folder** 对象, 该对象代表指定用户的指定默认文件夹。Returns a Folder object that represents the specified default folder for the specified user.

语法Syntax

expressionexpression. GetSharedDefaultFolder( _Recipient_ , _FolderType_ )

_表达式_一个代表NameSpace对象的变量。expression A variable that represents a NameSpace object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
RecipientRecipient 必需Required RecipientRecipient 该文件夹的所有者。The owner of the folder. 请注意, 必须解析收件人对象。Note that the Recipient object must be resolved.
FolderTypeFolderType 必需Required OlDefaultFoldersOlDefaultFolders 文件夹的类型。The type of folder.

返回值Return value

一个代表指定用户的指定默认文件夹的folder对象。A Folder object that represents the specified default folder for the specified user.

说明Remarks

此方法在委派方案中使用, 其中一个用户已将其他用户的一个或多个默认文件夹 (例如, 其共享的 "日历" 文件夹) 的访问权限委派给另一个用户。This method is used in a delegation scenario, where one user has delegated access to another user for one or more of their default folders (for example, their shared Calendar folder).

_FolderType_可以是下列OlDefaultFolders常量之一: olFolderCalendarolFolderContactsolFolderDraftsolFolderInboxolFolderJournalolFolderNotesolFolderTasksFolderType can be one of the following OlDefaultFolders constants: olFolderCalendar, olFolderContacts, olFolderDrafts, olFolderInbox, olFolderJournal, olFolderNotes, or olFolderTasks. (常量 olFolderDeletedItemsolFolderOutboxolFolderJunkolFolderConflictsolFolderLocalFailuresolFolderServerFailuresolFolderSyncIssuesolPublicFoldersAllPublicFoldersolFolderRssSubscriptionsolFolderToDoolFolderManagedEmailolFolderSentMail 不能指定此参数。(The constants olFolderDeletedItems, olFolderOutbox, olFolderJunk, olFolderConflicts, olFolderLocalFailures, olFolderServerFailures, olFolderSyncIssues, olPublicFoldersAllPublicFolders, olFolderRssSubscriptions, olFolderToDo, olFolderManagedEmail, and olFolderSentMail cannot be specified for this argument.)

示例Example

本 Visual Basic for Applications (VBA) 示例使用GetSharedDefaultFolder方法来解析表示 dan Wilson 的收件人对象, 然后返回 dan 的共享的默认 "日历" 文件夹。This Visual Basic for Applications (VBA) example uses the GetSharedDefaultFolder method to resolve the Recipient object representing Dan Wilson, and then returns Dan's shared default Calendar folder.

Sub ResolveName() 
 
 Dim myNamespace As Outlook.NameSpace 
 
 Dim myRecipient As Outlook.Recipient 
 
 Dim CalendarFolder As Outlook.Folder 
 
 
 
 Set myNamespace = Application.GetNamespace("MAPI") 
 
 Set myRecipient = myNamespace.CreateRecipient("Dan Wilson") 
 
 myRecipient.Resolve 
 
 If myRecipient.Resolved Then 
 
 Call ShowCalendar(myNamespace, myRecipient) 
 
 End If 
 
End Sub 
 
 
 
Sub ShowCalendar(myNamespace, myRecipient) 
 
 Dim CalendarFolder As Outlook.Folder 
 
 
 
 Set CalendarFolder = _ 
 
 myNamespace.GetSharedDefaultFolder _ 
 
 (myRecipient, olFolderCalendar) 
 
 CalendarFolder.Display 
 
End Sub

另请参阅See also

命名空间对象NameSpace Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.