Uniface User Forum

 View Only
Expand all | Collapse all

Create Appointment Item Outlook 2019 and find by EntryID

  • 1.  Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 08-27-2021 05:34

    Hello,

    i want to create an appointment item in outook 2019 (365). After save this item has to be display.

    After the display i need this item to work with it, but the instance ends after display.

    I start a new outlook "session" to find the item with the EntryID but it end with an -155 error at the last line .... GETITEMFROMID.

    Any Idea oder experience about this?

    newinstance "OUTLOOK16_APPLICATION", hv_APPLICATION
    hv_APPLICATION->CREATEITEM(hv_TASKITEM, 1)
    hv_TASKITEM->SET_SUBJECT("TEST")
    hv_TASKITEM->SAVE()
    hv_TASKITEM->GET_ENTRYID(sv_ENTRYID)
    hv_TASKITEM->DISPLAY("TRUE")
    
    newinstance "OUTLOOK16_APPLICATION", hv_APPLICATION
    hv_APPLICATION->GET_SESSION(hv_SESSION)
    hv_SESSION->GETDEFAULTFOLDER(hv_DEFAULTFOLDER,9)
    hv_DEFAULTFOLDER->GET_STOREID(sv_STOREID)
    hv_SESSION->GETITEMFROMID(hv_TASKITEM,sv_ENTRYID,sv_STOREID)

    THX a lot



  • 2.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 08-27-2021 08:31

    Hi Dirk,

    could it be you should explicitely use deleteinstance for your first instance before let's code going for the second newinstance?
    Or:
    you should use another handler to manage two instances in memory without hiccups?

    I did not verified these suggestions ... 😉

    Regards,
    Gianni




  • 3.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 08-27-2021 08:48

    Hello Gianni, i check this to delete the instanceses bue...

    It dosn't resolve this issue... 



  • 4.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 08-27-2021 10:42

    Hi Dirk,

    mmmhhhmmm...

    Error -155 is related to newinstance and it is described as:

    -155

    UACTERR_CREATE_INSTANCE

    An error occurred while creating an instance:

    • An unknown property occurs in the instance properties.
    • A property in the instance properties has a value that is not valid.
    • The component could not be loaded.
    • An exit statement was executed in the operation INIT.

    The description is obviously related to a Uniface component instance but it is applicable with a "grain of salt" to any newinstance.

    Few more thoughts:
    - are you sure you declared all variables in a proper way?
    - any feedback ($status or $result) in the code lines before the one giving error? All expected INOUT or OUT parameters are exiting without any hiccups?
    - could it be a timing problem? Try to add a deleteinstance then put a sleep instruction for at least 2-3 seconds before the 2nd new instance.
    - Is Outlook on that machine/node already correctly initialized? I mean: opening it interactively does not show any intermediate question screen?

    Regards,
    Gianni



  • 5.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 08-27-2021 11:01

    Hello Gianni,

    this is the $procerrorcontext:

    "ERROR=-155·;
    MNEM=<UACTERR_CREATE_INSTANCE>·;
    DESCRIPTION=Error creating instance·;
    COMPONENT=WEB1000D90·;
    PROCNAME=LP_TEST·;
    TRIGGER=DTLF·;
    LINE=15"

    And this the Screenhot from debugging:

    I have allready a status = 0 for all the other instances.

    I think the issue is into the parameters for the GETITEMFROMID?
    Thanks



  • 6.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 08-27-2021 11:04

    This is the signature:



  • 7.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 08-27-2021 13:16

    Hi Dirk,

    mmmhhhmmm...

    I do not see any connection to a mailbox in your code...AFAIK it is mandatory.
    Is it somehow implicitly executed?

    Regards,
    Gianni



  • 8.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-01-2021 08:37

    Hi Dirk,


    did you check the Signature?

    When I import the Signatures with

    /sti /mwr=com /pid Outlook.Application:outlook_

    then I got many "?UNKNOWN?" Handles!!!


    Also I can not found any Signatures for Class TaskItem nor Class AppointmentItem.

    Maybe you have to program your own DLL or EXE with .NET?


    Regards

    Norbert



  • 9.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 09-01-2021 10:13

    Hello Norbert,

    i think this is the problem to work with this signature.

    There is no Classifikation found!

    I checked this too, and you are right!

    This is the reason for this issue

    Thanks Norbert....



  • 10.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-01-2021 13:00

    Hi guys,

    Just to clarify how I am usually resolving these hiccups with signatures imported with /sti.

    Uniface, being component based, is defining the output mapping for an object handler to ?UNKNOWN? when a single call could exit pointing to different objects structures; this latest behaviour is typical of object based programming. We need to resolve these ?UNKNOWN? definitions substituting each of them with a real object structure managed from the external program before being able to use that call into Uniface.

    Let's use CreateItem() from Outlook as an example; depending from how it is called AFAIK it could exit with:
    - an __items() object structure
    - a _mailitem() object structure (usable for appointments, as we have just discovered together, working on Dirk issue)
    - a _contactitem() object structure

    In these cases I fully duplicate the original operation loaded from /sti into those needed from my Uniface programs; in this case I will have:
    - a CreateItem() original method, with handle pointing to __Items() object structure
    - a UCreate_Mail, complete duplication of the original CreateItem(), but with handle pointing to _MailItem
    - a UCreate_Contact, complete duplication of the original CreateItem(), but with handle pointing to _ContactItem

    The important parts are:
    1) to duplicate the operation in a complete way, including "Literal Name" of each parameter.
    2) I am also using a U in front of operation name to easily identify these custom operations.
    3) To properly document those customization into comment field of each new operation.

    Hope it helps.

    Gianni



  • 11.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 09-01-2021 13:09

    Hello Gianni,

    great job!

    This work for me to resolve my issue in this case.

    I follow your description and now my code is running how i want!

    Thank you for thelot of work to invest to help me.

    Dirk



  • 12.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-01-2021 07:42

    Hi Dirk,

    I am back to work now and I am checking your code to my repo.

    I've used O16_ as a prefix while loading Outlook16 signatures into Uniface repo. So where you have OUTLOOK16_ in mine you will see O16_.

    Let's go step by step. I am finding no issue while executing first two instructions:

    newinstance "OUTLOOK16_APPLICATION", hv_APPLICATION
    hv_APPLICATION->CREATEITEM(hv_TASKITEM, 1)

    Now...I am getting -59 (operation does NOT exists) after executing SET_SUBJECT(). The SET_SUBJECT operation is requested into the object given back from previous istruction CREATE_ITEM(). My CREATE_ITEM() operation is giving back a O16__ITEMS object while your should be mapped to a different object; I've executed this query into my Uniface repo:

          select uspecnam from usoper where uspecnam like 'O16_%' and uopernam = 'SET_SUBJECT'

    it is giving back components which includes the SET_SUBJECT() operation/method; the result is:

    USPECNAM
    ==================
    O16_CONTACTITEM
    O16_MAILITEM
    O16_SHARINGITEM
    O16__CONTACTITEM
    O16__MAILITEM
    O16__SHARINGITEM
    O16__STORAGEITEM

    To which of those objects is it mapped your CREATE_ITEM() operation/method?

    My bet is for *_MAILITEM... 🙂 If yes, have you already used your signatures to build a sending mail functionality before?

    Regards,
    Gianni



  • 13.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-01-2021 09:36

    Hi Gianni,

    hv_APPLICATION->CREATEITEM(hv_TASKITEM, 1)
    should create an AppointmentItem!!!
    But you will not find an O16_AppointmentItem nor an O16_TaskItem in Uniface.
    See also my Comment below.

    Regards
    Norbert


  • 14.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-01-2021 09:54

    Hi Dirk,

    OK, I've (temporarly) mapped object pointed from CREATEITEM() to O16__MAILITEM.

    Now SET_SUBJECT() is correctly executed and the following one SAVE() too; but two things:

    1) next instruction: GET_ENTRYID is giving back null while it should give back a string, probably a UUID()
    2) last instruction of first block is showing an email screen, symptom it was building an email, NOT an appointment.

    I'll try to figure out how to build an appointment because I need it too.

    Regards,
    Gianni




  • 15.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-01-2021 10:10

    Hi Dirk,

    I've (temporarly) modified object pointed from CREATE_ITEM() to O16__MAILITEM. Now first part of your code works up to SAVE() but after that things are not clear:

    1) GET_ENTRYID(sv_ENTRYID) give back NULL while it should give back a string, probably an UUID().
    2) The following instruction DISPLAY("TRUE") let's an email screen be shown, which is sympthom Outlook was composing an email, NOT an appointment.

    Now, VBA code to create an appointment is something like:

    Sub CreateAppt()
     Dim myItem As Object 
     Dim myRequiredAttendee, myOptionalAttendee, myResourceAttendee As Outlook.Recipient 
     Set myItem = Application.CreateItem(olAppointmentItem) 
     myItem.MeetingStatus = olMeeting 
     myItem.Subject = "Strategy Meeting" 
     myItem.Location = "Conf Rm All Stars" 
     myItem.Start = #9/24/2009 1:30:00 PM# 
     myItem.Duration = 90 
     Set myRequiredAttendee = myItem.Recipients.Add("Nate Sun") 
     myRequiredAttendee.Type = olRequired 
     Set myOptionalAttendee = myItem.Recipients.Add("Kevin Kennedy") 
     myOptionalAttendee.Type = olOptional 
     Set myResourceAttendee = myItem.Recipients.Add("Conf Rm All Stars") 
     myResourceAttendee.Type = olResource 
     myItem.Display 
     myItem.Send 
    End Sub

    I'll try to build something similar which works because I need it too.

    Regards,
    Gianni




  • 16.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 09-01-2021 10:49

    Hello Gianni,

    after die Post from Norbert i do the same and mapped the UNKNOWN classifikation to the OUTLOOK16_MAILITEM Signature like this:

    Why?

    I need the functions from the _MAILITEM Signature.

    AND IT WORKS

    This is now the rest of the programcode:

    hv_SESSION->GETITEMFROMID(hv_TASKITEM,sv_ENTRYID,sv_STOREID)
    hv_NAMESPACE->CREATERECIPIENT(hv_RECIPIENT,"Hotline-IMS")
    hv_RECIPIENT->RESOLVE(bv_RESOLVE)
    if (bv_RESOLVE == 1)
    	hv_NAMESPACE->GETSHAREDDEFAULTFOLDER(hv_SHAREDDEFAULTFOLDER,hv_RECIPIENT,9)
    	hv_TASKITEM->MOVE(hv_MOVE,hv_SHAREDDEFAULTFOLDER)
    endif

    If we found the Entry-ID:

    Create an Recipient, resolve him and move the appointmantitem to his folder.

    THANKS to Gianni and Norbert for your help and the right ideas!



  • 17.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-02-2021 07:20

    Hi all,

    when I import the Signatures with

    /sti /mwr=com /pid Outlook.Application:outlook_

    then I can not found any Signatures for Class TaskItem nor Class AppointmentItem


    but when I import the Signatures with

    /sti /mwr=com "C:\Program Files\Microsoft Office\root\Office16\MSOUTL.OLB"

    then I will find them as TASKITEM and U_TASKITEM ...



    So what is the Difference between the to Statements?

    Why can't we use a prefix for the second Statement?


    Regards

    Norbert



  • 18.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-02-2021 07:59

    Hi Norbert,

    very nice findings... I am very interested in it!!!

    I know you tried almost everything but asking must be done...have you tried:

    "C:\Program Files\Microsoft Office\root\Office16\MSOUTL.OLB":moreoutlook_

    Regards,
    Gianni



  • 19.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 09-02-2021 08:03

    Hello Norbert,

    i checked your post into my test-environment and now i can find also a appointment signature.

    but we can't use it in this way!

    I have the same questions you ask!

    We need the secound statement with a prefix.

    Regards

    Dirk



  • 20.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    PARTNER
    Posted 09-02-2021 08:09

    Hello Gianni,

    this is the test:



  • 21.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-02-2021 11:28

    Hi all,

    for now we don't use outlook.


    But for Excel and Word I am doing the following:

    • Only once:
      • import the Signatures form Excel/Word in a new fresh sandbox
      • export the Signatures to XML
    • Record a Macro for the Things I want to do in Excel/Word
    • Look at the Steps in the Macro-Editor to see which Signatures are used
    • Extract the needed Signatures from the XML, edit them in an Editor (like prefixing the name) and import them to the Project
    • Look at the VBA-Documentation to see which types the Parameters belong to and adjust the Signature


    In the evening I will do some Tests, to see what is Difference between the to Import-Methods.


    Regards

    Norbert



  • 22.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-02-2021 13:25

    Hi guys,

    I made search over internet and it seems something changed into Outlook starting from Outlook2013. When MS Office 2013 went out on the market people still using VB6 were complaining about some missing calls into official Outlook type library and someone from Microsoft pointed them to MSOUTL.OLB file, the one that Norbert pointed out. This hypothesis is also confirmed from signatures loaded loaded from MSOUTL.OLB with suffix _10 or _11 or _12 pointing to methods overcome in a new version in the Outlook evolution.

    Based on this fact I've imported on my working machine into a temporary Uniface repo all Outlook signatures either coming from:
    - as described into Uniface documentation: /sti /mwr=com /pid Outlook.Application:OL19
    - as found from Norbert: /sti /mwr=com "C:\Program Files\Microsoft Office\root\Office16\MSOUTL.OLB"
    Each of those two groups were collected into a separate SubSystem (Sorry guys, still U9 here!):
    - MSOFFICE
    - OUTLOOK2019PLUS

    I've made a quick comparison for few common signatures between the two groups; I've used these component signatures:
    - (prefix)application
    - (prefix)recipient
    They are IDENTICAL, same operations and same parameters, with differences only into fields TIMESTAMP, COMPONENTNAME, SUBSYSTEM (obviously!).

    At this point it seemed to me those loaded from MSOUTL.OLB were a superset of those coming from Outlook PID  and again those coming from MSOUTL.OLB seeed more aligned to current Outlook functionalities.

    To confirm the first impression I've built a spreadsheet extracting ALL signatures from both groups, normalizing signatures names and ordering them; this is confirming the signatures group from MSOUTL.OLB is a COMPLETE superset of the other group. The spredsheet could be downloaded from HERE. Rows marked with yellow color are related to signatures only available from MSOUTL.OLB.
    BTW: there are two cases where signatures names are different but it is a condition forced from 32char max length for signatures names into Uniface repo; literal name for both cases is larger and identical.

    Hope this help everyone working with Outlook signatures in a Uniface program.

    If anyone would like to share more informations on this subject, it would be more than welcome!

    Regards,
    Gianni



  • 23.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    ROCKETEER
    Posted 09-02-2021 15:19

    Some time ago I've created a little tool for COM (and C) signatures that can be found on Github:

    > https://github.com/uniface/tool-development/tree/u9/uniface-sigwiz

    In 2015 I even gave a presentation about the tool at the German user conference in Augsburg (https://www.u-b-g.org/tagung/201501/).

    I also have a Uniface 10 version of the tool, but it's not yet on Github. I, however can share it if someone is interested.

    And the difference between importing the COM signatures using /pid or a type library is as follows:

    When /pid is used then Uniface:

    • will instantiate the specified COM object and query the API of the running object recursively
    • it hereby starts with the object specified by /pid (e.g. Outlook.Application) and then queries every available method or property; when something returns another object then Uniface will try to instantiate that as well an continue to query the API until there's nothing left (so to speak)
    • for each identified object a signature is created and for each method or property of that object Uniface will create an operation with its parameters; in case the discovered interface is not compatible with Uniface then this will fail and a warning/error is returned; some data types also default back to string although it might be something different that Uniface does not know or is not clear (e.g. the actual data type of the the returned value depends on how the method/property is called)
    • it is possible that not all the available objects are directly accessible through the API of the instantiated object; in some cases just an object is returned without specifying it's actual type or PID; for this Uniface will then create a handle parameter with an UNKNOWN classification

    When using the type library then Uniface:

    • will read the library file sequentially and creates signatures for the detected objects, methods, properties, ...
    • from here on the process is similar to what /pid is doing
    • again, when an unspecified object is returned then Uniface create a handle parameter with  an UNKNOWN classification

    The above mentioned tool allows you to check all parameters for the UNKNOWN handle classification and from the search result you can open the affected operations. From there you can easily change the classification.

    Besides this the tool also allows you to add a prefix to all signatures or rename them in one go (or individually). You also can rename, copy, or move operations. In addition you also can navigate from one signature to another (by double clicking on the handle classification of a parameter). You can also filter the signatures, import, export, or compile them. There's probably more, but that's all I remember at the moment.

    I hope this helps.



  • 24.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-02-2021 22:23

    Hello Daniel,

    I am interested in the Uniface 10 version of the tool.


    Regards

    Norbert



  • 25.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    Posted 09-03-2021 08:15

    Hi Daniel,

    first of all: thanks for this GREAT tool!

    Three questions:

    1) Is there any difference between "renaming" and "adding a prefix" in both cases to a single signature?
    2) When adding a prefix to more signatures those with a version at the end (like _10) very often generate an error like "A prefix is already defined" but renaming the same signature it works! Could you explain a little bit more what's happening in these cases?
    3) I've collected SIGWIZ a long time ago (I do not rember exactly). I do not found a change log on github. Did you've change/maintained it somehow?

    Thanks again.

    Regards,
    Gianni



  • 26.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    ROCKETEER
    Posted 09-09-2021 16:56

    Apologies for not replying earlier. I could not find time before to do this.

    I've found a problem with the tool specific to UF10 and I've tried to fix it. It now should work again as it does in version 9. Will provide the export in the coming days. Thanks for your understanding.

    Gianni, I've also created a doc for the tool and it's available as PDF on github. It should explain all the different functions.

    The behavior described in 2) is not correct and I've tried to correct this. It hopefully will work better with the updated version for UF10.

    And there is no change log. I don't think that I've ever made any changes to the version I've uploaded to Github.

    Hope this helps.

    Regards,
    Daniel



  • 27.  RE: Create Appointment Item Outlook 2019 and find by EntryID

    ROCKETEER
    Posted 09-14-2021 16:54

    I've put the updated sources of the SigWiz tool for Uniface 10.3 here (for the time being):

    > https://file.ac/dj5BRQUdMXY/

    The goal is to make this available on GitHub as well.