Make sure that the reference you are using is "Microsoft CDO 1.21
Library",
NOT "Microsoft CDO for Windows" (that's CDOSYS for Windows 2000).
Is this code in a macro or behind a custom form? When you said you set
a
reference, I'm now thinking this is a macro; if it is, I suggest you
add
an
"Option Explicit" statement to the beginning of the module and use
early-binding for CDO 1.21. Then declare:
Dim objSession As MAPI.Session
Set objSession = New MAPI.Session
If objSession Is Nothing Then
'Something is wrong
End If
At this point, if you are referencing the correct CDO 1.21 library and
it
is
installed, objSession will be a valid object.
Also, you must be logged on to Windows with an account that has read
access
to the mailbox you are opening with Session.Logon.
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job:
http://www.imaginets.com
Blog:
http://blogs.officezealot.com/legault/
:
Well, I re-installed it but it said that it was already installed.
Also,
I
had Microsoft CDO for Windows checked as a reference in my Outlook VBA
project. So it must have been there.
Anyway, I re-installed it making sure "Run All From My Computer" was
selected for CDO on the disc.
I'm seeming to get past the CreateObject line, but having problems
with
the
Logon. I get an error saying:
Error loading DLL: 'Logon'
Here's my code so far:
Dim objSession
Set objSession = CreateObject("MAPI.Session")
objSession.Logon "Administrator", "Password", False, True, 0, True,
"server1" & vbLf & "Administrator"
msgBox "All done."
I've also tried it this way:
Dim objSession
Set objSession = CreateObject("MAPI.Session")
strProfileInfo = "wilsongroup1" & vbLf & "Administrator"
objSession.Logon "", "JRiddle#1", False, True, 0, False,
strProfileInfo
Could you tell me how to logon to the Exchange server under a
different
account (not from the Exchange server). Have you ever actually gotten
this
to work? If so, could you post a snippet of the code that logs onto
the
server with different permissions that the currently logged on user?
Thanks,
John
in
message Then you most definitely don't have CDO installed on that system.
Go
through
Office setup, expand the Outlook section and ensure that
Collaboration
Data
Objects is installed.
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job:
http://www.imaginets.com
Blog:
http://blogs.officezealot.com/legault/
:
Hmmm....
I'm having problems getting past the first step. I've tried the
examples
on
that page and they don't seem to work as code behind the form. I've
also
tried some samples from CDOLive.com site, but I keep getting the
error:
"ActiveX component can't create object: 'MAPI.Session'
Error: 800A01AD
All I'm testing is a simple Logon script for now:
Dim objSession
Set objSession = CreateObject("MAPI.Session") 'This is the line
where
it
breaks
objSession.Logon "Administrator", "Password", False, False, 0
Could you tell me what would be wrong?
Thanks,
John
"Eric Legault [MVP - Outlook]" <
[email protected]>
wrote
in
message CDO has a Filter property you can set for a Messages collection.
If you logon using an existing profile, those permissions apply
to
code
access as well. So if the user doesn't have read permissions for
a
folder,
you would not be able to gain access to it.
You can use the ProfileInfo parameter of the Logon method to
create
a
temporary profile using a username and password for an account
that
has
the
permissions you require. See that link I pointed you to for info
on
how
to
do that.
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job:
http://www.imaginets.com
Blog:
http://blogs.officezealot.com/legault/
:
Eric,
Does CDO have a restriction method or do I need to loop through
all
the
items in the folder looking for the messages that I want? Also,
if
the
default Outlook profile being used does not have permission to
read
items
in
that folder and I populate a listbox based on these items and
open
double
click an item on the list, would the user still be able to open
and
read
that item?
Thanks for all your help!
John
"Eric Legault [MVP - Outlook]" <
[email protected]>
wrote
in
message
You can use CDO's Session object and Logon method to gain
access
to
Exchange
stores (Mailboxes, Public Folders) with different credentials
than
the
currently logged on user.
See this link for more info:
How To Log On to Exchange with the ProfileInfo Parameter:
http://support.microsoft.com/default.aspx?scid=kb;en-us;195662
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job:
http://www.imaginets.com
Blog:
http://blogs.officezealot.com/legault/
:
Hello All,
We currently set Exchange to Auto Archive all mail to a
public
mail
folder.
Obviously, read/edit access to this folder is disabled so
that
users
can't
read other user's personal email. However, we have sales
contacts
that
all
the sales people need to be able to view all communication
company-wide
for
a particular contact. Therefore, I need to search this public
mail
folder
for items
relating to a contact (based on the contact's email address)
and
list
all
email to/from that business contact. Obviously, the public
mail
folder
contains many, many items so search speed will be important
factor
in
addition to the script that I write needs a way to log on as
a
user
with
"Read" access on the folder (instead of the user's windows
log-on
credentials).
Can anyone offer a suggestion as to possible methods of
accomplishing
this?
Can I logon using different credentials that have read access
to
the
folder
via script behind the form? WebDAV? ADO? CDO? Anyone know of
samples
out
there?
Thanks,
John