Question Feeding Ms Access Form by Outlook (Contact's Photo) (1 Viewer)

iKrromz

New member
Local time
Today, 02:55
Joined
Oct 24, 2017
Messages
3
Hey there,

I would appreciate your support to help me on an issue that I have been trying to solve but unfortunately I couldn't reach to the expected resolution. Whereby, I’m trying to retrieve the current DB user’s information from outlook and I've successfully managed to retrieve the basic contact information such as the email address, name, manager, position, office location..etc. The issue is that I would like to retrieve the contact’s photo in outlook to be shown on the user form either by image object or smoothing. (similar to SharePoint)

And here is the code that I tried to use but I get an error with the last line. this code is placed on load event and I'm using a late binding to prevent compatibility issues.

Code:
Dim OL, olAllUsers, oExchUser, oentry, myitem As Object
    Dim User As String
    Set OL = CreateObject("outlook.application")
    Set olAllUsers = OL.Session.AddressLists.Item("All Users").AddressEntries
    User = OL.Session.CurrentUser.Name
    Set oentry = olAllUsers.Item(User)
    Set oExchUser = oentry.GetExchangeUser()
    
    
    MsgBox oExchUser.PrimarySmtpAddress 'works fine, this is to get the email address.
    Me.Image01 = oExchUser.StdPicture

Thanks in advance.

Best,
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:55
Joined
May 21, 2018
Messages
8,527
I have never done this so this is my guess. Looking at MSDN there is no property of an exhange user "sdtPicture". There is a getPicture method that returns the stdPicture

Code:
https://docs.microsoft.com/en-us/office/vba/api/outlook.exchangeuser.getpicture

I still would not think you could reference the std picture anyway
You can only call GetPicture from code that runs in-process as Outlook. An StdPicture object cannot be marshaled across process boundaries. If you attempt to call GetPicture from out-of-process code, an exception occurs. For more information, see An automation server cannot pass a pointer to the picture object's IPictureDisp implementation across process boundaries.

The stdPicture is a wrapper class from what I understand and not a "image"
The StdPicture object is simply a wrapper which can handle many different types of graphics objects (Bitmaps, Metafiles, Enhanced metafiles, Icons and Cursors) and provide reasonably generic access to them

As said I have never tried this so do not have any experience, or direct knowledge. Hopefully someone can answer. However, if I was to try, I would save the image to disk and save the path into a bound image control. Seems easy.
 

iKrromz

New member
Local time
Today, 02:55
Joined
Oct 24, 2017
Messages
3
I have never done this so this is my guess. Looking at MSDN there is no property of an exhange user "sdtPicture". There is a getPicture method that returns the stdPicture

Code:
https://docs.microsoft.com/en-us/office/vba/api/outlook.exchangeuser.getpicture

I still would not think you could reference the std picture anyway


The stdPicture is a wrapper class from what I understand and not a "image"


As said I have never tried this so do not have any experience, or direct knowledge. Hopefully someone can answer. However, if I was to try, I would save the image to disk and save the path into a bound image control. Seems easy.

Thanks for you reply. I won’t mind any other solution since it do the trick. But the question regarding the method you mentioned is how to get the contact picture from outlook? And if it’s saved, it will be on the user’s machine or a shared folder path?
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:55
Joined
May 21, 2018
Messages
8,527
As said I do not have much experience, hopefully someone does. The only possible solution I see is posted here
Code:
https://stackoverflow.com/questions/33791796/outlook-get-exchange-users-pictures

The suggestions is that this can be retrieved using the AccessorProperty method. This method allows you to retrieve properties not exposed by the Outlook object.

No, but you can read the PR_EMS_AB_THUMBNAIL_PHOTO (DASL name http://schemas.microsoft.com/mapi/proptag/0x8C9E0102) using AddressEnttry.PropertyAccessor.GetProperty and then just save it as an JPG file. – Dmitry Streblechenko Nov 19 '15 at 17:22

Dmitry also says you can use Outlook Redemption to do this. You may want to look. I have not used this. I do not do any work with Outlook automation.
Code:
http://www.dimastr.com/redemption/home.htm
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:55
Joined
May 21, 2018
Messages
8,527
If you do not get an answer here, it looks like dimitry is the guru on this subject. There is contact information and a message board to asks questions on the site I posted
Code:
https://groups.yahoo.com/neo/groups/Outlook-Redemption/conversations/messages
Code:
 redemption@dimastr.com
 

June7

AWF VIP
Local time
Yesterday, 15:55
Joined
Mar 9, 2014
Messages
5,470
@MajP, it seems links posted in CODE tags are not clickable unless you use HTML tags. If you want to emphasize them then maybe just 'white space' them - add carriage returns.
 

iKrromz

New member
Local time
Today, 02:55
Joined
Oct 24, 2017
Messages
3
If you do not get an answer here, it looks like dimitry is the guru on this subject. There is contact information and a message board to asks questions on the site I posted
Code:
https://groups.yahoo.com/neo/groups/Outlook-Redemption/conversations/messages
Code:
 redemption@dimastr.com

Will do, but I’m sure that somewhere maybe can help.

Thanks.
 

Users who are viewing this thread

Top Bottom