On Apr 9, 12:34 am, "Nation, Carey" <Carey.Nat... / turner.com> wrote:
> Who is the service running as?  It's going to need to run as the owner
> of the inbox for this to stand a chance.  Is this exchange server or pop
> mail?  If it's exchange server, remember that it uses integrated
> authorization; so again, you'll need the correct user as the service's
> login user.  If it's pop, it's just because it's reading the wrong set
> of things in "Documents and Settings" and maybe the registry.
>

Thanks for your inputs

1>I am using office2003 and outlook2003 in it. So I am using pop mail
I guess.

Now how do i configure my service code's service login user?

do i have add  this part of the code?

:service_start_name => 'SomeDomain\\User' onto my svc object?


svc= Service.new(SERVICE_NAME, nil,{
      :service_type       => Service::WIN32_OWN_PROCESS,
      :description        => SERVICE_DISPLAYNAME,
      :start_type         => Service::AUTO_START,
      :error_control      => Service::ERROR_NORMAL,
      :binary_path_name   => cmd,
      :load_order_group   => 'Network',
      :dependencies       => ['W32Time','Schedule'],
      :display_name       => 'Kpi-file-Scanner'}
      )

2>Also I found this link http://support.microsoft.com/kb/237913 which
says (The Outlook Object Model is unsuitable to run in a Windows
service) that is very discouraging.

3>What I am unable to still understand when i run the following

require 'win32ole'
outlook = WIN32OLE.new('Outlook.Application')
mapi = outlook.GetNameSpace('MAPI')
inbox = mapi.GetDefaultFolder(6)
file_c=1
puts "#{inbox.UnreadItemCount}:so many unread messages"
puts "#{inbox.Items.Count}:so many messages"

.. I get perfect ouput... and looking onto windows process i find
oulook.exe running under SYSTEM ...but still I get the right output.

....