S22.imap using assembly

Posted by lefty1984 on 28-Mar-2019 21:07

Dear Progress developers,

Can anyone help me with assembly's? I want to use the S22.imap.dll but can't find how to do that with 4gl code.
Where do I need to "install" the s22.imap.dll so I can use it in 4gl?

I'm using "USING S22.Imap.*    FROM ASSEMBLY." but this doesn't work.
Can anyone help me with that?

Posted by Ruben Dröge on 29-Mar-2019 10:23

I think Laura gave some good pointers, but you could also start your procedure editor with -assemblies <path_to_assemblies.xml> startup parameter to accomplish it.

All Replies

Posted by rblanchard@ospreyretail.com on 28-Mar-2019 21:30

Did you add it to your assemblies.xml file?

Roger Blanchard
(O) 508-992-1097
(M) 508-415-9982
Sent from my mobile device



Posted by lefty1984 on 28-Mar-2019 22:04

Dear Roger, I don't use a assemblies.xml file. Only in my projects I'll use it.

This is the code I use:

--------------- 4GL code ---------------
USING System.Net.*  FROM ASSEMBLY.
USING System.IO.*   FROM ASSEMBLY.
USING S22.Imap.*    FROM ASSEMBLY.
 
DEFINE VARIABLE M-IMAP-USERNAME         AS CHARACTER                                NO-UNDO.
DEFINE VARIABLE M-IMAP-PASSWORD         AS CHARACTER                                NO-UNDO.
DEFINE VARIABLE M-COUNT                 AS INTEGER                                  NO-UNDO.
 
DEFINE VARIABLE M-OBJ-CLIENT            AS CLASS S22.Imap.ImapClient                NO-UNDO.
DEFINE VARIABLE M-OBJ-AuthMethod        AS CLASS S22.Imap.AuthMethod                NO-UNDO.
DEFINE VARIABLE M-OBJ-RemoteCertificateValidationCallback 
                                        AS CLASS System.Net.Security.RemoteCertificateValidationCallback
                                                                                    NO-UNDO.
DEFINE VARIABLE M-OBJ-SearchCondition   AS CLASS S22.Imap.SearchCondition           NO-UNDO. 
DEFINE VARIABLE M-OBJ-MailMessage       AS CLASS System.Net.Mail.MailMessage        NO-UNDO.

DEFINE VARIABLE oUints                  AS CLASS "System.Collections.Generic.IEnumerable<unsigned-integer>"              NO-UNDO.
DEFINE VARIABLE oMessages               AS CLASS "System.Collections.Generic.IEnumerable<System.Net.Mail.MailMessage>"   NO-UNDO.
DEFINE VARIABLE oIEnumerator            AS CLASS System.Collections.IEnumerator     NO-UNDO.
 
M-OBJ-CLIENT = NEW S22.Imap.ImapClient("", 993, TRUE, M-OBJ-RemoteCertificateValidationCallback).
M-OBJ-CLIENT:Login(M-IMAP-USERNAME, M-IMAP-PASSWORD, M-OBJ-AuthMethod) NO-ERROR.
 
/* IEnumerable<uint> uids = Client.Search( SearchCondition.All()); */ 
 
oUints    = CAST(M-OBJ-CLIENT:Search(SearchCondition:ALL(), "Inbox"),  System.Collections.IEnumerable).
 
/* IEnumerable<MailMessage> messages = client.GetMessages(uids); */

oMessages = CAST(M-OBJ-CLIENT:GetMessages(oUints, true, "Inbox"), System.Collections.IEnumerable).
oIEnumerator = oMessages:GetEnumerator().
 
DO WHILE oIEnumerator:MoveNext():
   M-OBJ-MailMessage=CAST(oIEnumerator:Current, System.Net.Mail.MailMessage).
   ASSIGN M-COUNT=M-COUNT + 1.
MESSAGE 
   M-OBJ-MailMessage:From
VIEW-AS ALERT-BOX.
   
END.

Posted by Roger Blanchard on 28-Mar-2019 22:09

I think my point is you need to use assemblies.xml. As far as I know that is a requirement. All the assemblies I reference in my code I add to the assemblies.xml in my project. There is an assemblies tool that will allow you to add your assemblies.

