views:

239

answers:

2

In Outlook 2007 When a user has two calendars say Test and actual calendar and he goes to View All appointment in test calendar, copy say around 20 to 30 appointments and paste them in actual calendar's "All Appointment items view, how to get a message box saying so many items copied.

And to add further to my comment above if the copy/paste is again repeated for another 50 appointment items then message box should show 50 (this count should come correctly without the need to close outlook or terminate the session

A: 

Hi,

If I understand you correctly, you want to track the number of items that have been copied from one calendar to another and display the count of items copied in a dialog box.

I think the way to do this would be to write a wrapper class around the explorer object that wires up the Explorer.BeforeItemCopy and Move etc if you want that as well.

When that event fires you will have to look up the current items selection to get your count.

There may be a better way .. ?

76mel

76mel
A: 

This is how you do it.

Outlook.Application olApp = new Outlook.Application();
Outlook.Folder cal = olApp.Session.GetDefaultFolder(Outlook.oldefaultfolders.olCalender)();
System.Windows.Forms.MessageBox.Show("Number of items in calendar : {0}", cal.Items.Count.ToString());
Anonymous Type
@Anonymous Type Would that not just show what the number of items in the folder ? not the number copied to it.
76mel
yeah if you just want the copied items then you will need to use some events to get the Selection.Count property value, store it and pop this into a message box.use BeforeItemCopy - http://msdn.microsoft.com/en-us/library/bb147628.aspxto get Selection.count valuestore this valuethen use BeforeItemPaste - http://msdn.microsoft.com/en-us/library/bb147630.aspxto present a mbox with the value.not tested yet, let me know if you need more help.
Anonymous Type