Posts 1 - 10 of 13
First | Prev. | 1 2 | Next | Last
|
|
Charles van den akker
Guest
|
I have been struggling to use this event effectivly...
OnAddItem i have kinda "mastered"... (because the event is fired once! per item)
As an inspector window opens then OnChangeEvent is fired a few times!...(i think becasue the lastModifiedDate has been changed (temp))?? also when a reminder pops up and you meerly dismiss it or snooze it... it actully changes the properties... so the event is fired again...
What i would like to know is:
1) how do i identify if only specific properties have been changed(OnChangeItemEvent);
2) how do i add custom Fields to ItemForms programatically
thanx
|
|
Posted 28 Nov, 2005 01:40:18
|
|
Top
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Charles,
1) You can try to handle the OnPropertyChange event. I hope it will be more useful than the OnItemChange event.
2) See the UserProperties property of the appropriate interface (_MailItem, _ContactItem, etc.). This is a collection of user-defined fields for an Outlook item.
|
|
Posted 28 Nov, 2005 06:56:16
|
|
Top
|
|
Charles van den akker III
Guest
|
i have tried to use your suggestions ... however i have been unsuccesful..
Where do i access the OnPropertyChange event? (tried via app, inspector and item)??
i can read the userProperties... but not check if they exist as well..
please could you mail me an example
for both queries
|
|
Posted 28 Nov, 2005 07:58:29
|
|
Top
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Charles,
1) See the code snippet below.
2) The collection includes 4 methods, one of which is Find. You can use this method to check if the user-defined property exists.
procedure TAddInModule.ScanCalendarFolder;
var
i, Count: Integer;
IDsp: IDispatch;
IFolder: MAPIFolder;
IAppointment: _AppointmentItem;
IMeeting: _MeetingItem;
Item: TOleServer;
begin
IFolder := OutlookApp.GetNamespace('MAPI').GetDefaultFolder(olFolderCalendar);
if Assigned(IFolder) then
try
Count := IFolder.Items.Count;
for i := 1 to Count do begin
IDsp := IFolder.Items.Item(i);
if Assigned(IDsp) then
try
IDsp.QueryInterface(IID__AppointmentItem, IAppointment);
if Assigned(IAppointment) then begin
Item := TAppointmentItem.Create(nil);
TAppointmentItem(Item).ConnectTo(IAppointment);
TAppointmentItem(Item).OnOpen := DoItemOpen;
//
{
TAppointmentItem(Item).OnCustomAction := ;
TAppointmentItem(Item).OnCustomPropertyChange := ;
TAppointmentItem(Item).OnForward := ;
TAppointmentItem(Item).OnClose := ;
TAppointmentItem(Item).OnPropertyChange := ;
TAppointmentItem(Item).OnRead := ;
TAppointmentItem(Item).OnReply := ;
TAppointmentItem(Item).OnReplyAll := ;
TAppointmentItem(Item).OnSend := ;
TAppointmentItem(Item).OnWrite := ;
TAppointmentItem(Item).OnBeforeCheckNames := ;
TAppointmentItem(Item).OnAttachmentAdd := ;
TAppointmentItem(Item).OnAttachmentRead := ;
TAppointmentItem(Item).OnBeforeAttachmentSave := ;
}
FList.Add(Item);
end
else begin
end;
finally
IAppointment := nil;
IMeeting := nil;
IDsp := nil;
end;
end;
finally
IFolder := nil;
end;
end;
|
|
Posted 28 Nov, 2005 08:55:59
|
|
Top
|
|
Charles van den akker III
Guest
|
am i missing the plot... i only see one example and no find method...
|
|
Posted 28 Nov, 2005 09:26:22
|
|
Top
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Charles,
Could you please describe in more detail what example you need?
|
|
Posted 28 Nov, 2005 10:14:55
|
|
Top
|
|
Guest
Guest
|
OK... sorry.
I need the OnPropertyChange event to filter out the arbitary changes to the items... so that when a user only makes significant changes to items i can update my database... not things like clicking a reminder...
Am i correct in saying that i initilize this when i connect my other events to the folders?
User Properties...
I would like to use this feature to create user defined fields so that i do not conflict with existing users fields..
eg: IAppointment.UserProperties.Add('MyField',olText,True,oltext);
will this add to all existing items... or just new items?
not sure how to do this properly..
the example i require should (if possible) do the followeing:
1) initialize onpropertychange events to required folders... show an example of how to use it when a propery changes...
2)create text userdefined fields for all items..
regards |
|
Posted 28 Nov, 2005 11:44:33
|
|
Top
|
|
charles van den akker III
Posts: 10
Joined: 2005-11-22
|
Did you forget about me... :( |
|
Posted 29 Nov, 2005 03:57:02
|
|
Top
|
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
|
Posted 29 Nov, 2005 06:52:51
|
|
Top
|
|
charles van den akker III
Posts: 10
Joined: 2005-11-22
|
Hello dude...
as always i do not know how you know all this stuff!
Just a few more points :
1) Not sure if i have done something incorrectly...
I have to Set the "OnPropertyChange" event to each new item, so i created this procedure... it works but seems a bit complex... any ideas??
2) I just use the OnPropertyChange event to filter my OnChange event as the former always fires before the later...
3) My problem (one of them :)).. is that on Tasks the onPropertyChange event fires itsself??? any ideas??
4) how do i limit procesing an item that has been changed... only once..(issue is that a user could re-open the last processed item) ???
(code below)
procedure TAddInModule.SetItemOnChangeProperties(const Item: IDispatch);
var
ItemMail : TMailItem;
ItemAppointment : TAppointmentItem;
ItemTask : TTaskItem;
begin
if Item.QueryInterface(IID__MailItem, IMail) = S_OK then
if Assigned(IMail) then
begin
try
ItemMail := TMailItem.Create(nil);
ItemMail.ConnectTo(IMail);
ItemMail.OnCustomPropertyChange := DoCustomPropertyChange;
ItemMail.OnPropertyChange := DoPropertyChange;
FList.Add(ItemMail);
finally
IMail := nil;
end;
end;
if Item.QueryInterface(IID__TaskItem, ITask) = S_OK then
if Assigned(ITask) then
begin
try
ItemTask := TTaskItem.Create(nil);
ItemTask.ConnectTo(IMail);
ItemTask.OnCustomPropertyChange := DoCustomPropertyChange;
ItemTask.OnPropertyChange := DoPropertyChange;
FList.Add(ItemTask);
finally
ITask := nil;
end;
end;
////..... etc
end; |
|
Posted 30 Nov, 2005 11:08:59
|
|
Top
|
|
Posts 1 - 10 of 13
First | Prev. | 1 2 | Next | Last
|