Re: C# Object parameters in Outlook and Office methods

From: Sunny (sunny_at_newsgroups.nospam)
Date: 09/30/04


Date: Thu, 30 Sep 2004 09:34:01 -0500

Hi,
passing a strings to GetItemFromID works for me. But there were some
other methods where it didn't work. SO I have done:

string mystring = "blabla";
object par = mystring;

and pass par to the function.

Hope that helps
Sunny

In article <#a206fmpEHA.3244@tk2msftngp13.phx.gbl>,
outlookissueman@hotmail.com says...
> 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
>
>
>



Relevant Pages

  • Re: blank response from curl when posting form data
    ... under 800 characters, everything works. ... I tried passing the post data in strings, ...
    (comp.lang.php)
  • Re: Specifying parameter passing convention and place (register)
    ... but they say nothing of the passing 'place' (specific ... > where data passed between languages will never include bounded strings, ... we might have the following declarations ... in this package: ...
    (comp.lang.ada)
  • something strange with new process Arguments
    ... I'm starting a new process and passing it some arguments to look at a ... The folder gets created correctly. ... I figure it has to be an encoding problem somewhere among the various ... possible encodings and passings of strings going on. ...
    (microsoft.public.dotnet.general)
  • Passing strings to C++ DLL
    ... I am attempting to write a .NET wrapper for a C++ DLL file, ... problems with passing strings as parameters. ... SDCERR GetCurrentConfig(DWORD *num, char *name); ... C++ functions - the structures contain strings as well. ...
    (microsoft.public.dotnet.languages.csharp)