Posted by lefty1984 on 28-Mar-2019 22:18

Roger, is that also for 4gl code? I never use it in 4gl code. In my project I've got an assemblies.xml with the s22.imap in it.

But in 4gl I didnt have a assemblies.xml

Posted by Roger Blanchard on 28-Mar-2019 22:23

I am not sure what you mean 4gl code. Isn't it all 4gl code? Are you using PDSOE? If so you add it to your project assemblies and then your 4gl code should be able to reference it.

Posted by lefty1984 on 28-Mar-2019 22:29

Roger, I'm using the PDSOE. But this code was writen in the progress editor. And I want to know if I can connect a Assemblies.xml to the code or if I can store the .DLL file in the Windows Assembly or something. System.net and system.IO are ok.

If there is no other option to do it, ill have to build it in a project.

Posted by lefty1984 on 28-Mar-2019 22:29

Roger, I'm using the PDSOE. But this code was writen in the progress editor. And I want to know if I can connect a Assemblies.xml to the code or if I can store the .DLL file in the Windows Assembly or something. System.net and system.IO are ok.

If there is no other option to do it, ill have to build it in a project.

Posted by lefty1984 on 28-Mar-2019 22:29

Roger, I'm using the PDSOE. But this code was writen in the progress editor. And I want to know if I can connect a Assemblies.xml to the code or if I can store the .DLL file in the Windows Assembly or something. System.net and system.IO are ok.

If there is no other option to do it, ill have to build it in a project.

Posted by lefty1984 on 28-Mar-2019 22:29

Roger, I'm using the PDSOE. But this code was writen in the progress editor. And I want to know if I can connect a Assemblies.xml to the code or if I can store the .DLL file in the Windows Assembly or something. System.net and system.IO are ok.

If there is no other option to do it, ill have to build it in a project.

Posted by lefty1984 on 28-Mar-2019 22:29

Roger, I'm using the PDSOE. But this code was writen in the progress editor. And I want to know if I can connect a Assemblies.xml to the code or if I can store the .DLL file in the Windows Assembly or something. System.net and system.IO are ok.

If there is no other option to do it, ill have to build it in a project.

Posted by Roger Blanchard on 28-Mar-2019 22:30

IF the S22.imap.dll is not in the GAC then you need to copy it to where your assemblies folder is. When you defined your project you tell it where you assemblies.xml folder is located and this dll should be in the same folder. I typically create an Assemblies folder under my project root folder and put the assembles.xml in that folder as well as all the dll's that are not in the GAC.

Posted by Laura Stern on 28-Mar-2019 22:40

I think you’re confused about what an assembly.xml file is.  It is not put into your ABL code.  It is simply an .xml file that you can create with the Assembly References tool which is available from PDSOE as well as the AppBuilder.  You simply put your .dll file in a folder, either in your current working directory or elsewhere, you choose the .dll you want to reference from the tool and it adds a line in the .xml file for it.  You put the xml file in the same place as the .dll.  Then you use the -assemblies startup parameter to tell the AVM where to find it.  The AVM will then load the .dll so your code will run.  If the .dll and the .xml file are in your current working directory, you do not need to use the -assemblies parameter.

Posted by Laura Stern on 28-Mar-2019 22:40

I think you’re confused about what an assembly.xml file is.  It is not put into your ABL code.  It is simply an .xml file that you can create with the Assembly References tool which is available from PDSOE as well as the AppBuilder.  You simply put your .dll file in a folder, either in your current working directory or elsewhere, you choose the .dll you want to reference from the tool and it adds a line in the .xml file for it.  You put the xml file in the same place as the .dll.  Then you use the -assemblies startup parameter to tell the AVM where to find it.  The AVM will then load the .dll so your code will run.  If the .dll and the .xml file are in your current working directory, you do not need to use the -assemblies parameter.

Posted by Ruben Dröge on 29-Mar-2019 10:23

I think Laura gave some good pointers, but you could also start your procedure editor with -assemblies <path_to_assemblies.xml> startup parameter to accomplish it.

Posted by lefty1984 on 02-Apr-2019 21:49

Thanks for your advise, Its working now :)

This thread is closed