gpt4 book ai didi

powershell - 通过 powershell 在 Outlook ContactItem 中没有电子邮件地址

转载 作者:行者123 更新时间:2023-12-04 21:32:47 25 4
gpt4 key购买 nike

当我检查 ContactItem ,所有 Email#Address 值都为空。我试过设置值然后打印值。此更改反射(reflect)在 Outlook 中,但是,无法通过 PowerShell 检索任何值。

下面是一些片段:

$Outlook=NEW-OBJECT –comobject Outlook.Application
$Contacts=$Outlook.session.GetDefaultFolder(10).items
$Contactsfolders = $Outlook.session.GetDefaultFolder(10).Folders
$testFolder = $Contactsfolders | Where-Object {$_.Name -eq 'Test Folder'}
$testContact = $testFolder.Items(1)

echo $testContact
$testContact.Email1Address = "BobDoe3@doe.com"
echo $testContact

这是上述执行的输出。注意我已经删除了一些无趣的信息以缩短。

第一回声
Application                  : Microsoft.Office.Interop.Outlook.ApplicationClass
Class : 40
Session : Microsoft.Office.Interop.Outlook.NameSpaceClass
ConversationTopic : John Doe
FormDescription : System.__ComObject
GetInspector : System.__ComObject
Importance : 1
LastModificationTime : 10/31/2017 5:57:04 PM
MAPIOBJECT : System.__ComObject
MessageClass : IPM.Contact
OutlookInternalVersion : 154971
OutlookVersion : 15.0
Saved : True
Sensitivity : 0
Size : 11614
Subject : Bob Doe
UserProperties : System.__ComObject
Account :
Anniversary : 1/1/4501 12:00:00 AM
AssistantName :
AssistantTelephoneNumber :
Birthday : 1/1/4501 12:00:00 AM
CompanyAndFullName : The Doe Company
Doe, Bob
CompanyLastFirstNoSpace :
CompanyLastFirstSpaceOnly :
CompanyMainTelephoneNumber :
CompanyName : The Doe Company
ComputerNetworkName :
CustomerID :
Department :
Email1Address :
Email1AddressType :
Email1DisplayName :
Email1EntryID :
Email2Address :
Email2AddressType :
Email2DisplayName :
Email2EntryID :
Email3Address :
Email3AddressType :
Email3DisplayName :
Email3EntryID :
FileAs : Doe, Bob
FirstName : Bob
FTPSite :
FullName : Bob Doe
FullNameAndCompany : Doe, Bob
The Doe Company
Gender : 0
GovernmentIDNumber :
Hobby :
Home2TelephoneNumber :
HomeAddress :
HomeAddressCity :
HomeAddressCountry :
HomeAddressPostalCode :
HomeAddressPostOfficeBox :
HomeAddressState :
HomeAddressStreet :
HomeFaxNumber :
HomeTelephoneNumber :
Initials : B.D.
InternetFreeBusyAddress :
ISDNNumber :
JobTitle :
Journal : False
Language :
LastFirstAndSuffix :
LastFirstNoSpace :
LastFirstNoSpaceCompany :
LastFirstSpaceOnly :
LastFirstSpaceOnlyCompany :
LastName : Doe
LastNameAndFirstName : Doe, Bob

第二回声
Application                  : Microsoft.Office.Interop.Outlook.ApplicationClass
Class : 40
Session : System.__ComObject
Subject : Bob Doe
UnRead : False
UserProperties : System.__ComObject
Account :
Anniversary : 1/1/4501 12:00:00 AM
AssistantName :
AssistantTelephoneNumber :
Birthday : 1/1/4501 12:00:00 AM
Business2TelephoneNumber :
BusinessAddress :
BusinessAddressCity :
BusinessAddressCountry :
BusinessAddressPostalCode :
BusinessAddressPostOfficeBox :
BusinessAddressState :
BusinessAddressStreet :
BusinessFaxNumber :
BusinessHomePage :
BusinessTelephoneNumber :
CallbackTelephoneNumber :
CarTelephoneNumber :
Children :
CompanyAndFullName : The Doe Company
Doe, Bob
CompanyLastFirstNoSpace :
CompanyLastFirstSpaceOnly :
CompanyMainTelephoneNumber :
CompanyName : The Doe Company
ComputerNetworkName :
CustomerID :
Department :
Email1Address :
Email1AddressType :
Email1DisplayName :
Email1EntryID :
Email2Address :
Email2AddressType :
Email2DisplayName :
Email2EntryID :
Email3Address :
Email3AddressType :
Email3DisplayName :
Email3EntryID :
FileAs : Doe, Bob
FirstName : Bob
FTPSite :
FullName : Bob Doe
FullNameAndCompany : Doe, Bob
The Doe Company
Gender : 0
GovernmentIDNumber :
Hobby :
Home2TelephoneNumber :
HomeAddress :
HomeAddressCity :
HomeAddressCountry :
HomeAddressPostalCode :
HomeAddressPostOfficeBox :
HomeAddressState :
HomeAddressStreet :
HomeFaxNumber :
HomeTelephoneNumber :
Initials : B.D.
InternetFreeBusyAddress :
ISDNNumber :
JobTitle :
Journal : False
Language :
LastFirstAndSuffix :
LastFirstNoSpace :
LastFirstNoSpaceCompany :
LastFirstSpaceOnly :
LastFirstSpaceOnlyCompany :
LastName : Doe
LastNameAndFirstName : Doe, Bob

我在玩不同的结果和解决方案时发现了一些有趣的东西。
我发现以下两个查询都产生了相同的匹配,这让我很困惑,正如我所想的 myString -ne ''正在检查字符串是否为空。看来 myString -ne ''[String]::IsNullOrEmpty($myString)两者都可以返回 true,这似乎是不可能的,但我认为在某些情况下可能会发生这种情况。另请注意 IsNullOrEmpty功能非常快。
$Listconstact=$session.GetDefaultFolder(10).Folders | %{$session.GetFolderFromID($_.EntryID).Items | where Email1Address -NE ''}


$Listconstact=$session.GetDefaultFolder(10).Folders | %{$session.GetFolderFromID($_.EntryID).Items | where {[String]::IsNullOrEmpty($_.Email1Address)}}

图坎的回答结果:
VERBOSE: From:
VERBOSE: Subject: How are things
VERBOSE: From:
VERBOSE: Subject: See you soon
VERBOSE: From:
VERBOSE: Subject: Meeting Times

最佳答案

尝试这样的事情:

$Outlook=NEW-OBJECT –comobject Outlook.Application
$session=$Outlook.session
$Listconstact=$session.GetDefaultFolder(10).Folders | %{$session.GetFolderFromID($_.EntryID).Items | where Email1Address -ne ''}

#only one item
Write-Host "First element mail : $($Listconstact[0].Email1Address)`n`n"


#All mails
Write-Host "All element mail :"
$Listconstact.Email1Address

关于powershell - 通过 powershell 在 Outlook ContactItem 中没有电子邮件地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47045783/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com