How can i get all the items in a table.

May 31, 2011 at 11:54 PM

Hi White Team.
I am having some troubles while creating and automatic process in Outlook 2007

I would like to select all the emails from messages pane but I am only able to select the visible messages that are in the visible scrollbar area.

I tried to get items with this two following methods and I getting the same results ( only visible items in the scrollbar area).
1. TablePattern.RowCount
2 .Table.AutomationElement.FindAll(TreeScope.Children, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.DataItem)

I also tried using SpyUI and LogStructure but i got the same results.
Is there other way to get all the items from the table?
Thanks

Screen

screen

 

Whilte Log

AutomationId: 4704
ControlType: ControlType.Table
Name: Table View
HelpText: 
Bounding rectangle: 945,174,219,427
ClassName: SuperGrid
IsOffScreen: False
FrameworkId: Win32
ProcessId: 3072

System.Windows.Automation.GridPattern
System.Windows.Automation.TablePattern

    AutomationId: 4693
    ControlType: ControlType.Pane
    Name: Vertical
    HelpText: 
    Bounding rectangle: 1164,174,16,427
    ClassName: NUIScrollbar
    IsOffScreen: False
    FrameworkId: Win32
    ProcessId: 3072


        AutomationId: 
        ControlType: ControlType.Pane
        Name: 
        HelpText: 
        Bounding rectangle: 1164,174,16,427
        ClassName: NetUIHWNDElement
        IsOffScreen: False
        FrameworkId: Win32
        ProcessId: 3072


            AutomationId: 
            ControlType: ControlType.ScrollBar
            Name: 
            HelpText: Used to change the vertical viewing area
            Bounding rectangle: 1164,174,16,427
            ClassName: NetUIScrollBar
            IsOffScreen: False
            FrameworkId: 
            ProcessId: 3072

            System.Windows.Automation.RangeValuePattern

                AutomationId: 
                ControlType: ControlType.Button
                Name: Line up
                HelpText: Moves the vertical position up one line
                Bounding rectangle: 1164,174,16,16
                ClassName: NetUIRepeatButton
                IsOffScreen: False
                FrameworkId: 
                ProcessId: 3072

                System.Windows.Automation.InvokePattern
                System.Windows.Automation.TogglePattern

                AutomationId: 
                ControlType: ControlType.Button
                Name: Page up
                HelpText: Moves the vertical position up a couple of lines
                Bounding rectangle: Empty
                ClassName: NetUIRepeatButton
                IsOffScreen: True
                FrameworkId: 
                ProcessId: 3072

                System.Windows.Automation.InvokePattern
                System.Windows.Automation.TogglePattern

                AutomationId: 
                ControlType: ControlType.Thumb
                Name: Position
                HelpText: Indicates the current vertical position, and can be dragged to change it directly
                Bounding rectangle: 1164,190,16,188
                ClassName: NetUIThumb
                IsOffScreen: False
                FrameworkId: 
                ProcessId: 3072

                System.Windows.Automation.TransformPattern

                AutomationId: 
                ControlType: ControlType.Button
                Name: Page down
                HelpText: Moves the vertical position down a couple of lines
                Bounding rectangle: 1164,378,16,207
                ClassName: NetUIRepeatButton
                IsOffScreen: False
                FrameworkId: 
                ProcessId: 3072

                System.Windows.Automation.InvokePattern
                System.Windows.Automation.TogglePattern

                AutomationId: 
                ControlType: ControlType.Button
                Name: Line down
                HelpText: Moves the vertical position down one line
                Bounding rectangle: 1164,585,16,16
                ClassName: NetUIRepeatButton
                IsOffScreen: False
                FrameworkId: 
                ProcessId: 3072

                System.Windows.Automation.InvokePattern
                System.Windows.Automation.TogglePattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,196,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,231,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,266,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Image
        Name: Red Category
        HelpText: 
        Bounding rectangle: 1145,266,19,35
        ClassName: CategoryField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,301,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Image
        Name: Red Category
        HelpText: 
        Bounding rectangle: 1145,301,19,35
        ClassName: CategoryField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,336,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Image
        Name: Red Category
        HelpText: 
        Bounding rectangle: 1145,336,19,35
        ClassName: CategoryField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,371,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Image
        Name: Red Category
        HelpText: 
        Bounding rectangle: 1145,371,19,35
        ClassName: CategoryField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,406,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Image
        Name: Red Category
        HelpText: 
        Bounding rectangle: 1145,406,19,35
        ClassName: CategoryField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,441,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Image
        Name: Red Category
        HelpText: 
        Bounding rectangle: 1145,441,19,35
        ClassName: CategoryField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,476,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Image
        Name: Red Category
        HelpText: 
        Bounding rectangle: 1145,476,19,35
        ClassName: CategoryField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,511,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Image
        Name: Red Category
        HelpText: 
        Bounding rectangle: 1145,511,19,35
        ClassName: CategoryField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

    AutomationId: 
    ControlType: ControlType.DataItem
    Name: Message Read
    HelpText: 
    Bounding rectangle: 945,546,219,35
    ClassName: LeafRow
    IsOffScreen: False
    FrameworkId: 
    ProcessId: 3072

    System.Windows.Automation.ValuePattern
    System.Windows.Automation.GridItemPattern
    System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: None
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern

        AutomationId: 
        ControlType: ControlType.Text
        Name: 39 KB
        HelpText: 
        Bounding rectangle: 2.77486599262612E-308,2.02372552203832E+94,3.5078767274593E-74,2.77490883695998E-308
        ClassName: GenericField
        IsOffScreen: False
        FrameworkId: 
        ProcessId: 3072

        System.Windows.Automation.GridItemPattern
        System.Windows.Automation.TableItemPattern
Jun 1, 2011 at 7:46 AM
Edited Jun 1, 2011 at 7:46 AM

Hi

 I am right to say that you can get all messages which are visible for the user and you can't see the one which are offscreen?

 

In that case I would do the following steps.

 

- Scroll to the top

- Get all visible messages and store them in a List<OutlookMessages> allMessages.

in a loop, stop criteria is scroll bar reach the bottom

- Scroll a defined range,

- Get all visible messages and store them in the allMessages List (if not already exists)

 

done