GetFolderType 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
类 GetFolderType 表示从邮箱获取文件夹的请求。
public ref class GetFolderType : ExchangeWebServices::BaseRequestType
public class GetFolderType : ExchangeWebServices.BaseRequestType
Public Class GetFolderType
Inherits BaseRequestType
- 继承
示例
以下示例演示如何获取两个文件夹。 其中一个文件夹由 FolderId 属性标识,另一个文件夹由 DistinguishedFolderId 属性标识。 响应将包含为 AllProperties 响应形状定义的属性,以及 ManagedFolderInformation 属性提供的其他信息(如果它应用于 文件夹)。
static void GetFolder(ExchangeServiceBinding esb)
{
// Identify the folders to get.
FolderIdType folder1 = new FolderIdType();
DistinguishedFolderIdType sentitems = new DistinguishedFolderIdType();
folder1.Id = "AQAlAE1BQG";
sentitems.Id = DistinguishedFolderIdNameType.sentitems;
// Identify the folder properties to return.
FolderResponseShapeType properties = new FolderResponseShapeType();
PathToUnindexedFieldType ptuft = new PathToUnindexedFieldType();
ptuft.FieldURI = UnindexedFieldURIType.folderManagedFolderInformation;
PathToUnindexedFieldType[] ptufts = new PathToUnindexedFieldType[1] { ptuft };
properties.AdditionalProperties = ptufts;
properties.BaseShape = DefaultShapeNamesType.AllProperties;
// Form the get folder request.
GetFolderType <span class="label">request</span> = new GetFolderType();
<span class="label">request</span>.FolderIds = new BaseFolderIdType[2] { folder1, sentitems };
<span class="label">request</span>.FolderShape = properties;
try
{
// Send the request and get the response.
GetFolderResponseType response = esb.GetFolder(<span class="label">request</span>);
ArrayOfResponseMessagesType aormt = response.ResponseMessages;
ResponseMessageType[] rmta = aormt.Items;
foreach (ResponseMessageType rmt in rmta)
{
if (rmt.ResponseClass == ResponseClassType.Success)
{
FolderInfoResponseMessageType firmt;
firmt = (rmt as FolderInfoResponseMessageType);
BaseFolderType[] folders = firmt.Folders;
foreach (BaseFolderType folder in folders)
{
if (folder is CalendarFolderType)
{
CalendarFolderType calendar;
calendar = (folder as CalendarFolderType);
}
else if (folder is ContactsFolderType)
{
// Handle the contacts folder.
}
else
{
// Handle SearchFolderType, TasksFolderType,
// and FolderType.
}
}
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
注解
GetFolder作用于从 Exchange 邮箱获取常规、托管和默认文件夹。
构造函数
| GetFolderType() |
构造 GetFolderType 函数初始化 类的新实例 GetFolderType 。 |
属性
| FolderIds |
属性 FolderIds 获取或设置要获取的文件夹的标识符。 |
| FolderShape |
属性 FolderShape 获取或设置响应中要返回的属性。 |