Hello Dmitry,
Thank you very much for your reply.
According to your solution mentioned in one of the above responses i.e.
1. Run your code under the Windows user identity who can access all of
the
required mailboxes
2. Call RDOSession.Logon if you have an existing profilee pointing to
that
user's mailbox or call RDOSession.LogonExchangeMailbox
3. Loop through the entries in the RDOSession.AddressBook.GAL;
4. For each RDOAddressEntry with DisplayType property equal to
DT_MAILUSER
(= 0)
5. Call RDOSession.GetSharedMailbox passing that RDOAddressEntry object
(get
back RDOExchangeMailboxStore)
6. Loop through all subfolder and messages in tha tmailbox store
stating
with the RDOStore.IPMRootFolder collection
Will there be problem in step 3 and 4 if there is a multiple exchange
server
box in the domain and various users are configured with different
exchange
box. Will I still be able to get all user's RDOAddressEntry object in
RDOSession.AddressBook.GAL or will it give only those users which are
on
the
same exchange box as of the Windows user under which the application is
running?
Also I assume that RDOSession.Logon using the existing profile of using
RDOSession.LogonExchangeMailbox are exclusive. I guess I don't have to
create
the profile if it's not there and can use the
RDOSession.LogonExchangeMailbox
method instead. Is that right?
Many Thanks for your help.
Amit Kathane
:
Once again, see steps 1 and 2. You need to call LogonExchangeMailbox
*once*
for the current Windows user who must have the right to access othe
rmailboxes.
To access other mailboxess call RDOSession.GetSharedMailbox. Do *not*
call
LogonExchangeMailbox for the other mailboxes.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Hi,
Thanks you very much for your reply.
I'm understanding bit of Redemeption library now.
One issue is when I'm trying to do login using
RDOSession.LogonExchangeMailbox
it's popping up the UI.
According to my requirement, I've to traverse through all mailbox
which
I
guess will require login into each mailbox and a pop up UI could be
an
issue?
This UI does not come when using RDOSession.Logon method, is there
anything
I'm missing while using RDOSession.LogonExchangeMailbox or is there
any
workaround to my requirement.
Also what exctly is the usage of ProfMan library? Is it only needed
when
we
don't have a user profile to logon so that one can create a new
profile?
Once again many thanks for your help.
:
Where does the item come from and why are you querying it for
RDOContactItem? Does it come from the Contacts folder? Most likely
you
encounter a Distribution list, which is represented by the
RDODistListItem
object.
As for what you are actually trying to do, the standard way to do
things
like that is to
1. Run your code under the Windows user identity who can access all
of
the
required mailboxes
2. Call RDOSession.Logon if you have an existing profilee pointing
to
that
user's mailbox or call RDOSession.LogonExchangeMailbox
3. Loop through the entries in the RDOSession.AddressBook.GAL;
4. For each RDOAddressEntry with DisplayType property equal to
DT_MAILUSER
(= 0)
5. Call RDOSession.GetSharedMailbox passing that RDOAddressEntry
object
(get
back RDOExchangeMailboxStore)
6. Loop through all subfolder and messages in tha tmailbox store
stating
with the RDOStore.IPMRootFolder collection
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Hi,
I'm also getting the same kind of exception as below.
"Unable to cast COM object of type 'System.__ComObject' to
interface
type
'Redemption.RDOContactItem'. This operation failed because the
QueryInterface
call on the COM component for the interface with IID
'{DA18E730-205D-4CED-9E61-4DBBC35D2EE5}' failed due to the
following
error:
No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE))."
I'm very new to the Redemption and it's object model.
What I'm trying to do is as follows.
"To retrieve all mailbox accounts from the domain (example
xyz.com),
once
retrieved a configurable number of worker threads will be
spawned.
Each
worker thread will take a single mailbox account and query Active
Directory
to see which Exchange Server the mailbox account resides on. The
worker
thread will then trawl through each message in its given
mailbox's
account
checking its Read, Received Date and the Mileage properties. If
the
mail
message meets the given criteria (mail item has been read, is
older
than x
months etc) the email item will be logged and if in the correct
mode
deleted.
Once a mailbox has been fully processes it will go on for next
mailbox".
I've few queries as below.
1. How to retrieve all mailbox accounts from the domain (e.g.
xyz.com)?
2. Can you please let me know what objects in Redemption object
model
will
be helpful for this?
3. Do I have to use ProfMan library?
Please help me. As mentioned I'm very new to Redemption or for
that
matter
exchange or outlook programming.
Many Thanks in advance.
Amit Kathane
:
This is fairly standard and is not limited to Redemption at all.
Most COM objects do not support QueryInterface on the
corresponding
CLASS_xyz GUID (since it is really an id and does not correspond
to
an
interface).
On the .Net level, avoid declaring and casting COM objects to
the
XYZClass
(e.g. RDOContactItemClass).
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
Thank you for response.
I've posted wrong example.
The cast which doesn't work is RDOContactItemClass contact =
item
as
RDOContactItemClass;
This line returns null, but RDOContactItem contact = item as
RDOContactItem works and your example also.
What is amazing that method Items.Add("IPM.Contacts") return
instance
of RDOMailClass which
doesn't implement RDOContactItem.
I think when tlbimp.exe generates interop assembly
than overrides cast operators.
Maybe this is workaround for C++ multi-inheritance which is
not
present in C#?