msoutlook.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reading Outlook Appointment.subject fails

 
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Programs Add-Ins
Author Message
Mk23



Joined: 04 Dec 2007
Posts: 5

PostPosted: Tue Dec 04, 2007 1:08 pm    Post subject: Reading Outlook Appointment.subject fails Reply with quote

Hi

In a synchronisation application for Outlook 2003 i have the problem, that
the reading of the Outlook.Appointment.subject property fails. The
application stands still by reading, without Exception or any other
information.

Code:
//Loop all appointments
for (object itemObject = restrictedItems.GetFirst(); itemObject != null;
itemObject = restrictedItems.GetNext())
{
File.AppendAllText(path, Environment.NewLine + "Loop item: " + ++i);
if (itemObject is Outlook.AppointmentItem)
{
File.AppendAllText(path, Environment.NewLine + "Item is appointment
item: " + i);
Outlook.AppointmentItem appointment = itemObject as
Outlook.AppointmentItem;
try
{
File.AppendAllText(path, Environment.NewLine + "Item after cast: " + i);
if (appointment != null)
{
File.AppendAllText(path, Environment.NewLine + "Start reading
Properties: " + i);
string subject = appointment.Subject;
File.AppendAllText(path, Environment.NewLine + "Item Subject read:
" + i + " = " + subject);
Outlook.OlResponseStatus responseStatus =
appointment.ResponseStatus;
File.AppendAllText(path, Environment.NewLine + "Item
Responsestatus read: " + i + "=" + responseStatus);
DateTime start = appointment.Start;
File.AppendAllText(path, Environment.NewLine + "Item Start read: "
+ i + "=" + start);
DateTime end = appointment.End;
File.AppendAllText(path, Environment.NewLine + "Item End read: " +
i + "=" + end);
}
else
{
File.AppendAllText(path, Environment.NewLine + "Item is null: " +
i);
}
}
catch (Exception e)
{
File.AppendAllText(path, Environment.NewLine + "Stacktrace: " + i++ +
" " + e.StackTrace);
}
}
}

The last Output is:
Loop item: 8
Item is appointment item: 8
Item after cast: 8
Start reading Properties: 8

The stop is not allways on the same item, and sometimes it runs without any
fault.

Has someone an idea?

Thanks

Archived from group: microsoft>public>outlook>program_addins
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Tue Dec 04, 2007 10:17 pm    Post subject: Re: Reading Outlook Appointment.subject fails Reply with quote

When you say it stops does it hang, or just terminate normally with no
exceptions?

Is this against a PST file or an Exchange mailbox? If a mailbox you might be
running into the normal limit of RPC connections. I'm not sure why that
would occur at different points in the data set if the code is running
against the same folder though.

See if releasing your objects explicitly with Marshal.ReleaseComObject() for
each one helps, followed by a call to GC.Collect() and maybe a wait on
pending finalizers. It slows things down a lot but it ensures actual release
of unmanaged objects that night be holding RPC channels open.

I'd also see if moving the GetFirst() call to before the loop and using a do
loop with GetNext() at the bottom, and using more try{}...catch{} blocks
gives any additional clues as to what's going on.

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


"Mk23" wrote in message @microsoft.com...
> Hi
>
> In a synchronisation application for Outlook 2003 i have the problem, that
> the reading of the Outlook.Appointment.subject property fails. The
> application stands still by reading, without Exception or any other
> information.
>
> Code:
> //Loop all appointments
> for (object itemObject = restrictedItems.GetFirst(); itemObject != null;
> itemObject = restrictedItems.GetNext())
> {
> File.AppendAllText(path, Environment.NewLine + "Loop item: " + ++i);
> if (itemObject is Outlook.AppointmentItem)
> {
> File.AppendAllText(path, Environment.NewLine + "Item is appointment
> item: " + i);
> Outlook.AppointmentItem appointment = itemObject as
> Outlook.AppointmentItem;
> try
> {
> File.AppendAllText(path, Environment.NewLine + "Item after cast: " +
> i);
> if (appointment != null)
> {
> File.AppendAllText(path, Environment.NewLine + "Start reading
> Properties: " + i);
> string subject = appointment.Subject;
> File.AppendAllText(path, Environment.NewLine + "Item Subject
> read:
> " + i + " = " + subject);
> Outlook.OlResponseStatus responseStatus =
> appointment.ResponseStatus;
> File.AppendAllText(path, Environment.NewLine + "Item
> Responsestatus read: " + i + "=" + responseStatus);
> DateTime start = appointment.Start;
> File.AppendAllText(path, Environment.NewLine + "Item Start read:
> "
> + i + "=" + start);
> DateTime end = appointment.End;
> File.AppendAllText(path, Environment.NewLine + "Item End read: "
> +
> i + "=" + end);
> }
> else
> {
> File.AppendAllText(path, Environment.NewLine + "Item is null: " +
> i);
> }
> }
> catch (Exception e)
> {
> File.AppendAllText(path, Environment.NewLine + "Stacktrace: " + i++ +
> " " + e.StackTrace);
> }
> }
> }
>
> The last Output is:
> Loop item: 8
> Item is appointment item: 8
> Item after cast: 8
> Start reading Properties: 8
>
> The stop is not allways on the same item, and sometimes it runs without
> any
> fault.
>
> Has someone an idea?
>
> Thanks
Back to top
View user's profile Send private message
Mk23



Joined: 04 Dec 2007
Posts: 5

PostPosted: Wed Dec 05, 2007 9:53 am    Post subject: Re: Reading Outlook Appointment.subject fails Reply with quote

Hi

Thanks for your answer.

The application hang.
It is against a PST file.

I tried to do the loop with a while and GetFirst() - GetNext(), like you
have suggest. I also sourround every access with try catch.
-> But with the same result and no further information.
The rest with the GC and the ReleaseComObject i will check soon.

regards

"Ken Slovak - [MVP - Outlook]" wrote:

> When you say it stops does it hang, or just terminate normally with no
> exceptions?
>
> Is this against a PST file or an Exchange mailbox? If a mailbox you might be
> running into the normal limit of RPC connections. I'm not sure why that
> would occur at different points in the data set if the code is running
> against the same folder though.
>
> See if releasing your objects explicitly with Marshal.ReleaseComObject() for
> each one helps, followed by a call to GC.Collect() and maybe a wait on
> pending finalizers. It slows things down a lot but it ensures actual release
> of unmanaged objects that night be holding RPC channels open.
>
> I'd also see if moving the GetFirst() call to before the loop and using a do
> loop with GetNext() at the bottom, and using more try{}...catch{} blocks
> gives any additional clues as to what's going on.
>
> --
> 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
Back to top
View user's profile Send private message
Ken Slovak - [MVP - Outlo



Joined: 12 Aug 2007
Posts: 405

PostPosted: Wed Dec 05, 2007 2:09 pm    Post subject: Re: Reading Outlook Appointment.subject fails Reply with quote

If it hangs where does it hang? Can you run in debug mode and stop execution
when you stop processing and see where you are and what state things are in
at that point?

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


"Mk23" wrote in message @microsoft.com...
Hi
>
> Thanks for your answer.
>
> The application hang.
> It is against a PST file.
>
> I tried to do the loop with a while and GetFirst() - GetNext(), like you
> have suggest. I also sourround every access with try catch.
> -> But with the same result and no further information.
> The rest with the GC and the ReleaseComObject i will check soon.
>
> regards
Back to top
View user's profile Send private message
Mk23



Joined: 04 Dec 2007
Posts: 5

PostPosted: Wed Feb 06, 2008 1:43 pm    Post subject: Re: Reading Outlook Appointment.subject fails Reply with quote

Hi I post here our result's. Perhaps it helps someone.

We start a call at microsoft, and tried to find the error. We generate
multiple dumps, but couldn't find any specific reason. We had hints, that the
error happens by at deadlock from an other thread. But we couldn't find out
the guilty thread.

At the end on the machine we could reproduce the error, was installed an
other virus scanner, and since then, the problem doesn't happen again.

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Live Local add-in for Outlook fails install I have Win XP SP2, Office 2003 SP2. I had the beta version of Windows Live Local add-in for Outlook, which stopped working when IE7 was out. So I uninstalled the add-in using Add/Remove programs. The Windows Live Local add-in does not appear in my Add/

macro to extract subject line and "paste" in advanced search OL 2002 SP3 Win XP HE SP1 Follow-up to: Hi, I need to create some advanced searches that will look into specific email sub-folders "A" and "C", for example. I am planning on creating the advanced search, save it locall

Error deleting second attach from RTF Msg w/ Outlook 2007 I get an error, 0x80030002 "%1 could not be found.", when I try to delete the second attachment from an rtf email message only in Outlook 2007. The first attachment gets processed with no problems. I've tried getting a new and a

Outlook crashes during shutdown after running operation I have a COM addin (VB6), that had run without error until recently. When the following code is run, the microsoft error reporting window comes up when outlook is closing after the and after the events. Private Sub ExecuteBu

How to add envid,notify and ret parameters to Outlook mail ? I'm writing an application as plugin to Outlook 2003 using VSTO. Now I have a big problem. I tried to add envid,notify and ret parameters to message header (MailItem) but I got stuck. According to SMTP envid and ret must be a
Post new topic   Reply to topic    msoutlook.org Forum Index -> Outlook Programs Add-Ins All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group