Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 12-09-2018, 03:48 AM   #1
iKrromz
Newly Registered User
 
Join Date: Oct 2017
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
iKrromz is on a distinguished road
Exclamation Feeding Ms Access Form by Outlook (Contact's Photo)

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 by iKrromz; 12-09-2018 at 05:37 AM.
iKrromz is offline   Reply With Quote
Old 12-09-2018, 05:22 AM   #2
MajP
Newly Registered User
 
Join Date: May 2018
Location: USA baby
Posts: 1,790
Thanks: 34
Thanked 539 Times in 512 Posts
MajP will become famous soon enough MajP will become famous soon enough
Re: Feeding Ms Access Form by Outlook (Contact's Photo)

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
Quote:
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"
Quote:
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.
MajP is offline   Reply With Quote
Old 12-09-2018, 05:42 AM   #3
iKrromz
Newly Registered User
 
Join Date: Oct 2017
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
iKrromz is on a distinguished road
Re: Feeding Ms Access Form by Outlook (Contact's Photo)

Quote:
Originally Posted by MajP View Post
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?

iKrromz is offline   Reply With Quote
Old 12-09-2018, 06:24 AM   #4
MajP
Newly Registered User
 
Join Date: May 2018
Location: USA baby
Posts: 1,790
Thanks: 34
Thanked 539 Times in 512 Posts
MajP will become famous soon enough MajP will become famous soon enough
Re: Feeding Ms Access Form by Outlook (Contact's Photo)

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.

Quote:
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 is offline   Reply With Quote
Old 12-09-2018, 06:32 AM   #5
MajP
Newly Registered User
 
Join Date: May 2018
Location: USA baby
Posts: 1,790
Thanks: 34
Thanked 539 Times in 512 Posts
MajP will become famous soon enough MajP will become famous soon enough
Re: Feeding Ms Access Form by Outlook (Contact's Photo)

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
MajP is offline   Reply With Quote
Old 12-09-2018, 11:27 AM   #6
June7
AWF VIP
 
June7's Avatar
 
Join Date: Mar 2014
Location: The Great Land
Posts: 2,274
Thanks: 0
Thanked 533 Times in 529 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: Feeding Ms Access Form by Outlook (Contact's Photo)

@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.
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
The Following User Says Thank You to June7 For This Useful Post:
MajP (12-09-2018)
Old 12-10-2018, 01:21 PM   #7
iKrromz
Newly Registered User
 
Join Date: Oct 2017
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
iKrromz is on a distinguished road
Re: Feeding Ms Access Form by Outlook (Contact's Photo)

Quote:
Originally Posted by MajP View Post
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.


iKrromz is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add single Outlook contact to Access form knarlyd@hotmail.com Modules & VBA 2 01-09-2014 03:42 PM
Linking Contact list and tasks from Outlook into Access unixkid General 1 01-09-2011 03:42 PM
Outlook Contact Managament via Access MaliciousMike General 0 04-09-2008 04:22 AM
Place a photo on a contact form mtagliaferri Forms 1 07-28-2006 07:03 AM
Add Photo In Contact List mtagliaferri Forms 1 07-16-2006 02:48 PM




All times are GMT -8. The time now is 05:51 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World