BeforeItemMove fails with Exchange Shared Mailbox Calendar

  • Thread starter U2ltb24gRnJhbmNlc2Nv
  • Start date
Status
Not open for further replies.
U

U2ltb24gRnJhbmNlc2Nv

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");
 
K

Ken Slovak - [MVP - Outlook]

The shared folders must be opened with the entire mailbox as part of the

Outlook profile. Then that would work.

"Simon Francesco" <SimonFrancesco@community.nospam> wrote in message

news:9C0BC854-C54C-4E58-82B3-ED00FB1AFE24@microsoft.com...
> 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");
>
 
U

U2ltb24gRnJhbmNlc2Nv

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
 
K

Ken Slovak - [MVP - Outlook]

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.

"Simon Francesco" <SimonFrancesco@community.nospam> wrote in message

news:CE4AC624-1CE9-4C72-AA40-639B77C3DA06@microsoft.com...
> 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

>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
K VBA BeforeItemMove event create rule to always move to its folder. Outlook VBA and Custom Forms 4
B Folder.BeforeItemMove Event Outlook VBA and Custom Forms 1
D Outlook 2003 Mail Fails Using Outlook 1
D Outlook 2010 account setup fails in particular domain Using Outlook 3
ChrisK2 Send email to advertise@slipstick.com fails: "The group advertising isn't set up to receive messages from..." Using Outlook 3
M Outlook 2013 fails to start -- missing WindowsCodecs.dll error Using Outlook 3
D Outlook.com in Outlook 2016 Trys & Fails to Send on Behalf of Itself Using Outlook.com accounts in Outlook 2
J VB6 Add-in fails to load in Outlook 16 - message useless Outlook VBA and Custom Forms 4
J Will BCC messages still deliver if TO address fails Outlook 2013 Using Outlook 3
A OL16 C2R attachment preview fails Using Outlook 8
I Copy email from folder to folder - FAILS Using Outlook 5
Z Outlook 2007, clicking email addresses fails to open Contact Using Outlook 0
G "Delay Delivery" Email fails to send if opened while in Outbox Using Outlook 4
T Outlook 2013 either fails to mark messages as read or marks them as read, then un-marks them. Using Outlook 1
jChambler setup of iCloud with Outlook 2007 fails Using Outlook 4
P Outlook 2010 fails to start after icloud update Using Outlook 3
Jennifer Murphy Distribution list fails after conversion to Unicode PST Using Outlook 2
E run script fails suddenly Using Outlook 3
D Outlook 2010 Fails to Send Messages To One Domain Using Outlook 6
F Email notification if notification email fails Using Outlook 1
F Google Desktop fails to index Outlook 2010 Using Outlook 3
T BCM Install fails Both w Off. Pro 2010 Beta & on reinstall Off.Pro BCM (Business Contact Manager) 5
T BCM 2007: Accounts creation or opening fails BCM (Business Contact Manager) 1
O Scheduled Task Fails running Code to send Outlook Mail from Excel. Outlook VBA and Custom Forms 9
J outlook fails to start then problem with business contact manager BCM (Business Contact Manager) 1
J RecurrencePattern.GetOccurrence() fails on patterns from recurringTasks Outlook VBA and Custom Forms 2
R outlook 2007 itemadd event handler fails to run Outlook VBA and Custom Forms 2
S BCM install fails at SQL install BCM (Business Contact Manager) 1
B Marketing Campaign BCM 2007 – Word 2007 Merge Fails BCM (Business Contact Manager) 1
T MOA/BCM Integration fails BCM (Business Contact Manager) 2
W BCM and Outlook problem ( BCM fails to start) BCM (Business Contact Manager) 1
B Outlook fails - error says execute scanpst.exe but can't find it Using Outlook 8
T _MailItem::Move fails Outlook VBA and Custom Forms 2
T folder->get_Store fails Outlook VBA and Custom Forms 7
A Eseutil File Dump fails in the path to the file is too long... Exchange Server Administration 2
A After update to SP2 (office 2007) Launching a campaign fails BCM (Business Contact Manager) 3
P Redemption Send EMail fails Outlook VBA and Custom Forms 4
H fails to install from cd BCM (Business Contact Manager) 1
HarvMan Outlook 365 loses "outlook.com" exchange server settings Using Outlook 1
Z New minimum Outlook for Windows version requirements for Microsoft 365/Exchange Online Using Outlook.com accounts in Outlook 4
L Help connecting to hosted exchange server 2016 Using Outlook 0
O Exchange Sync period only (e.g. last years mail) Using Outlook 0
J Connect outlook to office365 exchange _without_ signing in office apps Using Outlook 4
J Importing N2K from a different Exchange Server Using Outlook 1
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
D Do I need Exchange Add-In? Using Outlook 6
O Newbie question: how to sync two Outlook -Exchange and IMAP- calendars? Using Outlook 4
I Exchange 2019 - MICROSOFT-CORP-MSN-AS-BLOCK Exchange Server Administration 0
T Outlook 2010 How to Delete “Orphaned” TO DO? ( Not on Exchange Server) Using Outlook 6
M Outlook 2010 Outlook 2010 with O365 / Exchange Online Using Outlook 0

Similar threads

Top