M
Michael
I am writing an Outlook COM Add-in in C# (Visual Studio .NET 2003). I am
having trouble with methods in the Outlook Object Model that have Object
parameters. These seem to be Variant parameters (whatever they are) in
Visual Basic, and I do not have VB experience. I can't seem to use any of
the methods with Object parameters successfully, since I am apparently not
passing in the proper data.
The latest one is GetItemFromID, which has the following signature (from the
Object Browser in Visual Studio):
public abstract new System.Object GetItemFromID ( System.String EntryIDItem
, System.Object EntryIDStore )
I try to pass in two strings containing the EntryID of the item and store
(the folder's StoreID), and I get the following error:
System.Runtime.InteropServices.COMException (0x92840107): Could not open the
item. Try again.
Passing in System.Reflection.Missing.Value for the StoreID (since it is
listed as an Optional parameter in VBAOL11.CHM) made no difference. The two
strings looked correct in the debugger... the ItemID is a long hex-looking
string, and the StoreID is a much longer one.
I've had similar trouble with the Temporary parameter in the Add method of
the CommandBars object (in Microsoft.Office.Core). I've passed in the C#
keyword "true" as a parameter which seems to work on my system, but not on
other systems where I installed my program:
public abstract new Microsoft.Office.Core.CommandBar Add ( System.Object
Name , System.Object Position , System.Object MenuBar , System.Object
Temporary )
I am referencing the Outlook XP PIAs directly (by browsing to the DLLs), if
that makes a difference. Am I supposed to be doing something different with
these Variant parameters from C#?
Michael
having trouble with methods in the Outlook Object Model that have Object
parameters. These seem to be Variant parameters (whatever they are) in
Visual Basic, and I do not have VB experience. I can't seem to use any of
the methods with Object parameters successfully, since I am apparently not
passing in the proper data.
The latest one is GetItemFromID, which has the following signature (from the
Object Browser in Visual Studio):
public abstract new System.Object GetItemFromID ( System.String EntryIDItem
, System.Object EntryIDStore )
I try to pass in two strings containing the EntryID of the item and store
(the folder's StoreID), and I get the following error:
System.Runtime.InteropServices.COMException (0x92840107): Could not open the
item. Try again.
Passing in System.Reflection.Missing.Value for the StoreID (since it is
listed as an Optional parameter in VBAOL11.CHM) made no difference. The two
strings looked correct in the debugger... the ItemID is a long hex-looking
string, and the StoreID is a much longer one.
I've had similar trouble with the Temporary parameter in the Add method of
the CommandBars object (in Microsoft.Office.Core). I've passed in the C#
keyword "true" as a parameter which seems to work on my system, but not on
other systems where I installed my program:
public abstract new Microsoft.Office.Core.CommandBar Add ( System.Object
Name , System.Object Position , System.Object MenuBar , System.Object
Temporary )
I am referencing the Outlook XP PIAs directly (by browsing to the DLLs), if
that makes a difference. Am I supposed to be doing something different with
these Variant parameters from C#?
Michael