I am trying to use a powershell app I found online to automatically sent an otc file via powershell. I am clueless as to syntax. Getting syntax error with this piece$olApp = New-Object -ComObject Outlook.Application
$objMsg = $olApp.CreateItemFromTemplate ($Path"c:\scripts\test.oft")
This is the error I get.
PS C:\scripts> C:\Scripts\Send-OutlookMailFromTemplate.ps1
At C:\Scripts\Send-OutlookMailFromTemplate.ps1:43 char:42
-
$objMsg = $olApp.CreateItemFromTemplate ($Path"c:\scripts\test.of ...
-
~
Unexpected token ‘(’ in expression or statement.
At C:\Scripts\Send-OutlookMailFromTemplate.ps1:43 char:48
- … $objMsg = $olApp.CreateItemFromTemplate ($Path"c:\scripts\test.oft")
-
~~~~~~~~~~~~~~~~~~~~~
Unexpected token ‘“c:\scripts\test.oft”’ in expression or statement.
At C:\Scripts\Send-OutlookMailFromTemplate.ps1:43 char:48
-
$objMsg = $olApp.CreateItemFromTemplate ($Path"c:\scripts\test.of ...
-
~
Missing closing ‘)’ in expression.
At C:\Scripts\Send-OutlookMailFromTemplate.ps1:2 char:1
- {
- ~
Missing closing ‘}’ in statement block or type definition.
At C:\Scripts\Send-OutlookMailFromTemplate.ps1:43 char:69 - … $objMsg = $olApp.CreateItemFromTemplate ($Path"c:\scripts\test.oft")
-
~
Unexpected token ‘)’ in expression or statement.
At C:\Scripts\Send-OutlookMailFromTemplate.ps1:60 char:1
- }
- ~
Unexpected token ‘}’ in expression or statement.- CategoryInfo : ParserError: ( , ParentContainsErrorRecordException
- FullyQualifiedErrorId : UnexpectedToken
Here is the link to the program. My file resides in c:\scripts\test.oft
Any help would be greatly appreciated. I am frankly clueless. Thanks