Alaska Software Inc. - Windows 10 MAPI-problems
Username: Password:
AuthorTopic: Windows 10 MAPI-problems
Thomas PoolWindows 10 MAPI-problems
on Tue, 12 Dec 2017 22:20:07 +0100
Hi All,

Since the latest Win10 updates creating emails via MAPI (with socmapi.dll)
is causing problems. The message is 'send failure' or 'not supported' which
give the impression there is no default email app set. Could this have
something to do with user rights?
Does anyone have a suggestion?

Thanx & regards, Thomas
Pascal BoivinRe: Windows 10 MAPI-problems
on Wed, 13 Dec 2017 22:04:48 +0100
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.
Thomas PoolRe: Windows 10 MAPI-problems
on Thu, 14 Dec 2017 12:32:01 +0100
Op Wed, 13 Dec 2017 22:04:48 +0100 schreef Pascal Boivin:

Thanks Pascal!

You wrote

> When MAPI is not available,

Isn't this a fixed part if Win10 ?

If there is a default mail-app set one should be able to communicate with
it via MAPI? Anyway, things work fine until a Win10 update...

Regards, Thomaas
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
Salvatore Megna Re: Windows 10 MAPI-problems
on Fri, 29 Dec 2017 10:21:04 +0100
Good morning,
Also I'm having problems with sending email with socmapi.dll and windows 10
My client sends many emails.
While the program is working outlook suddenly does not open everything 
crashes.
Closing with the task manager after trying to enter the program gives a 
fatal error and my client is forced to restart the PC.

Before functioned all.





Il 12/12/2017 22:20, Thomas Pool ha scritto:
> Hi All,
> 
> Since the latest Win10 updates creating emails via MAPI (with socmapi.dll)
> is causing problems. The message is 'send failure' or 'not supported' which
> give the impression there is no default email app set. Could this have
> something to do with user rights?
> Does anyone have a suggestion?
> 
> Thanx & regards, Thomas
>