How to Import Contacts into Another User’s Outlook Using PowerShell?

0
4
Asked By TechyTraveler92 On

I've got a local contacts list in Outlook that I can export as a CSV or PST file. I'm looking to use PowerShell to import these contacts into another user's Outlook. Is this actually possible? Any guidance would be greatly appreciated!

2 Answers

Answered By PowerScripter2000 On

You can certainly import contacts via PowerShell! First, load the Outlook COM object. Here’s a quick script you can run:

```powershell
$Outlook = New-Object -ComObject Outlook.Application
$Namespace = $Outlook.GetNamespace("MAPI")
$Contacts = $Namespace.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]::olFolderContacts)
$csv = Import-Csv "C:PathContacts.csv"

foreach ($c in $csv) {
$contact = $Contacts.Items.Add("IPM.Contact")
$contact.FirstName = $c.FirstName
$contact.LastName = $c.LastName
$contact.Email1Address = $c.Email
$contact.BusinessTelephoneNumber = $c.BusinessPhone
$contact.MobileTelephoneNumber = $c.MobilePhone
$contact.Save()
}
```
Just be sure to run this as the user whose Outlook is getting the contacts, and it's best to close Outlook beforehand to avoid any file lock issues!

HelpfulHarry -

Yes, definitely! Just keep in mind that you need to be logged in as the user who is going to have the contacts imported when you run that PowerShell script.

Answered By SysAdminSam On

Are you using Exchange or Exchange Online? If it's Exchange, you can simply export your contacts to a PST file and then import that PST into the user's mailbox.

TechyTraveler92 -

So, if I export my contacts to a PST, I can indeed import them into the user's Outlook? How do I do this on the Exchange side?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.