简体   繁体   English

使用兑换访问共享邮箱,以添加Vb.net Outlook

[英]Accessing a shared mailbox using redemption, for a Vb.net outlook add in

I m working on a outlook add in using Redemption, which has to move emails from my outlook inbox to a specified folder. 我正在使用Outlook Redemption开发Outlook插件,该工具必须将电子邮件从Outlook收件箱移至指定的文件夹。 It works fine until it is for the local mailbox. 直到用于本地邮箱,它才能正常工作。 When i try to do the same on a shared mailbox,from my outlook it doesn't work. 当我尝试在共享邮箱上执行相同操作时,从我的角度来看这是行不通的。 Meaning on my outlook i access the shared mailbox and try to move the mail from shared mailboxes "Inbox" to a folder in shared mailbox itself. 我的观点是,我访问共享邮箱,然后尝试将邮件从共享邮箱“收件箱”移动到共享邮箱本身的文件夹中。

I use the below code for the same. 我使用下面的代码相同。

oTempFolder = oRDOSession.GetSharedMailbox("mailbox name")

It throws the below error: System.InvalidCastException: Unable to cast COM object of type 'Redemption.RDOStoreClass' to interface type 'Redemption.RDOFolder'. 它引发以下错误:System.InvalidCastException:无法将类型为Redemption.RDOStoreClass的COM对象强制转换为接口类型Redemption.RDOFolder。 This operation failed because the QueryInterface call on the COM component for the interface with IID '{15B8597F-0A55-4361-AE8B-1F690BC61EE4}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). 此操作失败,因为具有以下错误的IID为“ {15B8597F-0A55-4361-AE8B-1F690BC61EE4}”的COM组件上的QueryInterface调用由于以下错误而失败:不支持此类接口(HRESULT异常:0x80004002(E_NOINTERFACE)) 。

I tried putting the mailbox name and the mailbox address also, nothing helped. 我也尝试输入邮箱名称和邮箱地址,没有任何帮助。

I tried the below code, found here on stackoverflow itself 我尝试了下面的代码,在stackoverflow本身上找到了

store = _session.Stores.GetSharedMailbox("Example shared mailbox ");

But it didn't make a difference. 但这并没有改变。

Can someone please guide me into this? 有人可以指导我吗?

After a bit of Research and trial i found a solution to the above question. 经过一些研究和试验,我找到了上述问题的解决方案。 Below code line is actual beginning of it. 下面的代码行是它的实际开始。

store = _session.Stores.GetSharedMailbox("Example shared mailbox ");

Below is the code to find the folder in the shared mailbox you need to find. 下面是在共享邮箱中查找所需文件夹的代码。

 Dim Rclass As Redemption.RDOStore
 Dim oTempFolders As Redemption.RDOFolders    
 Dim oTempFolder As Redemption.RDOFolder          
 Rclass = oRDOSession.Stores.GetSharedMailbox(aFolders(0))

 oTempFolders = Rclass.IPMRootFolder.Folders

 For i = 1 To oTempFolders.Count

   oTempFolder2 = oTempFolders.Item(i)

   If oTempFolder2.Name.ToLower = "folder name" Then
       oTempFolder = oTempFolder2
       Exit For
   End If
 Next

Hope this helps someone who comes accross this issue. 希望这对遇到这个问题的人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM