Alaska Software Inc. - Re: Windows 10 MAPI-problems
Username: Password:
AuthorTopic: Re: Windows 10 MAPI-problems
Thomas PoolRe: Windows 10 MAPI-problems
on Fri, 25 May 2018 23:29:45 +0200
Hello Pascal,
I'm using your aolution to transfer emails directly to Outloo, it works
fine.
A customer is reporting that mails are not placed in the default Outlook
account. Do you know if it is possible to set an account when tranferring
an email to Outlook?  
Thanks & regards, Thomas




-----------------------------
Op Wed, 13 Dec 2017 22:04:48 +0100 schreef Pascal Boivin:

> Installing MS Office 32 bits usually solve MAPI problem but this is
> always an option.
> 
> When MAPI is not available, I try a direct call to outlook. I extract
> this from a class with french label and done my best to translate it in
> english in a function.
> 
> FUNCTION Outlook_Send(Target_TO, Target_CC, Target_BCC, Subject,
> HTMLMessage, aAttachment, cError)
> LOCAL oOutlook, oMSG, nLoop, nResult := 0, bErreur, oError
> 
> /*************
> http://msdn.microsoft.com/en-us/library/aa210946%28v=office.11%29.aspx
> *************/
>   //cError is an output parameter
>   cError := ""
>   oOutlook := CreateObject("Outlook.Application")
>   IF Empty( oOutlook )
>     RETURN 5
>   ENDIF
> 
>   oMSG    := oOutlook:CreateItem(0)   0 = olMailItem
>   //oMSG:To := "joe@hotmail.com" //XBase don't like "TO"
>   oMSG:setproperty("To", Target_TO)
>   IF Target_CC <> ""
>     oMSG:CC := Target_CC
>   ENDIF
> 
>   IF Target_BCC <> ""
>     oMSG:BCC := Target_BCC
>   ENDIF
> 
>   oMSG:Subject := Subject
>   oMSG:HTMLBody := HTMLMessage
> 
>   For nLoop := 1 To Len(aAttachment)
>     oMSG:Attachments:Add(aAttachment[nLoop])
>   Next
> 
>   bErreur := ErrorBlock( {|e| Break(e)} )
>   BEGIN SEQUENCE
>     IF lEnvoie
>       oMSG:Send()
>     ELSE
>       oMSG:Display(.F.)
>     ENDIF
>   RECOVER USING oError
>      Sometime Outlook return error but message is send anyway
>     IF "Fonction incorrecte" $ oError:Description .OR. ;
>       "Incorrect function" $ oError:Description .OR. ;
>       "Parameter has a wrong data type" $ oError:Description
>       nResult := 0
>     Else
>       nResult := -1
>       cError := oError:Description
>     ENDIf
>   END
>   ERRORBLOCK(bErreur)
> 
>   oMSG := nil
>   oOutlook := nil
> RETURN nResult
> 
> Further down I see this.
> 
>   TEXT INTO ::HtmlMessage WRAP
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
>   <head>
>     <title>Courriel</title>
>     <meta http-equiv="content-type" content="text/html
> charset=ISO-8859-1">
>   </head>
>   <body>
> %Body%
> </body>
> </html>
>   ENDTEXT
> 
> I replace %Body% with the real text.
Pascal BoivinRe: Windows 10 MAPI-problems
on Tue, 29 May 2018 16:57:37 +0200
Hi Thomas

That it a good question. I see some "Accounts" and "AccountSelector" on
the left on Microsoft Web page but I never use those objects.

https://msdn.microsoft.com/en-us/vba/outlook-vba/articles/application-object-outlook
Jim LeeRe: Windows 10 MAPI-problems
on Tue, 29 May 2018 23:46:25 +0200
> A customer is reporting that mails are not placed in the default Outlook
> account. Do you know if it is possible to set an account when tranferring
> an email to Outlook?

normal every User have a own Outlook.PST under %USERPROFILE%
so you have no access to other User Directory.

you can move Outlook.PST to other Dierectory
if all User work with same Outlook.PST you can make Sub-Folder for each 
User.

than make "Rules" for "olFolderInbox" to move Email to User Sub-Folder

! Note : Outlook.PST is NOT shareable.
You need Exchange Server and Outlook as Client to share Emails