PC Review


Reply
Thread Tools Rate Thread

BeforeItemMove fails with Exchange Shared Mailbox Calendar

 
 
Simon Francesco
Guest
Posts: n/a
 
      15th Mar 2009
I have successfully connected to and listened to the BeforeItemMove event on
a local (pst) calendar, but I cannot seem to get this event to fire for
shared calendars that I have open.
I am using Outlook 2007 connected to Exchange 2003.

All the code between the scenarios is the same except the code to resolve
and get the folder. Smippets below.
I have investiaged the more generic loss of scope of COM objects etc and
retain references to the folders to maintain their lifespan and as I said it
works in the local calendar but not shared calendars.
Could anyone shed some light on this for me?

TIA Simon

/// <summary>
/// Finds and resolves the requested folder, if found it attaches
/// to the BeforeItemMove event to listen for deletes etc
/// and adds the folder to the Application Level MonitoredFolders List
/// </summary>
/// <param name="folderToMonitor">Either the local name of the
Calendar or the
/// Recipients name in the case of an Exchange Mailbox</param>
private void StartMonitoringCalendarFolder(String folderToMonitor)
{
var folder = GetFolder(folderToMonitor);
if (folder != null)
{
//StartListening for Deletes
folder.BeforeItemMove += folder_BeforeItemMove;
//Record that we are listening, and maintain ref to COM
objects
monitoredFolders.Add(folderToMonitor, new
FolderWrapper(folder));
}
}

