Mar 18 2022 02:44 AM - edited Mar 18 2022 02:46 AM
$outlook = new-object -com Outlook.Application;
$namespace = $outlook.GetNameSpace("MAPI");
$inputFolderObj=$namespace.Folders.Item('Email address removed').Folders.Item('temp')
$scope = $inputFolderObj.FolderPath
$filter = ""
$search = $outlook.AdvancedSearch("'$scope'", $filter, $True)
$search.Results.Count
Count is '0' even though there is an email in the folder.
In debugging mode with breakpoint at the last line, I try to enter several times '$search', then '$search.Results', and finally I can see my email.
Do you know what is the problem underneath?
Outlook version 2202 build 14931.20132 Office
PSVersion 7.2.2
Ou PSVersion 5.1.22000.282
Savez-vous d'où vient le problème?
Mar 19 2022 03:01 AM
Mar 23 2022 02:28 AM - edited Mar 28 2022 12:01 PM
Did it fix your issue if you put a start-sleep -seconds 10 after $search = $outlook.AdvancedSearch("'$scope'", $filter, $True) ?