A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook 2003 Appointments -- drag and drop event using C#



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 28th 08, 10:24 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.developer.outlook.addins,microsoft.public.outlook.program_addins
Curtis Justus
external usenet poster
 
Posts: 6
Default Outlook 2003 Appointments -- drag and drop event using C#

Hi everybody,

I have created an add-in where I need to capture a drag and drop event of an
appointment in a user's calendar. I used the ItemLoad event in the 2007
libraries, but that doesn't exist in 2003.

I have attached to the Items.ItemChange event of the calendar folder
(olFolderCalendar), but that never fires. For that matter, neither does the
ItemAdd or ItemRemove events.

I have my inspectors hooked up, but they never fire because an inspector is
not created on a drag-drop of an appointment.

Would anybody have any ideas of something I can try?

Thanks for your help,
cj

Ads
  #2  
Old July 29th 08, 01:47 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.developer.outlook.addins,microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook 2003 Appointments -- drag and drop event using C#

If you add a new item to the calendar folder, not with drag and drop but
Actions, New Appointment does ItemAdd() fire at all? If not then it's
something in how you're creating or scoping your event handler.

Is the folder object and items collection declared at a class or other scope
level that will keep them alive once your procedure where you add the event
handler ends?

Show the code you use to create the event handlers.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Curtis Justus" wrote in message
...
Hi everybody,

I have created an add-in where I need to capture a drag and drop event of
an appointment in a user's calendar. I used the ItemLoad event in the
2007 libraries, but that doesn't exist in 2003.

I have attached to the Items.ItemChange event of the calendar folder
(olFolderCalendar), but that never fires. For that matter, neither does
the ItemAdd or ItemRemove events.

I have my inspectors hooked up, but they never fire because an inspector
is not created on a drag-drop of an appointment.

Would anybody have any ideas of something I can try?

Thanks for your help,
cj


  #3  
Old July 29th 08, 02:04 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.developer.outlook.addins,microsoft.public.outlook.program_addins
Curtis Justus
external usenet poster
 
Posts: 6
Default Outlook 2003 Appointments -- drag and drop event using C#

Hello Ken,

If I hook up the ItemAdd event, it does not fire if I add anything -- even
without the drag and drop.

Here is the code I am using...

public partial class ThisAddIn
{
private Outlook.Application outApp;
private Outlook.NameSpace _nameSpace;
private Outlook.MAPIFolder _calendarFolder;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
outApp = this.Application;

_nameSpace = outApp.GetNamespace("MAPI");

_calendarFolder =
_nameSpace.GetDefaultFolder(OlDefaultFolders.olFol derCalendar);

_calendarFolder.Items.ItemAdd += new
ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
}

void Items_ItemAdd(object Item)
{
MessageBox.Show("Item Added");
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
_calendarFolder.Items.ItemAdd -= new
ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
outApp = null;

}
}

Thanks for your help...
cj

"Ken Slovak - [MVP - Outlook]" wrote in message
...
If you add a new item to the calendar folder, not with drag and drop but
Actions, New Appointment does ItemAdd() fire at all? If not then it's
something in how you're creating or scoping your event handler.

Is the folder object and items collection declared at a class or other
scope level that will keep them alive once your procedure where you add
the event handler ends?

Show the code you use to create the event handlers.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Curtis Justus" wrote in message
...
Hi everybody,

I have created an add-in where I need to capture a drag and drop event of
an appointment in a user's calendar. I used the ItemLoad event in the
2007 libraries, but that doesn't exist in 2003.

I have attached to the Items.ItemChange event of the calendar folder
(olFolderCalendar), but that never fires. For that matter, neither does
the ItemAdd or ItemRemove events.

I have my inspectors hooked up, but they never fire because an inspector
is not created on a drag-drop of an appointment.

Would anybody have any ideas of something I can try?

Thanks for your help,
cj



  #4  
Old July 29th 08, 02:15 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.developer.outlook.addins,microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook 2003 Appointments -- drag and drop event using C#

Your Items collection is going out of scope as soon as that procedure ends.
Then it gets garbage collected and your event handlers then fail to fire.

Your class level declarations section should include a declaration for an
Items collection:

private Outlook.Items _items;

Assign that to your calendar folder's items collection and add the event
handler to that Items collection and the events should start to fire.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Curtis Justus" wrote in message
...
Hello Ken,

If I hook up the ItemAdd event, it does not fire if I add anything -- even
without the drag and drop.

Here is the code I am using...

