![]() |
|
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. |
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. |
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. |
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. |
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?? |
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?? |
The operation failed.
this is my code: OL.MAPIFolder mapiFolder = GetDedicatedFolderForUserID(userID); if (mapiFolder != null) { folderName = mapiFolder.Name; } and i get exception: System.Runtime.InteropServices.COMException (0x8624010F): The operation failed. at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Na me() at ActionBase.Office.OutlookAddIn.Managers.OutlookFol derManager.GetDedicatedFolderNameForUserID (Int64 userID) So, the object is valid. It's not null, so i suppose that it valid. And why this strange exception occured?, it's happen from time to time, very seldom, but may occur. Any ideas?? |
The operation failed.
You're going to have to do detective work on that. Does this happen on a
repeatable basis with certain folders? How are those folders opened, are they part of a PST file or Exchange mailbox or Exchange public folders or delegate mailboxes? Are they from custom stores? If this is totally random and not repeatable at all, even on the same folder, then that's one of the hardest things to figure out. If you can discern some pattern that will lead to a solution. -- 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 ... this is my code: OL.MAPIFolder mapiFolder = GetDedicatedFolderForUserID(userID); if (mapiFolder != null) { folderName = mapiFolder.Name; } and i get exception: System.Runtime.InteropServices.COMException (0x8624010F): The operation failed. at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Na me() at ActionBase.Office.OutlookAddIn.Managers.OutlookFol derManager.GetDedicatedFolderNameForUserID (Int64 userID) So, the object is valid. It's not null, so i suppose that it valid. And why this strange exception occured?, it's happen from time to time, very seldom, but may occur. Any ideas?? |
The operation failed.
On Jul 29, 5:27*pm, "Ken Slovak - [MVP - Outlook]"
wrote: You're going to have to do detective work on that. Does this happen on a repeatable basis with certain folders? How are those folders opened, are they part of a PST file or Exchange mailbox or Exchange public folders or delegate mailboxes? Are they from custom stores? If this is totally random and not repeatable at all, even on the same folder, then that's one of the hardest things to figure out. If you can discern some pattern that will lead to a solution. -- 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 ... this is my code: OL.MAPIFolder mapiFolder = GetDedicatedFolderForUserID(userID); * * * * * *if (mapiFolder != null) * * * * * *{ * * * * * * * *folderName = mapiFolder.Name; * * * * * *} and i get exception: System.Runtime.InteropServices.COMException (0x8624010F): The operation failed. * at Microsoft.Office.Interop.Outlook.MAPIFolder.get_Na me() * at ActionBase.Office.OutlookAddIn.Managers.OutlookFol derManager.GetDedicatedFo*lderNameForUserID (Int64 userID) So, the object is valid. It's not null, so i suppose that it valid. And why this strange exception occured?, it's happen from time to time, very seldom, but may occur. Any ideas??- Hide quoted text - - Show quoted text - Hey, It's not happen on a repeatable basis, and these folders are part of Exchange mailbox. the same thing with CommandNBars. I need some solution or workaround to recover from that strange issue. What do u say?? |
The operation failed.
What I say is you are going to have to do the detective work on this.
Any random problem is very hard to debug and we can't do that for you, we can't see what's going on or know all of your code. -- 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 Hey, It's not happen on a repeatable basis, and these folders are part of Exchange mailbox. the same thing with CommandNBars. I need some solution or workaround to recover from that strange issue. What do u say?? |
All times are GMT +1. The time now is 12:26 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-2006 OutlookBanter.com