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;
--