Article

From:
To:
Hans Reier Sigmond
Subject:
Re: how to update an appointment
Newsgroup:
rapware.public.easymapi

Re: how to update an appointment


Outlook 64 bit, 2010
Test program 64 bit Delphi XE3
Windows 7 Servicepack 2
Exchange: Not installed yet
MAPI RAPWare components V6 I found in the help file. Is this the version 
number or found elsewhere?
I will now check if I already have got the latest trial version or not,
the version I downloaded is not very old.
E.g. RwEasyMAPI32.exe is dated 07.11.2012.

I have not yet downloaded another newer version if existing, but I will of cause do that.
More information about the problems after retesting. The result of the test is found using 64 bit outlook and 64bit testprogram including MAPI.
Beeing aware of the 32/64bit version differences, really solved a lot of the problems that I have had, but not all of them (I was not aware that our Outlook installation was 64bit). This is not very surprising. E.g. the programs HKData develop stores things in registry, and 32 bit registry entries is not stored in the same place as the 64 bit entries.
PROBLEM A)
The problem of access violation actually disappeared when I was aware of the 32bit/64bit differences. I now manage to enter new appointments and also to alter the appointsments without getting access violation.
But it is still one important exception:
!! If I run/debug the program in Rad Studio, even if I compile it to 64 bit; I still get the access violation error. Has this something to do with Rad Studio beeing a 32 bit application??? If I run the generated exe file from the command line or in Windows explorer, the access violation error has disappeared. Have you got any idea for what that can cause this?
PROBLEM B) I am not really sure if I really need the name of the sender (it is blank), so I will eventually look into that later. At one point I thought that this was connected with the access violation problem, but it is not.
PROBLEM C) This problem stil remains and is as expected not related to the 32/64 bit issue. I will look into that later after studying the example code.
Reier

