Get email address of public folder using CDO

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to get the email address of a public folder using CDO? I have looked at the code on Slipstick (http://www.outlookcode.com/d/code/getpfaddy.htm) for getting it using Redemption, and it says that it's possible with CDO, but I can't figure it out. I do not care about the security warning, so would like to do it using CDO
Thanks.
 
Function R_GetPFAddress(objFolder As MAPI.Folder)
Dim strAddress As String
Dim strEntryID As String
Dim oAE As MAPI.AddressEntry

Const PR_ADDRESS_BOOK_ENTRYID = &H663B0102
Const PR_EMAIL = &H39FE001E

On Error Resume Next

strEntryID = objFolder.Fields(PR_ADDRESS_BOOK_ENTRYID)
' m_objSession is a module level reference to an existing CDO Session
Set oAE = m_objSession.GetAddressEntry(strEntryID)
R_GetPFAddress = oAE.Fields(PR_EMAIL)

Set oAE = Nothing
End Function





Kenneth M. said:
Is there a way to get the email address of a public folder using CDO? I
have looked at the code on Slipstick
(http://www.outlookcode.com/d/code/getpfaddy.htm) for getting it using
Redemption, and it says that it's possible with CDO, but I can't figure it
out. I do not care about the security warning, so would like to do it using
CDO.
 
MAPIFolder is in the Outlook object model. You said you wanted to be using
CDO 1.21 (an optional installation for Outlook 2000 and later). If it's
installed you need to set a project reference to CDO.DLL. In addition you'd
need to use:

Dim m_objSession As MAPI.Session

Set m_objSession = CreateObject("MAPI.Session")
'and login to CDO. If Outlook is already running:
m_objSession.Logon "", "", False, False

That is all VB 6/VBA code. I don't use .NET languages for Outlook so I have
no idea how you'd do it using VB.NET.




Kenneth M said:
Thanks for the reply, Ken.
I should have specified that I am trying to do this in a VB.NET add in. I
don't have the '.Fields' property available on the MAPIFolder object. I am
trying to follow your code sample and find similar properties, but am not
having much luck. For example, I can't seem to find a method simlar to
'GetAddressEntry'.
 
Just to add to what Ken said, MAPI.Folder is the CDO object.
Outlook.MAPIFolder is the Outlook object.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Kenneth M said:
Thanks for the reply, Ken.
I should have specified that I am trying to do this in a VB.NET add in. I
don't have the '.Fields' property available on the MAPIFolder object. I am
trying to follow your code sample and find similar properties, but am not
having much luck. For example, I can't seem to find a method simlar to
'GetAddressEntry'.
Thanks.

----- Ken Slovak - [MVP - Outlook] wrote: -----

Function R_GetPFAddress(objFolder As MAPI.Folder)
Dim strAddress As String
Dim strEntryID As String
Dim oAE As MAPI.AddressEntry

Const PR_ADDRESS_BOOK_ENTRYID = &H663B0102
Const PR_EMAIL = &H39FE001E

On Error Resume Next

strEntryID = objFolder.Fields(PR_ADDRESS_BOOK_ENTRYID)
' m_objSession is a module level reference to an existing CDO Session
Set oAE = m_objSession.GetAddressEntry(strEntryID)
R_GetPFAddress = oAE.Fields(PR_EMAIL)

Set oAE = Nothing
End Function





Kenneth M. said:
Is there a way to get the email address of a public folder using
CDO? I
have looked at the code on Slipstick
(http://www.outlookcode.com/d/code/getpfaddy.htm) for getting it using
Redemption, and it says that it's possible with CDO, but I can't figure it
out. I do not care about the security warning, so would like to do it using
CDO.
 
So is there a way to get the email address of a public folder using the Outlook object MAPIFolder (using VB.NET)
I tried using
olOutlook.GetNameSpace('MAPI").GetRecipientFromID(oFolder.EntryID
but that fails, probably b/c this folder isn't a recipient

I would sure think there is a way to access the email address of a public folder from the MAPIFolder object. Am I wrong

Thanks

----- Sue Mosher [MVP-Outlook] wrote: ----

Just to add to what Ken said, MAPI.Folder is the CDO object
Outlook.MAPIFolder is the Outlook object

--
Sue Mosher, Outlook MV
Author o
Microsoft Outlook Programming - Jumpstart fo
Administrators, Power Users, and Developer
http://www.outlookcode.com/jumpstart.asp


Kenneth M said:
Thanks for the reply, Ken
I should have specified that I am trying to do this in a VB.NET add in.
don't have the '.Fields' property available on the MAPIFolder object. I a
trying to follow your code sample and find similar properties, but am no
having much luck. For example, I can't seem to find a method simlar t
'GetAddressEntry'
Thanks
----- Ken Slovak - [MVP - Outlook] wrote: ----
Function R_GetPFAddress(objFolder As MAPI.Folder
Dim strAddress As Strin
Dim strEntryID As Strin
Dim oAE As MAPI.AddressEntr
Const PR_ADDRESS_BOOK_ENTRYID = &H663B010 Const PR_EMAIL = &H39FE001
On Error Resume Nex
strEntryID = objFolder.Fields(PR_ADDRESS_BOOK_ENTRYID
' m_objSession is a module level reference to an existing CD Sessio
Set oAE = m_objSession.GetAddressEntry(strEntryID
R_GetPFAddress = oAE.Fields(PR_EMAIL
Set oAE = Nothin End Functio
Ken Slova
[MVP - Outlook
http://www.slovaktech.co
Author: Absolute Beginner's Guide to Microsoft Office Outlook 200
Reminder Manager, Extended Reminders, Attachment Option
http://www.slovaktech.com/products.ht
Is there a way to get the email address of a public folder usin
CDO?
have looked at the code on Slipstic
(http://www.outlookcode.com/d/code/getpfaddy.htm) for getting i usin
Redemption, and it says that it's possible with CDO, but I can' figure i
out. I do not care about the security warning, so would like to d it usin
CDO
 
You must use CDO or Redemption. The Outlook object model does not expose
that information.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Kenneth M. said:
So is there a way to get the email address of a public folder using the
Outlook object MAPIFolder (using VB.NET)?
I tried using:
olOutlook.GetNameSpace('MAPI").GetRecipientFromID(oFolder.EntryID)
but that fails, probably b/c this folder isn't a recipient.

I would sure think there is a way to access the email address of a public
folder from the MAPIFolder object. Am I wrong?
Thanks.

----- Sue Mosher [MVP-Outlook] wrote: -----

Just to add to what Ken said, MAPI.Folder is the CDO object.
Outlook.MAPIFolder is the Outlook object.
Kenneth M said:
Thanks for the reply, Ken.
I should have specified that I am trying to do this in a VB.NET add
in. I
don't have the '.Fields' property available on the MAPIFolder object. I am
trying to follow your code sample and find similar properties, but am not
having much luck. For example, I can't seem to find a method simlar to
'GetAddressEntry'.
Thanks.
----- Ken Slovak - [MVP - Outlook] wrote: -----
Function R_GetPFAddress(objFolder As MAPI.Folder)
Dim strAddress As String
Dim strEntryID As String
Dim oAE As MAPI.AddressEntry
Const PR_ADDRESS_BOOK_ENTRYID = &H663B0102 Const PR_EMAIL = &H39FE001E
On Error Resume Next
strEntryID = objFolder.Fields(PR_ADDRESS_BOOK_ENTRYID)
' m_objSession is a module level reference to an existing
CDO
Session
Set oAE = m_objSession.GetAddressEntry(strEntryID)
R_GetPFAddress = oAE.Fields(PR_EMAIL)
Set oAE = Nothing End Function
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"Kenneth M." <[email protected]> wrote in
message
Is there a way to get the email address of a public folder using
CDO? I
have looked at the code on Slipstick
(http://www.outlookcode.com/d/code/getpfaddy.htm) for getting
it
using
Redemption, and it says that it's possible with CDO, but I
can't
figure it
out. I do not care about the security warning, so would like
to do
it using
 
Well it does but only for Outlook 2003. In Outlook 2003 there's a
MAPIFolder.FolderPath and a hidden .FullFolderPath property.
 
He was asking about the email address, not the folder path, IIRC

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top