Hi, I'm using this method, but I need it's runs all the time, I use a "while()" instead of "if(myInbox.Items.Count > 0)", so, when the cycle is used 21 times throws me an error.
Was not controlled System.Runtime.InteropServices.COMException
Message=The operation failed due to a registry problem or installation. Restart Outlook and try again. If the problem persists, reinstall it.
Source=Microsoft Outlook
ErrorCode=-2147221225
StackTrace:
in Microsoft.Office.Interop.Outlook.ItemsClass.Restrict(String Filter)
in LeerCorreos.Program.Main(String[] args) en C:\Users\Usuario\documents\visual studio 2010\Projects\LeerCorreos\LeerCorreos\Program.cs:línea 46
in System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
in System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
in Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()
InnerException:
Where throws the error is in this line:
inboxItems = inboxItems.Restrict("[UnRead] = true");
can you help?, I really appreciate it, I don't know how to resolve it