CreateFolderType 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
类 CreateFolderType 表示创建文件夹的请求。
public ref class CreateFolderType : ExchangeWebServices::BaseRequestType
public class CreateFolderType : ExchangeWebServices.BaseRequestType
Public Class CreateFolderType
Inherits BaseRequestType
- 继承
示例
以下示例演示如何在收件箱中创建一组文件夹。 该示例创建常规文件夹、联系人文件夹和任务文件夹。
static void CreateFolder(ExchangeServiceBinding esb)
{
// Identify the folders to create.
FolderType folder1 = new FolderType();
ContactsFolderType folder2 = new ContactsFolderType();
TasksFolderType folder3 = new TasksFolderType();
folder1.DisplayName = "MyNewRegularFolder";
folder2.DisplayName = "MyNewContactsFolder";
folder3.DisplayName = "MyNewTasksFolder";
// Identify where the new folders are created.
DistinguishedFolderIdType distFolder = new DistinguishedFolderIdType();
distFolder.Id = DistinguishedFolderIdNameType.inbox;
TargetFolderIdType targetID = new TargetFolderIdType();
targetID.Item = distFolder;
// Create the request.
CreateFolderType <span class="label">createFolder</span> = new CreateFolderType();
<span class="label">createFolder</span>.Folders = new BaseFolderType[] { folder1, folder2, folder3 };
<span class="label">createFolder</span>.ParentFolderId = targetID;
try
{
// Send the request and get the response.
CreateFolderResponseType response = esb.CreateFolder(<span class="label">createFolder</span>);
// Get the response messages.
ResponseMessageType[] rmta = response.ResponseMessages.Items;
foreach (ResponseMessageType responseMessage in rmta)
{
// Perform error checks in production code.
FolderInfoResponseMessageType firmt = (responseMessage as FolderInfoResponseMessageType);
BaseFolderType[] folders = firmt.Folders;
foreach (BaseFolderType folder in folders)
{
if (folder is TasksFolderType)
{
TasksFolderType tft = (folder as TasksFolderType);
//TODO: Handle the task folder.
}
else if (folder is CalendarFolderType)
{
CalendarFolderType cft = (folder as CalendarFolderType);
// TODO: Handle the calendar folder.
}
else
{
//TODO: Handle the SearchFolderType, ContactsFolderType, and FolderType folders.
}
}
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
注解
类 CreateFolderType 用于创建任务文件夹、搜索文件夹、联系人文件夹、日历文件夹和常规文件夹。 可以使用 属性扩展 ExtendedProperty 新文件夹。
注意:CreateFolderType 类不会向邮箱添加托管文件夹。 有关如何将托管文件夹添加到邮箱的信息,请参阅 CreateManagedFolderRequestType、CreateManagedFolder作和添加托管文件夹。 有关演示如何实现托管文件夹的示例,请参阅 托管文件夹选择器示例
构造函数
| CreateFolderType() |
构造 CreateFolderType 函数初始化 类的新实例 CreateFolderType 。 |
属性
| Folders |
属性 Folders 获取或设置在 Exchange 数据库中创建的文件夹集。 此属性获取或设置一组 FolderType、 CalendarFolderType、 ContactsFolderType、 SearchFolderType或 TasksFolderType 对象。 此属性是必需项。 这是一个读/写属性。 |
| ParentFolderId |
属性 ParentFolderId 获取或设置将包含新创建的文件夹的文件夹的标识符。 此属性获取或设置一个 TargetFolderIdType,它可以是 FolderIdType 或 DistinguishedFolderIdType 对象。 此属性是必需项。 这是一个读/写属性。 |