Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Outlook Application

$
0
0

Hello

I would like to use the following PowerShell script, however, while executing$outlook = new-object -comobject outlook.application nothing is return to the $Outlook variable.. I am using OUTLOOK 2010 release.

I found the COM outlook.application after executingGet-WmiObjectWin32_COMClass “and “Get-ChildItemHKLM:\Software\Classes

I am missing something.

Thank you in advance.

[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.Outlook") | out-null

$olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders" -as [type]

$outlook = new-object -comobject outlook.application

$namespace = $outlook.GetNameSpace("MAPI")

$folder = $namespace.getDefaultFolder($olFolders::olFolderJunk)

$folder.items.count


Learning PowerShell scripting



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>