I have written some powershell, which checks a bunch of users mailboxes, and checks a specific property using a Mapitable. However I need to count the UserProperties also, and i'm struggling to do this in conjunction with the MapiTable - Ideally i'd like it to be "select blah from blah where userproperties.count = 4 AND crmregardingID IS NOT NULL"

Here's the snippet of code:

$sSqlQuery = 'Select Subject, senderName, MessageClass, ReceivedTime From $oFolName where "http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/crmRegardingId" IS NOT NULL'
$CurrFold = $RSession.GetFolderFromID($oDefFolder.EntryID)

$RTable.Item = $CurrFold.Items

$RecordSet = $RTable.ExecSQL($sSQLQuery)
if($recordset.recordcount -gt 0){
write-host "running loop"
Do STUFF
$recordset.Movenext()} until
    ($Recordset.EOF -eq $true )
$recordset.close()
$RSession.Logoff()
}

All help much appreciated :)

有帮助吗?

解决方案

User properties definitions are stored as a blob in a special named property. The only way to get the UserProperties collection is to open the message as RDOMail object; you cannot do that using ExwecSQL.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top