views:

38

answers:

1

Hi,

I am trying to read Location of Calendar item in Lotus Notes. When i check in Document Properties manually.I am able to view the value, But when i read it via using Domino.dll in am getting "" value.

I am using:

String Location  = ((object[])CalendarDoc.GetItemValue("Location"))[0] as String;

Also tried :

String tmpLocation  = ((object[])CalendarDoc.GetItemValue("tmpLocation"))[0] as String;

is there any other way to get 'Location' value ? using Domino.dll in C#.

Thanx

+1  A: 

Here's a wild guess... I'm wondering if it's the as string that's causing your issues. I think it depends on the object type being returned by GetItemValue. I'm guessing at runtime it will try to cast your object to a string which might not be what you want. You might just want the text that the object represents (assuming that the ToString gives that).

string location = GetLocationFromDocument();

private string GetLocationFromDocument()
{
    object[] values = CalendarDoc.GetItemValue("Location");
    if( values != null && values.Length > 0 && values[0] != null )
    {
        return values[0].ToString();
    }
    return string.Empty;
}

Sorry, I don't have the required assemblies to test this. If this doesn't work I can delete my answer because I don't wan't bad information floating around.

Jerod Houghtelling