[英]Move a conversation from a shared mailbox into a folder within the shared mailbox
We have a shared mailbox (test@) with a subfolder (TestIn).我们有一个带有子文件夹 (TestIn) 的共享邮箱 (test@)。
I want to choose an email in the inbox of the shared mailbox and move it to the "TestIn" folder.我想在共享邮箱的收件箱中选择一封电子邮件并将其移动到“TestIn”文件夹中。
This mail should be moved as conversation, not only the single mail, every mail under this Header (conversation) should go into this folder.此邮件应作为会话移动,不仅是单个邮件,此 Header(会话)下的每封邮件都应放入此文件夹。
We are working with Office365 and Microsoft Exchange Accounts in Outlook.我们正在 Outlook 中使用 Office365 和 Microsoft Exchange 帐户。
I got it working to move the selected message (or conversation) from the shared mailbox into a subfolder of the personal mailbox, not the shared one.我开始将选定的邮件(或对话)从共享邮箱移动到个人邮箱的子文件夹中,而不是共享邮箱。
Here's the code:这是代码:
Sub SetAlwaysMoveToFolderMAPI()
Dim sharedemail As Outlook.Recipient
Dim myOlApp As New Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myInbox As Outlook.MAPIFolder
Dim myDestFolder As Outlook.MAPIFolder
Dim myMail As Outlook.MailItem
Dim myStore As Outlook.Store
Dim oConv As Outlook.Conversation
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set sharedemail = myNameSpace.CreateRecipient("Postfach Test")
Set myInbox = myNameSpace.GetSharedDefaultFolder(sharedemail, olFolderInbox)
Set myDestFolder = Application.Session.GetDefaultFolder(olFolderInbox).Folders("TestIn")
Set myMail = ActiveExplorer.Selection(1)
Set myStore = myDestFolder.Store
If myStore.IsConversationEnabled Then
Set myConv = myMail.GetConversation
If Not (myConv Is Nothing) Then
myConv.SetAlwaysMoveToFolder myDestFolder, myDestFolder.Store
End If
End If
End Sub
If I replace如果我更换
Set myDestFolder = Application.Session.GetDefaultFolder(olFolderInbox).Folders("TestIn")
with和
Set myDestFolder = myNameSpace.GetSharedDefaultFolder(sharedemail, olFolderInbox).Folders("TestIn")
it doesn't move anything and I don't get any error message.它不会移动任何东西,我也没有收到任何错误消息。
If I debug I see, that the script is jumping from If myStore.IsConversationEnabled Then
straight to the end.如果我调试我看到,脚本从
If myStore.IsConversationEnabled Then
直接跳到最后。
For me this means, the If myStore.IsConversationEnabled Then
is the problem, but I can't find anything about it.对我来说,这意味着
If myStore.IsConversationEnabled Then
是问题所在,但我找不到任何关于它的信息。
At this time it's not possible!这个时候是不可能的!
The problem is in the "store" of shared mailboxes.问题出在共享邮箱的“存储”中。 In there the "ConversationView" is not available and this causes the problem with the "SetAlwaysMoveToFolder", because I don't get a "conversation"-object to move.\\
在那里,“ConversationView”不可用,这会导致“SetAlwaysMoveToFolder”出现问题,因为我没有移动“对话”对象。\\
I hope Microsoft will implement this feature soon.我希望微软能尽快实现这个功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.