I would like to add contacts from PowerShell using the New-MailContact cmdlet.

Asked 2 years ago, Updated 2 years ago, 280 views

I would like to create a batch to register Outlook destinations from PowerShell.

If you run the following cmdlet from PowerShell, of course you won't get an Outlook instance, so
US>"Not recognized as a cmdlet, function, script file, or name of an operational program.US>"
This is an error.
https://docs.microsoft.com/en-us/powershell/module/exchange/new-mailcontact?view=exchange-ps

For questions, please refer to

Thank you for your cooperation.

powershell

2022-09-30 21:54

1 Answers

Please tell me how to use this cmdlet in order.

I don't know how to use this cmdlet, but
I think it's probably the web version.
Perhaps the contributor would like to register his contact information with the offline version of Outlook
(I'm sorry if I'm wrong.)
In that case, you can use the following code:

#Set-MailContact

$outlook=New-Object-ComObject Outlook.Application

# https://docs.microsoft.com/en-us/office/vba/api/outlook.olitemtype
#olContactItem2
$objContact=$outlook.CreateItem(2)

$objContact.FullName="powershellTest"


$objContact.Save()

Please let me know if you know any books or sites that can be helpful when operating MS products on PowerShell

The current situation is that there are no good books.
So, I'll show you how I studied.

"First, ""Implement"" or ""Refer to the source code on the web"" what you want to do with VBA."
Then rewrite it with powershell.When rewriting, use New-Object-ComObject to
Create an Excel or Outlook object.

That's all.


2022-09-30 21:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.