Re: outlook and win32 service
- From: James Tucker <jftucker@xxxxxxxxx>
- Date: Wed, 9 Apr 2008 07:33:06 -0500
On 9 Apr 2008, at 12:50, BENI wrote:
On Apr 9, 12:34 am, "Nation, Carey" <Carey.Nat...@xxxxxxxxxx> 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.
I don't remember what your original task was, but have you considered
using Net::POP?
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.
I do not know the specifics, but doing my own work I recently ran into
the issues of how sandboxed the services are.
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.
....
You may be able to do this by hacking the User HIVE in order to
authorize SYSTEM with access to the users registry, and then there's a
dual logon hack you can use to ensure that a SYSTEM logon will load
the target users hive into memory. Sadly this is a major security
issue that you will raise, and the process is very complicated
(involving copying various hashes around under regedit32 running as
SYSTEM iirc, and you might even need to sort out some UTF8 interface
problems iirc). This is most typically used for laptop users that need
local administrator rights, but cannot be administrators in the
controlling domain. The users traditionally had two user accounts, but
using the same technique one can effectively 'log on' as both users
simultaneously.
Finally, I might also suggest that there's no need to service this.
You should be able to create either an outlook plugin or a new outlook
'launcher' (using COM, almost as you have already done) in order to
run this process whenever outlook is running. From this point you may
then consider using a standard 'daemonizing' tool such as firedaemon
(I've never used that, but I have seen it running 'normal' windows
processes under a service wrapper) for solving the problem of service
restrictions.
HTH
.
- Follow-Ups:
- Re: outlook and win32 service
- From: Phillip Gawlowski
- Re: outlook and win32 service
- References:
- Re: outlook and win32 service
- From: Nation, Carey
- Re: outlook and win32 service
- From: BENI
- Re: outlook and win32 service
- Prev by Date: Re: RubyâEURO(tm)s not ready - an indepth e ssay
- Next by Date: Re: Ruby multiline regex problem
- Previous by thread: Re: outlook and win32 service
- Next by thread: Re: outlook and win32 service
- Index(es):
Relevant Pages
|