PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Re: How do I find who created a contact item in a public folder?

Reply

Re: How do I find who created a contact item in a public folder?

 
Thread Tools Rate Thread
Old 02-07-2003, 02:23 PM   #1
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: How do I find who created a contact item in a public folder?


You can use CDO 1.21 or Redemption (www.dimastr.com/redemption) code
to find that using the PR_CREATOR_NAME property tag.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


"Bruce" <briquce@yahoo.com> wrote in message
news:5fdb2af2.0307020343.1c665a2@posting.google.com...
> When I open a contact record (in outlook), I can see who created the
> record by clicking on the "All Fields" tab and selecting "All Post
> Fields". In the resulting list, the "From" field seems to contain
> the name of the user that created the record. My question is
> this...How can I read this information programmatically? I don't

see
> any ContactItem property that corresponds to this information.



  Reply With Quote
Old 07-07-2003, 02:29 PM   #2
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: How do I find who created a contact item in a public folder?

There is nothing in the Outlook object model that gives you that
information. CDO, Redemption or Extended MAPI (C++ or Delphi only) are
the only ways to go.

CDO 1.21 is an optional installation with Outlook 2000 and later, make
sure it's installed and you have a reference to it set in the project.

For use with CDO:

Sub GetCreator()
'requires the item be open for this sample

Const PR_CREATOR_NAME = &H3FF8001E

Dim oContact As Outlook.ContactItem
Dim oInspector As Outlook.Inspector
Dim oOL As Outlook.Application

Dim oCDO As MAPI.Session
Dim oMessage As MAPI.Message
Dim oFields As MAPI.Fields
Dim oField As MAPI.Field

Dim sEntryID As String
Dim sStoreID As String

On Error Resume Next

Set oOL = CreateObject("Outlook.Application")
Set oInspector = oOL.ActiveInspector
Set oContact = oInspector.CurrentItem

sEntryID = oContact.EntryID
sStoreID = oContact.Parent.StoreID

Set oCDO = CreateObject("MAPI.Session")
oCDO.Logon "", "", False, False

Set oMessage = oCDO.GetMessage(sEntryID, sStoreID)
Set oFields = oMessage.Fields
Set oField = oFields(PR_CREATOR_NAME)

MsgBox oField.Value 'display the creator

oCDO.Logoff
'set all objects = Nothing here
End Sub

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


"Bruce" <briquce@yahoo.com> wrote in message
news:5fdb2af2.0307070520.185fd05b@posting.google.com...
> Thanks for the response, but it didn't help. Is there a way to
> access the property through Outlook automation? I tried using CDO
> 1.21, but I can't seem to access the "Fields" property that I need

to
> try to use the property tags. (an example would be appreciated).
>
> As far as using Redemption...I really do not want to use a

commercial
> control--especially just to access one bit of information.



  Reply With Quote
Old 08-07-2003, 01:32 PM   #3
Bruce
Guest
 
Posts: n/a
Default Re: How do I find who created a contact item in a public folder?

Thanks Ken!
I found my office cd, and installed the CDO. Your sample code
gave me everything I needed. I appreciate your help.



"Ken Slovak - [MVP - Outlook]" <kenslovak@mvps.org> wrote in message news:<#BGWgQJRDHA.1556@TK2MSFTNGP10.phx.gbl>...
> There is nothing in the Outlook object model that gives you that
> information. CDO, Redemption or Extended MAPI (C++ or Delphi only) are
> the only ways to go.
>
> CDO 1.21 is an optional installation with Outlook 2000 and later, make
> sure it's installed and you have a reference to it set in the project.
>
> For use with CDO:
>
> Sub GetCreator()
> 'requires the item be open for this sample
>
> Const PR_CREATOR_NAME = &H3FF8001E
>
> Dim oContact As Outlook.ContactItem
> Dim oInspector As Outlook.Inspector
> Dim oOL As Outlook.Application
>
> Dim oCDO As MAPI.Session
> Dim oMessage As MAPI.Message
> Dim oFields As MAPI.Fields
> Dim oField As MAPI.Field
>
> Dim sEntryID As String
> Dim sStoreID As String
>
> On Error Resume Next
>
> Set oOL = CreateObject("Outlook.Application")
> Set oInspector = oOL.ActiveInspector
> Set oContact = oInspector.CurrentItem
>
> sEntryID = oContact.EntryID
> sStoreID = oContact.Parent.StoreID
>
> Set oCDO = CreateObject("MAPI.Session")
> oCDO.Logon "", "", False, False
>
> Set oMessage = oCDO.GetMessage(sEntryID, sStoreID)
> Set oFields = oMessage.Fields
> Set oField = oFields(PR_CREATOR_NAME)
>
> MsgBox oField.Value 'display the creator
>
> oCDO.Logoff
> 'set all objects = Nothing here
> End Sub
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Lead Author, Professional Outlook 2000 Programming, Wrox Press
> Lead Author, Beginning VB 6 Application Development, Wrox Press
> Attachment Options
> http://www.slovaktech.com/attachmentoptions.htm
> Extended Reminders
> http://www.slovaktech.com/extendedreminders.htm
>
>
> "Bruce" <briquce@yahoo.com> wrote in message
> news:5fdb2af2.0307070520.185fd05b@posting.google.com...
> > Thanks for the response, but it didn't help. Is there a way to
> > access the property through Outlook automation? I tried using CDO
> > 1.21, but I can't seem to access the "Fields" property that I need

> to
> > try to use the property tags. (an example would be appreciated).
> >
> > As far as using Redemption...I really do not want to use a

> commercial
> > control--especially just to access one bit of information.

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off