本文整理汇总了C#中IMailFolder类的典型用法代码示例。如果您正苦于以下问题:C# IMailFolder类的具体用法?C# IMailFolder怎么用?C# IMailFolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMailFolder类属于命名空间,在下文中一共展示了IMailFolder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateFolderNode
TreeNode CreateFolderNode (IMailFolder folder)
{
var node = new TreeNode (folder.Name) { Tag = folder, ToolTipText = folder.FullName };
node.NodeFont = new Font (Font, FontStyle.Regular);
if (folder == Program.Client.Inbox)
node.SelectedImageKey = node.ImageKey = "inbox";
else if (folder.Attributes.HasFlag (FolderAttributes.Archive))
node.SelectedImageKey = node.ImageKey = "archive";
else if (folder.Attributes.HasFlag (FolderAttributes.Drafts))
node.SelectedImageKey = node.ImageKey = "drafts";
else if (folder.Attributes.HasFlag (FolderAttributes.Flagged))
node.SelectedImageKey = node.ImageKey = "important";
else if (folder.Attributes.HasFlag (FolderAttributes.Junk))
node.SelectedImageKey = node.ImageKey = "junk";
else if (folder.Attributes.HasFlag (FolderAttributes.Sent))
node.SelectedImageKey = node.ImageKey = "sent";
else if (folder.Attributes.HasFlag (FolderAttributes.Trash))
node.SelectedImageKey = node.ImageKey = folder.Count > 0 ? "trash-full" : "trash-empty";
else
node.SelectedImageKey = node.ImageKey = "folder";
if (CheckFolderForChildren (folder))
node.Nodes.Add ("Loading...");
return node;
}
开发者ID:rajeshwarn,项目名称:MailKit,代码行数:28,代码来源:FolderTreeView.cs
示例2: OpenFolder
public async void OpenFolder (IMailFolder folder)
{
if (this.folder == folder)
return;
if (this.folder != null) {
this.folder.MessageFlagsChanged -= MessageFlagsChanged_TaskThread;
this.folder.MessageExpunged -= MessageExpunged_TaskThread;
this.folder.MessagesArrived -= MessagesArrived_TaskThread;
}
// Note: because we are using the *Async() methods, these events will fire
// in another thread so we'll have to proxy them back to the main thread.
folder.MessageFlagsChanged += MessageFlagsChanged_TaskThread;
folder.MessageExpunged += MessageExpunged_TaskThread;
this.folder = folder;
if (folder.IsOpen) {
LoadMessages ();
return;
}
await folder.OpenAsync (FolderAccess.ReadOnly);
LoadMessages ();
}
开发者ID:repne,项目名称:MailKit,代码行数:26,代码来源:MessageList.cs
示例3: MessageListViewController
public MessageListViewController (IMailFolder folder) : base (UITableViewStyle.Grouped, null, true)
{
Folder = folder;
Root = new RootElement (folder.FullName) {
new Section ()
};
}
开发者ID:repne,项目名称:MailKit,代码行数:8,代码来源:MessageListViewController.cs
示例4: CheckFolderForChildren
static bool CheckFolderForChildren (IMailFolder folder)
{
if (Program.Client.Capabilities.HasFlag (ImapCapabilities.Children)) {
if (folder.Attributes.HasFlag (FolderAttributes.HasChildren))
return true;
} else if (!folder.Attributes.HasFlag (FolderAttributes.NoInferiors)) {
return true;
}
return false;
}
开发者ID:rajeshwarn,项目名称:MailKit,代码行数:11,代码来源:FolderTreeView.cs
示例5: LoadChildFolders
// Recursive function to load all folders and their subfolders
async Task LoadChildFolders (Section foldersSection, IMailFolder folder)
{
if (!folder.IsNamespace) {
foldersSection.Add (new StyledStringElement (folder.FullName, () =>
OpenFolder (folder)));
}
var subfolders = await folder.GetSubfoldersAsync ();
foreach (var sf in subfolders)
await LoadChildFolders (foldersSection, sf);
}
开发者ID:naeemkhedarun,项目名称:MailKit,代码行数:13,代码来源:FoldersViewController.cs
示例6: Analyze
public static void Analyze(IMailFolder folder, LearningDataSet result) {
var messages = folder.Search(SearchQuery.All);
if (messages.Count > 0) {
foreach (var messageUid in messages) {
var message = folder.GetMessage(messageUid);
AnalyzeMessage(message, result);
}
}
result.LastUpdate = DateTime.Now;
}
开发者ID:LinuxDoku,项目名称:ResiLab.MailFilter,代码行数:13,代码来源:MailBoxFolderAnalyzer.cs
示例7: UpdateFolderNode
void UpdateFolderNode (IMailFolder folder)
{
var node = map[folder];
if (folder.Unread > 0) {
node.Text = string.Format ("{0} ({1})", folder.Name, folder.Unread);
node.NodeFont = new Font (node.NodeFont, FontStyle.Bold);
} else {
node.NodeFont = new Font (node.NodeFont, FontStyle.Regular);
node.Text = folder.Name;
}
if (folder.Attributes.HasFlag (FolderAttributes.Trash))
node.SelectedImageKey = node.ImageKey = folder.Count > 0 ? "trash-full" : "trash-empty";
}
开发者ID:rajeshwarn,项目名称:MailKit,代码行数:15,代码来源:FolderTreeView.cs
示例8: LoadChildFolders
// Recursive function to load all folders and their subfolders
async Task LoadChildFolders (Section foldersSection, IMailFolder folder)
{
if (!folder.IsNamespace) {
foldersSection.Add (new StyledStringElement (folder.FullName, () =>
OpenFolder (folder)));
}
if (folder.Attributes.HasFlag (FolderAttributes.HasNoChildren))
return;
var subfolders = await folder.GetSubfoldersAsync ();
foreach (var sf in subfolders)
await LoadChildFolders (foldersSection, sf);
}
开发者ID:Gekctek,项目名称:MailKit,代码行数:16,代码来源:FoldersViewController.cs
示例9: ProcessAnalysis
private void ProcessAnalysis(IMailFolder inbox) {
if ((_mailBox.Spam == null) || (_mailBox.Spam.EnableSpamProtection == false)) {
return;
}
_learningData = _learningStorage.Read();
var needToUpdateData = _learningData.LastUpdate < DateTime.Now.Subtract(TimeSpan.FromMinutes(_mailBox.Spam.AnalysisInterval));
if (needToUpdateData) {
var targetFolder = inbox.GetSubfolder(_mailBox.Spam.Target);
targetFolder.Open(FolderAccess.ReadOnly);
MailBoxFolderAnalyzer.Analyze(targetFolder, _learningData);
_learningStorage.Save(_learningData);
}
}
开发者ID:LinuxDoku,项目名称:ResiLab.MailFilter,代码行数:16,代码来源:MailBoxProcessor.cs
示例10: ProcessRules
private void ProcessRules(IMailFolder inbox) {
inbox.Open(FolderAccess.ReadWrite);
inbox.Status(StatusItems.Unread);
if (inbox.Unread > 0) {
var unreadMessageUids = inbox.Search(SearchQuery.NotSeen);
var toMove = new Dictionary<string, List<UniqueId>>();
var markAsRead = new List<UniqueId>();
// process unread messages
foreach (var unreadMessageUid in unreadMessageUids) {
var message = inbox.GetMessage(unreadMessageUid);
var matchingRule = GetMatchingRule(message);
if (matchingRule != null) {
if (!toMove.ContainsKey(matchingRule.Destination)) {
toMove.Add(matchingRule.Destination, new List<UniqueId>());
}
toMove[matchingRule.Destination].Add(unreadMessageUid);
if (matchingRule.MarkAsRead) {
markAsRead.Add(unreadMessageUid);
}
}
}
// mark as read
if (markAsRead.Any()) {
inbox.AddFlags(markAsRead, MessageFlags.Seen, true);
}
// move to destination
if (toMove.Any()) {
foreach (var destination in toMove.Keys) {
inbox.MoveTo(toMove[destination], inbox.GetSubfolder(destination));
}
}
}
}
开发者ID:LinuxDoku,项目名称:ResiLab.MailFilter,代码行数:40,代码来源:MailBoxProcessor.cs
示例11: ProcessResponseCodes
void ProcessResponseCodes (ImapCommand ic, IMailFolder folder)
{
bool tryCreate = false;
foreach (var code in ic.RespCodes) {
switch (code.Type) {
case ImapResponseCodeType.Alert:
Engine.OnAlert (code.Message);
break;
case ImapResponseCodeType.PermanentFlags:
PermanentFlags = ((PermanentFlagsResponseCode) code).Flags;
break;
case ImapResponseCodeType.ReadOnly:
Access = FolderAccess.ReadOnly;
break;
case ImapResponseCodeType.ReadWrite:
Access = FolderAccess.ReadWrite;
break;
case ImapResponseCodeType.TryCreate:
tryCreate = true;
break;
case ImapResponseCodeType.UidNext:
UidNext = ((UidNextResponseCode) code).Uid;
break;
case ImapResponseCodeType.UidValidity:
UidValidity = ((UidValidityResponseCode) code).UidValidity;
break;
case ImapResponseCodeType.Unseen:
FirstUnread = ((UnseenResponseCode) code).Index;
break;
case ImapResponseCodeType.HighestModSeq:
HighestModSeq = ((HighestModSeqResponseCode) code).HighestModSeq;
SupportsModSeq = true;
break;
case ImapResponseCodeType.NoModSeq:
SupportsModSeq = false;
HighestModSeq = 0;
break;
}
}
if (tryCreate && folder != null)
throw new FolderNotFoundException (folder.FullName);
}
开发者ID:dcga,项目名称:MailKit,代码行数:44,代码来源:ImapFolder.cs
示例12: RenameAsync
/// <summary>
/// Asynchronously rename the folder.
/// </summary>
/// <remarks>
/// Asynchronously renames the folder.
/// </remarks>
/// <returns>An asynchronous task context.</returns>
/// <param name="parent">The new parent folder.</param>
/// <param name="name">The new name of the folder.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="System.ArgumentNullException">
/// <para><paramref name="parent"/> is <c>null</c>.</para>
/// <para>-or-</para>
/// <para><paramref name="name"/> is <c>null</c>.</para>
/// </exception>
/// <exception cref="System.ArgumentException">
/// <para><paramref name="parent"/> does not belong to the <see cref="IMailStore"/>.</para>
/// <para>-or-</para>
/// <para><paramref name="name"/> is not a legal folder name.</para>
/// </exception>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMailStore"/> has been disposed.
/// </exception>
/// <exception cref="ServiceNotConnectedException">
/// The <see cref="IMailStore"/> is not connected.
/// </exception>
/// <exception cref="ServiceNotAuthenticatedException">
/// The <see cref="IMailStore"/> is not authenticated.
/// </exception>
/// <exception cref="System.InvalidOperationException">
/// The folder cannot be renamed (it is either a namespace or the Inbox).
/// </exception>
/// <exception cref="FolderNotFoundException">
/// The <see cref="MailFolder"/> does not exist.
/// </exception>
/// <exception cref="System.OperationCanceledException">
/// The operation was canceled via the cancellation token.
/// </exception>
/// <exception cref="System.IO.IOException">
/// An I/O error occurred.
/// </exception>
/// <exception cref="ProtocolException">
/// The server's response contained unexpected tokens.
/// </exception>
/// <exception cref="CommandException">
/// The command failed.
/// </exception>
public virtual Task RenameAsync (IMailFolder parent, string name, CancellationToken cancellationToken = default (CancellationToken))
{
if (parent == null)
throw new ArgumentNullException ("parent");
if (name == null)
throw new ArgumentNullException ("name");
if (name.Length == 0 || name.IndexOf (parent.DirectorySeparator) != -1)
throw new ArgumentException ("The name is not a legal folder name.", "name");
if (IsNamespace)
throw new InvalidOperationException ("Cannot rename this folder.");
return Task.Factory.StartNew (() => {
lock (SyncRoot) {
Rename (parent, name, cancellationToken);
}
}, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
}
开发者ID:naeemkhedarun,项目名称:MailKit,代码行数:67,代码来源:MailFolder.cs
示例13: Rename
/// <summary>
/// Rename the folder.
/// </summary>
/// <remarks>
/// Renames the folder.
/// </remarks>
/// <param name="parent">The new parent folder.</param>
/// <param name="name">The new name of the folder.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="System.ArgumentNullException">
/// <para><paramref name="parent"/> is <c>null</c>.</para>
/// <para>-or-</para>
/// <para><paramref name="name"/> is <c>null</c>.</para>
/// </exception>
/// <exception cref="System.ArgumentException">
/// <para><paramref name="parent"/> does not belong to the <see cref="IMailStore"/>.</para>
/// <para>-or-</para>
/// <para><paramref name="name"/> is not a legal folder name.</para>
/// </exception>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMailStore"/> has been disposed.
/// </exception>
/// <exception cref="ServiceNotConnectedException">
/// The <see cref="IMailStore"/> is not connected.
/// </exception>
/// <exception cref="ServiceNotAuthenticatedException">
/// The <see cref="IMailStore"/> is not authenticated.
/// </exception>
/// <exception cref="System.InvalidOperationException">
/// The folder cannot be renamed (it is either a namespace or the Inbox).
/// </exception>
/// <exception cref="FolderNotFoundException">
/// The <see cref="MailFolder"/> does not exist.
/// </exception>
/// <exception cref="System.OperationCanceledException">
/// The operation was canceled via the cancellation token.
/// </exception>
/// <exception cref="System.IO.IOException">
/// An I/O error occurred.
/// </exception>
/// <exception cref="ProtocolException">
/// The server's response contained unexpected tokens.
/// </exception>
/// <exception cref="CommandException">
/// The command failed.
/// </exception>
public abstract void Rename (IMailFolder parent, string name, CancellationToken cancellationToken = default (CancellationToken));
开发者ID:naeemkhedarun,项目名称:MailKit,代码行数:47,代码来源:MailFolder.cs
示例14: MoveToAsync
/// <summary>
/// Asynchronously move the specified messages to the destination folder.
/// </summary>
/// <remarks>
/// Asynchronously moves the specified messages to the destination folder.
/// </remarks>
/// <returns>An asynchronous task context.</returns>
/// <param name="indexes">The indexes of the messages to move.</param>
/// <param name="destination">The destination folder.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="System.ArgumentNullException">
/// <para><paramref name="indexes"/> is <c>null</c>.</para>
/// <para>-or-</para>
/// <para><paramref name="destination"/> is <c>null</c>.</para>
/// </exception>
/// <exception cref="System.ArgumentException">
/// <para><paramref name="indexes"/> is empty.</para>
/// <para>-or-</para>
/// <para>One or more of the <paramref name="indexes"/> is invalid.</para>
/// <para>-or-</para>
/// <para>The destination folder does not belong to the <see cref="IMailStore"/>.</para>
/// </exception>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMailStore"/> has been disposed.
/// </exception>
/// <exception cref="ServiceNotConnectedException">
/// The <see cref="IMailStore"/> is not connected.
/// </exception>
/// <exception cref="ServiceNotAuthenticatedException">
/// The <see cref="IMailStore"/> is not authenticated.
/// </exception>
/// <exception cref="FolderNotOpenException">
/// The folder is not currently open in read-write mode.
/// </exception>
/// <exception cref="System.OperationCanceledException">
/// The operation was canceled via the cancellation token.
/// </exception>
/// <exception cref="System.IO.IOException">
/// An I/O error occurred.
/// </exception>
/// <exception cref="ProtocolException">
/// The server's response contained unexpected tokens.
/// </exception>
/// <exception cref="CommandException">
/// The command failed.
/// </exception>
public virtual Task MoveToAsync (IList<int> indexes, IMailFolder destination, CancellationToken cancellationToken = default (CancellationToken))
{
if (indexes == null)
throw new ArgumentNullException ("indexes");
if (destination == null)
throw new ArgumentNullException ("destination");
return Task.Factory.StartNew (() => {
lock (SyncRoot) {
MoveTo (indexes, destination, cancellationToken);
}
}, cancellationToken, TaskCreationOptions.None, TaskScheduler.Default);
}
开发者ID:naeemkhedarun,项目名称:MailKit,代码行数:60,代码来源:MailFolder.cs
示例15: FolderQuota
/// <summary>
/// Initializes a new instance of the <see cref="MailKit.FolderQuota"/> class.
/// </summary>
/// <remarks>
/// Creates a new <see cref="FolderQuota"/> with the specified root.
/// </remarks>
/// <param name="quotaRoot">The quota root.</param>
public FolderQuota (IMailFolder quotaRoot)
{
QuotaRoot = quotaRoot;
}
开发者ID:jstedfast,项目名称:MailKit,代码行数:11,代码来源:FolderQuota.cs
示例16: MoveTo
/// <summary>
/// Moves the specified messages to the destination folder.
/// </summary>
/// <remarks>
/// <para>If the IMAP server supports the MOVE command, then the MOVE command will be used. Otherwise,
/// the messages will first be copied to the destination folder and then marked as \Deleted in the
/// originating folder. Since the server could disconnect at any point between those 2 operations, it
/// may be advisable to implement your own logic for moving messages in this case in order to better
/// handle spontanious server disconnects and other error conditions.</para>
/// </remarks>
/// <param name="indexes">The indexes of the messages to move.</param>
/// <param name="destination">The destination folder.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="System.ArgumentNullException">
/// <para><paramref name="indexes"/> is <c>null</c>.</para>
/// <para>-or-</para>
/// <para><paramref name="destination"/> is <c>null</c>.</para>
/// </exception>
/// <exception cref="System.ArgumentException">
/// <para><paramref name="indexes"/> is empty.</para>
/// <para>-or-</para>
/// <para>One or more of the <paramref name="indexes"/> is invalid.</para>
/// <para>-or-</para>
/// <para>The destination folder does not belong to the <see cref="ImapClient"/>.</para>
/// </exception>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="ImapClient"/> has been disposed.
/// </exception>
/// <exception cref="ServiceNotConnectedException">
/// The <see cref="ImapClient"/> is not connected.
/// </exception>
/// <exception cref="ServiceNotAuthenticatedException">
/// The <see cref="ImapClient"/> is not authenticated.
/// </exception>
/// <exception cref="FolderNotFoundException">
/// <paramref name="destination"/> does not exist.
/// </exception>
/// <exception cref="FolderNotOpenException">
/// The <see cref="ImapFolder"/> is not currently open in read-write mode.
/// </exception>
/// <exception cref="System.OperationCanceledException">
/// The operation was canceled via the cancellation token.
/// </exception>
/// <exception cref="System.IO.IOException">
/// An I/O error occurred.
/// </exception>
/// <exception cref="ImapProtocolException">
/// The server's response contained unexpected tokens.
/// </exception>
/// <exception cref="ImapCommandException">
/// The server replied with a NO or BAD response.
/// </exception>
public override void MoveTo (IList<int> indexes, IMailFolder destination, CancellationToken cancellationToken = default (CancellationToken))
{
if ((Engine.Capabilities & ImapCapabilities.Move) == 0) {
CopyTo (indexes, destination, cancellationToken);
AddFlags (indexes, MessageFlags.Deleted, true, cancellationToken);
return;
}
var set = ImapUtils.FormatIndexSet (indexes);
if (destination == null)
throw new ArgumentNullException ("destination");
if (!(destination is ImapFolder) || ((ImapFolder) destination).Engine != Engine)
throw new ArgumentException ("The destination folder does not belong to this ImapClient.", "destination");
CheckState (true, true);
if (indexes.Count == 0)
return;
var command = string.Format ("MOVE {0} %F\r\n", set);
var ic = Engine.QueueCommand (cancellationToken, this, command, destination);
Engine.Wait (ic);
ProcessResponseCodes (ic, destination);
if (ic.Response != ImapCommandResponse.Ok)
throw ImapCommandException.Create ("MOVE", ic);
}
开发者ID:dcga,项目名称:MailKit,代码行数:83,代码来源:ImapFolder.cs
示例17: MoveTo
/// <summary>
/// Move the specified messages to the destination folder.
/// </summary>
/// <remarks>
/// Moves the specified messages to the destination folder.
/// </remarks>
/// <returns>The UIDs of the messages in the destination folder, if available; otherwise an empty array.</returns>
/// <param name="uids">The UIDs of the messages to move.</param>
/// <param name="destination">The destination folder.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="System.ArgumentNullException">
/// <para><paramref name="uids"/> is <c>null</c>.</para>
/// <para>-or-</para>
/// <para><paramref name="destination"/> is <c>null</c>.</para>
/// </exception>
/// <exception cref="System.ArgumentException">
/// <para><paramref name="uids"/> is empty.</para>
/// <para>-or-</para>
/// <para>One or more of the <paramref name="uids"/> is invalid.</para>
/// <para>-or-</para>
/// <para>The destination folder does not belong to the <see cref="IMailStore"/>.</para>
/// </exception>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMailStore"/> has been disposed.
/// </exception>
/// <exception cref="ServiceNotConnectedException">
/// The <see cref="IMailStore"/> is not connected.
/// </exception>
/// <exception cref="ServiceNotAuthenticatedException">
/// The <see cref="IMailStore"/> is not authenticated.
/// </exception>
/// <exception cref="FolderNotOpenException">
/// The folder is not currently open in read-write mode.
/// </exception>
/// <exception cref="System.NotSupportedException">
/// The mail store does not support the UIDPLUS extension.
/// </exception>
/// <exception cref="System.OperationCanceledException">
/// The operation was canceled via the cancellation token.
/// </exception>
/// <exception cref="System.IO.IOException">
/// An I/O error occurred.
/// </exception>
/// <exception cref="ProtocolException">
/// The server's response contained unexpected tokens.
/// </exception>
/// <exception cref="CommandException">
/// The command failed.
/// </exception>
public abstract IList<UniqueId> MoveTo (IList<UniqueId> uids, IMailFolder destination, CancellationToken cancellationToken = default (CancellationToken));
开发者ID:naeemkhedarun,项目名称:MailKit,代码行数:50,代码来源:MailFolder.cs
示例18: Move
public void Move(IMailFolder newFolder)
{
var provider = newFolder as MailFolderProviderOM;
_mailItem = _mailItem.Move(provider.Handle);
}
开发者ID:modulexcite,项目名称:Interop-MailSim,代码行数:5,代码来源:MailItemProviderOM.cs
示例19: MessageSelectedEventArgs
public MessageSelectedEventArgs (IMailFolder folder, UniqueId uid, BodyPart body)
{
Folder = folder;
UniqueId = uid;
Body = body;
}
开发者ID:Gekctek,项目名称:MailKit,代码行数:6,代码来源:MessageSelectedEventArgs.cs
示例20: CopyTo
/// <summary>
/// Copies the specified messages to the destination folder.
/// </summary>
/// <remarks>
/// Copies the specified messages to the destination folder.
/// </remarks>
/// <param name="indexes">The indexes of the messages to copy.</param>
/// <param name="destination">The destination folder.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <exception cref="System.ArgumentNullException">
/// <para><paramref name="indexes"/> is <c>null</c>.</para>
/// <para>-or-</para>
/// <para><paramref name="destination"/> is <c>null</c>.</para>
/// </exception>
/// <exception cref="System.ArgumentException">
/// <para><paramref name="indexes"/> is empty.</para>
/// <para>-or-</para>
/// <para>One or more of the <paramref name="indexes"/> is invalid.</para>
/// <para>-or-</para>
/// <para>The destination folder does not belong to the <see cref="ImapClient"/>.</para>
/// </exception>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="ImapClient"/> has been disposed.
/// </exception>
/// <exception cref="FolderNotOpenException">
/// The <see cref="ImapFolder"/> is not currently open.
/// </exception>
/// <exception cref="ServiceNotConnectedException">
/// The <see cref="ImapClient"/> is not connected.
/// </exception>
/// <exception cref="ServiceNotAuthenticatedException">
/// The <see cref="ImapClient"/> is not authenticated.
/// </exception>
/// <exception cref="FolderNotFoundException">
/// <paramref name="destination"/> does not exist.
/// </exception>
/// <exception cref="FolderNotOpenException">
/// The <see cref="ImapFolder"/> is not currently open.
/// </exception>
/// <exception cref="System.OperationCanceledException">
/// The operation was canceled via the cancellation token.
/// </exception>
/// <exception cref="System.IO.IOException">
/// An I/O error occurred.
/// </exception>
/// <exception cref="ImapProtocolException">
/// The server's response contained unexpected tokens.
/// </exception>
/// <exception cref="ImapCommandException">
/// The server replied with a NO or BAD response.
/// </exception>
public override void CopyTo (IList<int> indexes, IMailFolder destination, CancellationToken cancellationToken = default (CancellationToken))
{
var set = ImapUtils.FormatIndexSet (indexes);
if (destination == null)
throw new ArgumentNullException ("destination");
if (!(destination is ImapFolder) || ((ImapFolder) destination).Engine != Engine)
throw new ArgumentException ("The destination folder does not belong to this ImapClient.", "destination");
CheckState (true, false);
if (indexes.Count == 0)
return;
var command = string.Format ("COPY {0} %F\r\n", set);
var ic = Engine.QueueCommand (cancellationToken, this, command, destination);
Engine.Wait (ic);
ProcessResponseCodes (ic, destination);
if (ic.Response != ImapCommandResponse.Ok)
throw ImapCommandException.Create ("COPY", ic);
}
开发者ID:dcga,项目名称:MailKit,代码行数:76,代码来源:ImapFolder.cs
注:本文中的IMailFolder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论