1. David Castillo
  2. PowerBuilder
  3. Thursday, 24 December 2020 21:37 PM UTC

Como puedo realizar autenticación con O365 o Active Directory Azure desde powerbuilder 2019 R2

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 25 December 2020 19:20 PM UTC
  2. PowerBuilder
  3. # 1

You could use MS Graph libraries:

https://docs.microsoft.com/en-us/graph/api/resources/azure-ad-overview?view=graph-rest-1.0

Personalmente no usaría las librerías de MS Graph directamente. Parecen cambiar mucho todo el rato y existe "MailKit": https://unop.uk/sending-email-in-.net-core-with-office-365-and-mailkit/

De esta página: https://github.com/jstedfast/MailKit/issues/989

"Microsoft have announced the retirement of basic auth for IMAP/POP in Office365 in the following blog post: https://techcommunity.microsoft.com/t5/exchange-team-blog/basic-auth-and-exchange-online-february-2020-update/ba-p/1191282 "

La ventaja de usar Mailkit es que cuando MS cambie algo, Mailkit será adaptada.

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 25 December 2020 18:58 PM UTC
  2. PowerBuilder
  3. # 2

Hola,

No estoy seguro qué es lo que quieres hacer, pero si es para acceder a Office 365 Outlook, te digo lo que nosotros hacemos.

El usuario tiene un "default" profile asignado a su Outlook y ese perfil está marcado como siempre ser usado en windows. En el momento que haya connectado a su peril por primera vez, ya introdujo sus credentiales.

Gracias a ello, cuando desde Powerbuilder queremos acceder al correo de Outlook, hacemos el Logon() sin tener que especificar ninguna contraseña en el segundo parametro.

In el código aquí abajo asigno "Default" como perfil a la variable local ls_OutlookProfile, pero en realidad ese valor la buscamos en el registro de windows.

Espero que te sirva para algo. Si no tendrás que mirar en las páginas de Microsoft como autenticar. 

string ls_OutlookProfile
oleobject lOutlookApp, loleNameSpace

ls_OutlookProfile = 'Default'
lOutlookApp = create oleobject

// u2, mjl, 08/08/17: IMPORTANT COMMENT: ConnectToNewObject fails if Outlook is "already open" and you are NOT running the EXE, and when using Outlook 365 / 2016 and up.
// (when running the exe it's working fine). (POSSIBLY this is no longer the true in 2020 !!! Outlook keeps changing little behaviour all the time).
If lOutlookApp.ConnectToNewObject("Outlook.Application") <> 0 Then
	loleNameSpace = lOutlookApp.GetNameSpace('MAPI')
	try 
		loleNameSpace.Logon(ls_OutlookProfile, '', false, false) // 2nd parameter (password) is empty.
	catch (oleruntimeError oe)
		Messagebox("Error", oe.getmessage() )
	end try
end if
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.