Canot not access information in ItemProperties["Body"]

L

Livrish

I have implement a normal c# template service that runs in the
background to validate the information in a third party calender with
the outlook information however if I run the following when I get to
the "Body" propery it locks up.
itemProp.Name "Body" string
itemProp.Value error: cannot obtain value System.Object

This may also be related in that I cannot access an item using
OutlookNS.GetItemFromID(storeID,EntryID)
"A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in
outservice.exe

Additional information: Could not open the item. Try again."


even though I can access (most) of the informtion as follows

ClientQueue.Initialise();
System.Diagnostics.Debugger.Break();
// Create the Outlook application.
Outlook.ApplicationClass oApp = new Outlook.ApplicationClass();

// Get the NameSpace and Logon information.
// Outlook.NameSpace oNS =
(Outlook.NameSpace)oApp.GetNamespace("mapi");
Outlook.NameSpace OutlookNS = oApp.GetNamespace("mapi");

//Log on by using a dialog box to choose the profile.
//oNS.Logon( System.Reflection.Missing.Value,
System.Reflection.Missing.Value, true, true);

//Alternate logon method that uses a specific profile.
// TODO: If you use this logon method,
// change the profile name to an appropriate value.
//oNS.Logon("YourValidProfile", Missing.Value, false, true);
Outlook.MAPIFolder aFolder
= OutlookNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
SortedList properties = new SortedList();
foreach(Outlook.AppointmentItem appointmentItem in aFolder.Items)
{
properties = new SortedList(appointmentItem.ItemProperties.Count);
foreach(Outlook.ItemProperty itemProp in
appointmentItem.ItemProperties)
{
properties.Add(itemProp.Name,itemProp.Value);
}
}
 
S

Sue Mosher [MVP-Outlook]

You didn't provide your version of OUtlook. It matters. In Outlook 2002 SP3 and later, Body is a property blocked by security prompts. This is one of the reasons (but not the only one) that Outlook is unsuitable to run from a service -- you can't avoid modal UI prompts.

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top