public partial class ThisAddIn
{
private Outlook.Application outApp;
private Outlook.NameSpace _nameSpace;
private Outlook.MAPIFolder _calendarFolder;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
outApp = this.Application;

_nameSpace = outApp.GetNamespace("MAPI");

_calendarFolder =
_nameSpace.GetDefaultFolder(OlDefaultFolders.olFol derCalendar);

_calendarFolder.Items.ItemAdd += new
ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
}

void Items_ItemAdd(object Item)
{
MessageBox.Show("Item Added");
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
_calendarFolder.Items.ItemAdd -= new
ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
outApp = null;

}
}

Thanks for your help...
cj


  #5  
Old July 29th 08, 02:20 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.developer.outlook.addins,microsoft.public.outlook.program_addins
Curtis Justus
external usenet poster
 
Posts: 6
Default Outlook 2003 Appointments -- drag and drop event using C#

VOILA!

Ken... you got me thinking about the scope. Since I wasn't referring to the
Items collection directly in my definition, I thought maybe something was
getting disconnected in the Interop with the com layer. I set up a class
level variable:

private Items _calendarItems;

Then, I put the following code in the startup:

_calendarItems.ItemChange += new
ItemsEvents_ItemChangeEventHandler(_calendarItems_ ItemChange);

Lo and behold, the change event fires -- even on the drag and drop.

Thanks for pointing me in the right direction...
cj

"Curtis Justus" wrote in message
...
Hello Ken,

If I hook up the ItemAdd event, it does not fire if I add anything -- even
without the drag and drop.

Here is the code I am using...

public partial class ThisAddIn
{
private Outlook.Application outApp;
private Outlook.NameSpace _nameSpace;
private Outlook.MAPIFolder _calendarFolder;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
outApp = this.Application;

_nameSpace = outApp.GetNamespace("MAPI");

_calendarFolder =
_nameSpace.GetDefaultFolder(OlDefaultFolders.olFol derCalendar);

_calendarFolder.Items.ItemAdd += new
ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
}

void Items_ItemAdd(object Item)
{
MessageBox.Show("Item Added");
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
_calendarFolder.Items.ItemAdd -= new
ItemsEvents_ItemAddEventHandler(Items_ItemAdd);
outApp = null;

}
}

Thanks for your help...
cj

"Ken Slovak - [MVP - Outlook]" wrote in message
...
If you add a new item to the calendar folder, not with drag and drop but
Actions, New Appointment does ItemAdd() fire at all? If not then it's
something in how you're creating or scoping your event handler.

Is the folder object and items collection declared at a class or other
scope level that will keep them alive once your procedure where you add
the event handler ends?

Show the code you use to create the event handlers.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Curtis Justus" wrote in message
...
Hi everybody,

I have created an add-in where I need to capture a drag and drop event
of an appointment in a user's calendar. I used the ItemLoad event in
the 2007 libraries, but that doesn't exist in 2003.

I have attached to the Items.ItemChange event of the calendar folder
(olFolderCalendar), but that never fires. For that matter, neither does
the ItemAdd or ItemRemove events.

I have my inspectors hooked up, but they never fire because an inspector
is not created on a drag-drop of an appointment.

Would anybody have any ideas of something I can try?

Thanks for your help,
cj




  #6  
Old July 29th 08, 02:30 PM posted to microsoft.public.office.developer.outlook.vba,microsoft.public.developer.outlook.addins,microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook 2003 Appointments -- drag and drop event using C#

You always have to be more aware of scoping and possible garbage collection
in managed code than in unmanaged code. You'd be surprised at how many
problems are solved just by thinking about and following scoping rules.

Good, I'm glad things are working now.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Curtis Justus" wrote in message
...
VOILA!

Ken... you got me thinking about the scope. Since I wasn't referring to
the Items collection directly in my definition, I thought maybe something
was getting disconnected in the Interop with the com layer. I set up a
class level variable:

private Items _calendarItems;

Then, I put the following code in the startup:

_calendarItems.ItemChange += new
ItemsEvents_ItemChangeEventHandler(_calendarItems_ ItemChange);

Lo and behold, the change event fires -- even on the drag and drop.

Thanks for pointing me in the right direction...
cj


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Email Drag and Drop Event in outlook Elanchezhian.R Outlook and VBA 5 July 24th 09 11:25 AM
Outlook Folder Drag and Drop Event jsturma Outlook and VBA 5 September 25th 06 09:33 PM
How to move appointments using drag&drop in Oulook 2007 beta Tom Steenbakkers Outlook - Calandaring 0 August 14th 06 12:01 PM
Drag and drop emails in Outlook 2003 Tiffany Outlook - General Queries 1 March 10th 06 10:27 PM
Can't Drag & Drop between outlook 2003 & sharepoint calendar Rainman Outlook - Calandaring 0 February 1st 06 03:00 PM


All times are GMT +1. The time now is 12:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.