![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Can not Convert System._ComObject to Microsoft.Office.Interop.Outlook.MapiFolder Here is a litte power shell , that creates a rule for moving mail item to a specifice folder.But whenever , i call $oMove.Folder = $destFolder; i get Can not Convert System._ComObject to Microsoft.Office.Interop.Outlook.MapiFolder Full code. $libraryPath = "C:\WINDOWS\assembly\GAC \Microsoft.Office.Interop.Outlook\12.0.0.0__71e9bce111e9429c \Microsoft.Office.Interop.Outlook.dll"; [void][System.Reflection.Assembly]::LoadFile($libraryPath); [Microsoft.Office.Interop.Outlook.Application]$app = New-Object Microsoft.Office.Interop.Outlook.ApplicationClass; $namespace = $app.GetNamespace("MAPI"); $rules = $app.Session.DefaultStore.GetRules(); $defaultFolder = $namespace.GetDefaultFolder([Microsoft.Office.Interop.Outlook.OlDefaultFolders]: lFolderInbox);$rule = $rules.Create("Power shell rules", [Microsoft.Office.Interop.Outlook.OlRuleType]: lRuleReceive);$oFrom = $rule.Conditions.From; $oRecip = $oFrom.Recipients.Add("someone@somedomain.com"); $oRecip.Resolve(); $oFrom.Enabled = $true; $destFolder = $null; $folders = $defaultFolder.Parent.Folders; foreach($folder in $folders) { if ($folder.Name -eq "Work") { $destFolder = $folder; } } $oMove = $rule.Actions.get_MoveToFolder(); $oMove.Folder = $destFolder; #$oMove.Folder.FolderPath; #$rules.Save(); -- Regards, Mehfuz Hossain http://www.mehfuz.com |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Microsoft.VirtualServer.Interop.dll and the Microsoft.VMRCClientControl.Interop.dll | ASun | Virtual Server | 0 | 08-12-2008 02:30 PM |
| Microsoft Announces New Version of Microsoft Dynamics CRM for 2007 Microsoft Office System and Windows Vista | z3r010 | Vista News | 0 | 11-13-2006 09:11 PM |
| Microsoft Announces New Version of Microsoft Dynamics CRM for 2007 Microsoft Office System and Windows Vista | z3r010 | Vista News | 0 | 11-07-2006 02:04 AM |
| Microsoft and Intel Help System Builders Get Ready for Windows Vista, the 2007 Microsoft Office System and Intel® Core™ 2 Duo Processors | z3r010 | Vista News | 0 | 10-18-2006 03:07 AM |
| Microsoft and Intel Help System Builders Get Ready for Windows Vista, the 2007 Microsoft Office System and Intel® Core™ 2 Duo Processors | z3r010 | Vista News | 0 | 10-12-2006 08:02 AM |