/// <summary>
/// Finds and returns the requested folder, allows for
/// whether Outlook is using Exchange or not.
/// Returns null if not found.
/// </summary>
/// <param name="folderToMonitor">Either the local name of the
Calendar or the
/// Recipients name in the case of an Exchange Mailbox</param>
/// <returns></returns>
private Outlook.Folder GetFolder(String folderName)
{
Outlook.Folder folder = null;
switch (this.Application.Session.ExchangeConnectionMode)
{
case
Microsoft.Office.Interop.Outlook.OlExchangeConnectionMode.olNoExchange:
var currentFolder =
(Outlook.Folder)this.Application.Session.DefaultStore.GetRootFolder();
//Walk the folder tree and look for folder name
folder = FindFolder(folderName, currentFolder);
break;

default: //all other Exchange modes, TODO: we may run into
sync issues if Outlook is offline
Outlook.Recipient recourceMailBox =
this.Application.Session.CreateRecipient(folderName);
recourceMailBox.Resolve();
if (!recourceMailBox.Resolved)
{

System.Diagnostics.Trace.WriteLine(String.Format("Folder Monitoring: Unable
to resolve folder: {0}", folderName));
return null;
}
folder =
(Outlook.Folder)this.Application.Session.GetSharedDefaultFolder(recourceMailBox, Outlook.OlDefaultFolders.olFolderCalendar);
break;
}
if (folder == null)
{
System.Diagnostics.Trace.WriteLine(String.Format("Folder
Monitoring: Unable to find folder: {0}", folderName));
}

return folder;

}

//Example call: StartMonitoringCalendarFolder("Bob Smith");

 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      16th Mar 2009
The shared folders must be opened with the entire mailbox as part of the
Outlook profile. Then that would work.

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


"Simon Francesco" <(E-Mail Removed)> wrote in message
news:9C0BC854-C54C-4E58-82B3-(E-Mail Removed)...
>I have successfully connected to and listened to the BeforeItemMove event
>on
> a local (pst) calendar, but I cannot seem to get this event to fire for
> shared calendars that I have open.
> I am using Outlook 2007 connected to Exchange 2003.
>
> All the code between the scenarios is the same except the code to resolve
> and get the folder. Smippets below.
> I have investiaged the more generic loss of scope of COM objects etc and
> retain references to the folders to maintain their lifespan and as I said
> it
> works in the local calendar but not shared calendars.
> Could anyone shed some light on this for me?
>
> TIA Simon
>
> /// <summary>
> /// Finds and resolves the requested folder, if found it attaches
> /// to the BeforeItemMove event to listen for deletes etc
> /// and adds the folder to the Application Level MonitoredFolders
> List
> /// </summary>
> /// <param name="folderToMonitor">Either the local name of the
> Calendar or the
> /// Recipients name in the case of an Exchange Mailbox</param>
> private void StartMonitoringCalendarFolder(String folderToMonitor)
> {
> var folder = GetFolder(folderToMonitor);
> if (folder != null)
> {
> //StartListening for Deletes
> folder.BeforeItemMove += folder_BeforeItemMove;
> //Record that we are listening, and maintain ref to COM
> objects
> monitoredFolders.Add(folderToMonitor, new
> FolderWrapper(folder));
> }
> }
>
> /// <summary>
> /// Finds and returns the requested folder, allows for
> /// whether Outlook is using Exchange or not.
> /// Returns null if not found.
> /// </summary>
> /// <param name="folderToMonitor">Either the local name of the
> Calendar or the
> /// Recipients name in the case of an Exchange Mailbox</param>
> /// <returns></returns>
> private Outlook.Folder GetFolder(String folderName)
> {
> Outlook.Folder folder = null;
> switch (this.Application.Session.ExchangeConnectionMode)
> {
> case
> Microsoft.Office.Interop.Outlook.OlExchangeConnectionMode.olNoExchange:
> var currentFolder =
> (Outlook.Folder)this.Application.Session.DefaultStore.GetRootFolder();
> //Walk the folder tree and look for folder name
> folder = FindFolder(folderName, currentFolder);
> break;
>
> default: //all other Exchange modes, TODO: we may run into
> sync issues if Outlook is offline
> Outlook.Recipient recourceMailBox =
> this.Application.Session.CreateRecipient(folderName);
> recourceMailBox.Resolve();
> if (!recourceMailBox.Resolved)
> {
>
> System.Diagnostics.Trace.WriteLine(String.Format("Folder Monitoring:
> Unable
> to resolve folder: {0}", folderName));
> return null;
> }
> folder =
> (Outlook.Folder)this.Application.Session.GetSharedDefaultFolder(recourceMailBox,
> Outlook.OlDefaultFolders.olFolderCalendar);
> break;
> }
> if (folder == null)
> {
> System.Diagnostics.Trace.WriteLine(String.Format("Folder
> Monitoring: Unable to find folder: {0}", folderName));
> }
>
> return folder;
>
> }
>
> //Example call: StartMonitoringCalendarFolder("Bob Smith");
>


 
Reply With Quote
 
Simon Francesco
Guest
Posts: n/a
 
      17th Mar 2009
Hi Ken,
Thanks for your response.

I have taken your advice and had a look at this, and tried to add the other
mailboxes but it appears I can only have one open?

If I try to right click the root folder as one does, for opening multiple
data files, I only get an Open Other->Other User's Folder option and then I
have to specify if I want the calendar or inbox etc, and this has the same
net effect as opening a shared calendar. Am I missing something?


What I am trying to achieve is this.
Using Exchange 2003 and Outlook 2007, Many users in a company, a limited
number of shared calendars (implemented as Mailboxes) for scheduling events
that certain users have writeable permissions to.

User A opens their Outlook, and then opens the calendar view, chooses 'Open
A shard Calendar' and chooses the mailbox of the venues they want to review
and manage events for. These show using the nice side-by-side or overlaid
calendar views in Outlook.

REQUIREMENT:
That extra information beyond that of the appointment information is stored
in a database and kept in sync.
To this end we collect and stored extra info using a Form Region. This all
works nicely.
PROBLEM:
We can monitor for changes and creations using the Form Region, but we
cannot at this stage successfully monitor for deletes, either with the Form
Region closed or open.

The idea is that the additional calendars seamlessly form part of what the
user can see in their own profile.

Any thoughts.
Cheers Simon



 
Reply With Quote
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      17th Mar 2009
To add an additional mailbox you open the profile settings (I use the Mail
applet in the Control Panel when Outlook isn't running). You edit the
settings and select the More Settings button in the profile properties, then
on the Advanced tab you add the additional mailbox or mailboxes. I add
support, sales and webmaster mailboxes that way to my normal profile so I
get those as well as my own mailbox.

This can be done manually or by using a profile tool.

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


"Simon Francesco" <(E-Mail Removed)> wrote in message
news:CE4AC624-1CE9-4C72-AA40-(E-Mail Removed)...
> Hi Ken,
> Thanks for your response.
>
> I have taken your advice and had a look at this, and tried to add the
> other
> mailboxes but it appears I can only have one open?
>
> If I try to right click the root folder as one does, for opening multiple
> data files, I only get an Open Other->Other User's Folder option and then
> I
> have to specify if I want the calendar or inbox etc, and this has the same
> net effect as opening a shared calendar. Am I missing something?
>
>
> What I am trying to achieve is this.
> Using Exchange 2003 and Outlook 2007, Many users in a company, a limited
> number of shared calendars (implemented as Mailboxes) for scheduling
> events
> that certain users have writeable permissions to.
>
> User A opens their Outlook, and then opens the calendar view, chooses
> 'Open
> A shard Calendar' and chooses the mailbox of the venues they want to
> review
> and manage events for. These show using the nice side-by-side or overlaid
> calendar views in Outlook.
>
> REQUIREMENT:
> That extra information beyond that of the appointment information is
> stored
> in a database and kept in sync.
> To this end we collect and stored extra info using a Form Region. This all
> works nicely.
> PROBLEM:
> We can monitor for changes and creations using the Form Region, but we
> cannot at this stage successfully monitor for deletes, either with the
> Form
> Region closed or open.
>
> The idea is that the additional calendars seamlessly form part of what the
> user can see in their own profile.
>
> Any thoughts.
> Cheers Simon
>
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting reminders in shared outlook mailbox (exchange) Rachael Microsoft Outlook Discussion 3 3rd Feb 2012 03:58 AM
Shared Mailbox on Exchange Server =?Utf-8?B?Q2xhcmVC?= Microsoft Outlook Discussion 1 10th Nov 2005 03:58 PM
How to merge exchange mailbox calendar and personal calendar? =?Utf-8?B?U2hhbmUgQi4=?= Microsoft Outlook Calendar 3 28th Jul 2005 03:12 PM
Create a link to a shared Exchange Mailbox Calendar in Outlook Tod =?Utf-8?B?cGxveW1vbg==?= Microsoft Outlook Calendar 2 29th Mar 2005 10:57 PM
Relationships between PST Calendar, Exchange Mailbox Calendar andSychronization Ernest Maw Microsoft Outlook Discussion 6 19th Nov 2004 09:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 AM.