I m working on a outlook add in using Redemption, which has to move emails from my outlook inbox to a specified folder. 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'. 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)).
I tried putting the mailbox name and the mailbox address also, nothing helped.
I tried the below code, found here on stackoverflow itself
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.