A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

The operation failed.



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 28th 09, 11:28 AM posted to microsoft.public.outlook.program_addins
j
external usenet poster
 
Posts: 109
Default The operation failed.

Hi all.

I develop vsto addIn 2005, OL 2003, C# 2.0

One of my customer sometime got comException --
System.Runtime.InteropServices.COMException (0xB174010F): The
operation failed.
at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Na me()

In the code we try to get Folder's name.

Why this happen??
How can i recover from this error?? (otlook restart helps, but this is
not solution.)

Thanks in advance.
  #2  
Old July 28th 09, 02:13 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default The operation failed.

The obvious question is if that MAPIFolder object is valid when you ask for
the folder name? Do you check that? If it is a valid folder I can't think of
a reason why the name isn't available.

In general with COM addins you should be handling all possible errors. With
managed code you have to do even more exception handling than you would with
unmanaged code, things are less forgiving with managed code. You need to put
try...catch blocks around any code that could fire an exception, and you
need to test for things such as properties like EntryID. In unmanaged code
an item that was never saved will have a null string EntryID, in managed
code the property may not be there. So you'd need to test for
String.IsNullOrEmpty().

You should also not use compound dot operators, which create invisible
variables you can't release, and which make it impossible to see exactly
where any code is failing.

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


"j" wrote in message
...
Hi all.

I develop vsto addIn 2005, OL 2003, C# 2.0

One of my customer sometime got comException --
System.Runtime.InteropServices.COMException (0xB174010F): The
operation failed.
at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Na me()

In the code we try to get Folder's name.

Why this happen??
How can i recover from this error?? (otlook restart helps, but this is
not solution.)

Thanks in advance.


  #3  
Old July 28th 09, 03:19 PM posted to microsoft.public.outlook.program_addins
j
external usenet poster
 
Posts: 109
Default The operation failed.

On Jul 28, 4:13*pm, "Ken Slovak - [MVP - Outlook]"
wrote:
The obvious question is if that MAPIFolder object is valid when you ask for
the folder name? Do you check that? If it is a valid folder I can't think of
a reason why the name isn't available.

In general with COM addins you should be handling all possible errors. With
managed code you have to do even more exception handling than you would with
unmanaged code, things are less forgiving with managed code. You need to put
try...catch blocks around any code that could fire an exception, and you
need to test for things such as properties like EntryID. In unmanaged code
an item that was never saved will have a null string EntryID, in managed
code the property may not be there. So you'd need to test for
String.IsNullOrEmpty().

You should also not use compound dot operators, which create invisible
variables you can't release, and which make it impossible to see exactly
where any code is failing.

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

"j" wrote in message

...



Hi all.


I develop vsto addIn 2005, OL 2003, C# 2.0


One of my customer sometime got comException --
System.Runtime.InteropServices.COMException (0xB174010F): The
operation failed.
* at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Na me()


In the code we try to get Folder's name.


Why this happen??
How can i recover from this error?? (otlook restart helps, but this is
not solution.)


Thanks in advance.- Hide quoted text -


- Show quoted text -



Thanks for replay,

can please explain what you meant by saying :

The obvious question is if that MAPIFolder object is valid when you ask for
the folder name? Do you check that? If it is a valid folder I can't think of
a reason why the name isn't available.


How should i check if this object valid??? some sample will help.

Also, some time i got comException when trying to access the toolbar:
"Microsoft.Office.Interop.Outlook.ExplorerClass.ge t_CommandBars"

what can i do on the subject.

Thanks.
  #4  
Old July 28th 09, 03:32 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default The operation failed.

Before using something like this:

Debug.WriteLine(folder.Name);

You should use code something like this:

if (folder != null)
{
Debug.WriteLine(folder.Name);
}

The same thing applies to any other object such as a CommandBar.

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


"j" wrote in message
...
snip
Thanks for replay,

can please explain what you meant by saying :

The obvious question is if that MAPIFolder object is valid when you ask for
the folder name? Do you check that? If it is a valid folder I can't think
of
a reason why the name isn't available.


How should i check if this object valid??? some sample will help.

Also, some time i got comException when trying to access the toolbar:
"Microsoft.Office.Interop.Outlook.ExplorerClass.ge t_CommandBars"

what can i do on the subject.

Thanks.

  #5  
Old July 28th 09, 03:57 PM posted to microsoft.public.outlook.program_addins
j
external usenet poster
 
Posts: 109
Default The operation failed.

On Jul 28, 5:32*pm, "Ken Slovak - [MVP - Outlook]"
wrote:
Before using something like this:

Debug.WriteLine(folder.Name);

You should use code something like this:

* * if (folder != null)
* * {
* * * * Debug.WriteLine(folder.Name);
* * }

The same thing applies to any other object such as a CommandBar.

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

"j" wrote in message

...
snip
Thanks for replay,

can please explain what you meant by saying :

The obvious question is if that MAPIFolder object is valid when you ask for
the folder name? Do you check that? If it is a valid folder I can't think
of
a reason why the name isn't available.


How should i check if *this object valid??? some sample will help.

Also, some time i got comException when trying to access the toolbar:
"Microsoft.Office.Interop.Outlook.ExplorerClass.ge t_CommandBars"

what can i do on the subject.

Thanks.


Thank you,

I got it, now my question is what should i do if i get null in
COMMANDBARS??
by the way i'm moreo then sure, that these objects not NULL, and still
they ends up with ComExcpetion.

What do you say??
  #6  
Old July 28th 09, 06:27 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default The operation failed.

If a MAPIFolder is not null then you can get its properties. Set a
breakpoint at that line of code and use the Locals window to see what
properties are exposed on that COM object. Same thing for CommandBars.

Any Explorer will have a valid CommandBars collection. If you get a valid
Explorer I can't see why you wouldn't be able to get the CommandBars
collection for it. Again, use the Locals window to see what's up.

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


"j" wrote in message
...
snip
Thank you,

I got it, now my question is what should i do if i get null in
COMMANDBARS??
by the way i'm moreo then sure, that these objects not NULL, and still
they ends up with ComExcpetion.

What do you say??

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The operation failed. gorahilly Outlook - Calandaring 0 December 11th 08 07:26 PM
The Operation Failed Big Iv Outlook - Calandaring 0 June 10th 08 07:08 PM
The Operation Failed... Billingsley Outlook - General Queries 0 September 24th 07 08:03 PM
Operation Failed alamb200 Outlook - General Queries 2 March 26th 07 09:47 AM
Operation Failed techjunkee Outlook - Installation 2 March 21st 06 10:40 PM


All times are GMT +1. The time now is 12:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.