Interrogating a list of records

This works…


tell application "Microsoft Outlook"
	set MyTargetMessages to every incoming message of inbox whose subject contains "hello"
end tell

So why does this not work?


set MyList to {{name:"Fred", age:28}, {name:"Barney", age:28}}
get every item of MyList where its age is 28

I get the error “Can’t get {{name:“Fred”, age:28}, {name:“Barney”, age:28}} whose age = 28.”

Hi,

the whose clause doesn’t work with custom lists and records, you have to use a repeat loop.

The reason is: The affected list must be specified as an element in the AppleScript dictionary.

Thanks Stefan,
That was just my test but my original problem was not being able to get the following to work:


tell application "Microsoft outlook"
get every incoming message of inbox whose address of sender is "bill.gates@microsoft.com"
end tell

I can get the sender of the incoming messages (which is a record) and if I assign that to a variable I can get the address value from it. But this involves a repeat loop for every message. I would have assumed that it would be faster if I could do it in one line with “every incoming message of inbox whose address of sender is…”

But I get the error “Microsoft Outlook got an error: Can’t make address of sender into type specifier.”