发生了奇怪的事情。我正在尝试使用GetSharedDefaultFolder从本地MAPI文件夹复制并移动项目到remtoe已发送邮件文件夹。它适用于收件箱文件夹,但不适用于已发送的项目,即使我有权限。任何想法都会非常感谢你。
错误是'无法完成操作。一个或多个参数值无效'
代码示例是:
Outlook.MailItem cItem = (mailmsg as Outlook.MailItem).Copy() as Outlook.MailItem;
Outlook.NameSpace ns = this.Application.GetNamespace("MAPI");
//ns.Logon()
Outlook.Recipient recipient = ns.CreateRecipient("realusera@domain.com");
recipient.Resolve();
if (recipient.Resolved)
{
MessageBox.Show("Resolved user");
Outlook.MAPIFolder mapifld = ns.GetSharedDefaultFolder(recipient, Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderSentMail);
cItem = (Outlook.MailItem)cItem.Move(mapifld);
}
答案 0 :(得分:1)
根据此API的MS文档,olFolderSentMail是不允许的默认文件夹之一。
摘录:
FolderType可以是以下OlDefaultFolders常量之一:olFolderCalendar,olFolderContacts,olFolderDrafts,olFolderInbox,olFolderJournal,olFolderNotes或olFolderTasks。 (不能为此参数指定常量olFolderDeletedItems,olFolderOutbox,olFolderJunk,olFolderConflicts,olFolderLocalFailures,olFolderServerFailures,olFolderSyncIssues,olPublicFoldersAllPublicFolders,olFolderRssSubscriptions,olFolderToDo,olFolderManagedEmail和 olFolderSentMail 。)