Den 01.03.2013 08:52, skrev Hans Reier Sigmond:
> PROBLEM A)
>
> The code that fails A), is at the bottom in this email. newAppt.Send.
> I have in fact already studied the MsgStoreAppointments example,
> but it is of cause possible that I have missed something.
> The problem is that the sample application seems to fail in the exact
> same way as my function. Running it, I log on, invite a contact, and
> pressing send. The result is access violation, exactly like in my
> program. Here is a copy of your example code that fails with access
> violations:
>
> procedure TFrmAppointment.actSendExecute(Sender: TObject);
> begin
>    inherited;
>    SetMessageProps;
>    (Msg as IRwMapiAppointment).Send; //Fails, access violation.
>    Close;
> end;
>
> PROBLEM B)
>
> New comment. I have observed that my function (at the bottom of this
> email), did not set the PR_SENDER.. properties properly. Is that
> required? How does MAPI pick up the sender? The code below should
> pick the organizer, but it is nothing there...
>   NewAppt.Body :=   'Organisator:'+NewAppt.Organizer+SLineBreak+
>                          'Mottagere:'+Recipients; //for debug
> Yesterday I added the following code before that line (just for testing):
> NewAppt.PropByName(PR_SENDER_EMAIL_ADDRESS).AsString
> :='✉hk-data.no';
>          NewAppt.PropByName(PR_SENDER_NAME).AsString :='Hans Reier
> Sigmond';
> PR_SENDER_NAME seems to be the same as organizer. But the attribute
> PR_SENDER_ENTRYID is still without a value. Should it be set (by the
> system or by the programmer)?.
>
> Can a misssing PR_SENDER_ENTRYID cause other errors?
>
> PROBLEM C)
>
> I will look at the example before eventually adding more comments.
> What I do see is that my current code does this completely wrong in many
> cases.
>
> Reier (I usually use my middle name and not the first one)
>
>
>
> Den 28.02.2013 20:01, skrev P. Wolters (RAPWare):
>> Hi Hans,
>>
>> I recommend you take a look a the MsgStoreAppointments example
>> application (intermediate examples directory). This application
>> demonstrates how to create appointments and how to send meeting
>> requests.
>>
>>
>>> PROBLEM A) NewAppt.Send. This works OK for a new appointment
>>> When I try to open an existing appointment by EntryId,
>>> I always get access violation.
>>
>> It sounds like the problem is in the code that opens the appointment.
>> Do you have a code snippet of that code?
>>
>>
>>> PROBLEM B) I have observed that the organizer is not stored in the
>>> recipient table. Should it be?
>>
>> No. The organizer is retrieved from the person who creates the
>> appointment.
>>
>>
>>> PROBLEM C) NewAppt.SaveChanges. In most of the cases the changes are
>>
>> It looks like you have a name resolve issue.
>> I recommend you take a look at the AddrBookNameResolving.dpr example
>> application (in the basic examples folder) to see what Name resolving
>> is and how it work.
>>
>> Regards,
>>
>> Peter.
>>
>>
>>
>> Hans Reier Sigmond wrote:
>>
>>> I have written a small Delphi function that can add a new appointment
>>> and update the same apointment. There are several problems with this
>>> routine that I so far are unable to solve. I suspect that it is my
>>> understanding of MAPI that is not good enough to solve this.
>>>
>>> To your information: We are currently not using an exchange server,
>>> can this cause problems? We are going to do this, but have not
>>> installed it yet.
>>>
>>> PROBLEM A) NewAppt.Send. This works OK for a new appointment. When I
>>> try to open an existing appointment by EntryId, I always get access
>>> violation.I have tried to display the various access rights set for
>>> folders and appointments (MAPI parameters), but I cannot figure out
>>> anything wrong. I suspect this is a MAPI issue. I have also tries to
>>> set various MAPI  parameters, but with no success so far. Has anyone
>>> got an idea of what the problem can be?
>>>
>>> PROBLEM B) I have observed that the organizer is not stored in the
>>> recipient table. Should it be? The name of the organizer is empty.
>>> Can this small problem be connected with PROBLEM A). I am still able
>>> to define a new appointment, invite recipients and the result appears
>>> in outlook, but the name of the organizer is empty. Where does MAPI
>>> fetch this information?
>>>
>>> PROBLEM C) NewAppt.SaveChanges. In most of the cases the changes are
>>> saved as expected, but not always. The recipient list is e.g. entered
>>> like this: Hans Reier Sigmond; Per Arne Trillerud; ..., all the names
>>> separated by semicolons in the Recipients string. The AddRecipients
>>> method looks in the Outlook contacts and other places in Outlook and
>>> will map these names into email address if it can find it.
>>>
>>> When the NewAppt.SaveChanges are run, a popup dialog appears and I am
>>> able to select from the contact list if the receipient is not found.
>>> Fine so far... But when I e.g. look at the created appointment,
>>> outlook in many cases mixes up the email adresses (e.g. picks the
>>> email address of Per Arne Trillerud and not mine). But it is not only
>>> the email address that get mixed up, sometimes it also picks the
>>> wrong recipient and displays in outlook. And I am unable to correct
>>> this manually since it is the automatic mapping that is wrong, and
>>> not the one where I am asked to search for the appropriate contact.
>>>
>>> best regards from Hans Reier Sigmond
>>>
>>> I am currently evaluating easyMapi. Problem C) is for our company
>>> quite serious, since the response is unpredictable.
>>>
>>> (Search in the below code for "PROBLEM .." where the problems occurs).
>>>
>>> Here us the code:
>>>
>>> function TOutlookForm.CreateAppointment(Subject, Location: String;
>>> Start, Finish: TDateTime;   Recipients: string; EntryId:
>>> TRwMapiEntryId): TRwMapiEntryId; var
>>>    NewAppt: IRwMapiAppointment;
>>>    Invited: IRwMapiRecipientTable;
>>>    MsgStore: IRwMapiMsgStore;
>>>    Organizer : TRwMapiEntryId;
>>> begin
>>>    try
>>>      try
>>>        //  MapiSession.LogonInfo.ProfileName := '';
>>>       MapiSession.LogonInfo.ProfileRequired := False; //No logon
>>> dialog is shown       MapiSession.LogonInfo.ShowLogonDialog := True;
>>> //Why this?       //MapiSession.LogonInfo.ShowPasswordDialog := true;
>>>
>>>        MapiSession.LogonInfo.UseExtendedMapi := True;
>>>        MapiSession.Active := false;
>>>
>>>        if not(MapiSession).Active then
>>>        begin
>>>          MapiSession.Logon; //Eventually show logon dialog, log on!
>>>        end;
>>>
>>>        if (EntryId <>null) then
>>>        begin
>>>          ShowMessage('Åpner eksisterende avtale');
>>>          MsgStore := MapiSession.OpenDefaultMsgStore;
>>>          NewAppt :=  MsgStore.OpenMessage(EntryId) as
>>> IrwMapiAppointment;         //NewAppt.DisplayProperties;
>>>          NewAppt.Recipients.DisplayFields;
>>>        end else
>>>        begin
>>>         NewAppt := MapiSession.CreateMessage(ftAppointment) as
>>> IRwMapiAppointment;
>>> NewAppt.Recipients.AddRecipients(Recipients, rtTo, true);       end;
>>>
>>>
>>>        NewAppt.Subject := Subject;
>>>        NewAppt.Location := Location;
>>>        NewAppt.SetDateRange(false, Start, Finish, true );
>>>        NewAppt.ReminderMinutesBeforeStart := 15;
>>>        NewAppt.ReminderSet := true;
>>>        NewAppt.BusyStatus := 0;
>>>        NewAppt.Body := ''; //No comments, not allowed
>>>        NewAppt.Body :=   'Organisator:'+NewAppt.Organizer+SLineBreak+
>>>                          'Mottagere:'+Recipients; //for debug PROBLEM
>>> B)       NewAppt.IsPrivate := false;
>>>       NewAppt.PropByName(NPR_SEND_INVITATIONS_AND_UPDATES).AsBoolean
>>> := true;       NewAppt.Categories := 'Rusdata';
>>>
>>>        NewAppt.SaveChanges(smKeepOpenReadWrite); //PROBLEM C)
>>>        NewAppt.MeetingRequestSent := false;
>>>
>>>        NewAppt.Send; //Send to recipients PROBLEM A
>>>        Result := NewAppt.EntryID;
>>>      except
>>>        on E: EOleException do ;
>>>        else raise;
>>>      end;
>>>    finally
>>>      MapiSession.Logoff;
>>>      MapiSession.Active := false;
>>>    end;
>>> end;
>>
>>
>>
>
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Fri, 01 Nov 2024 02:38:51 UTC
Copyright © 2009-2024
HREF Tools Corp.