![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
I have created a script that uses SMTP to send an email off a
designated server and then uses redemption to check if the message has arrived in the specified mailbox. The script is being automatically kicked off by a monitoring product and running under an account that has an Outlook profile setup. The script works great if the account is logged on to the machine no matter if Outlook is already open or not. If the account is not logged on then the script will not continue beyond the line below. set Inbox = Session.GetDefaultFolder(olFolderInbox) I have tried to trap an error message but nothing after the line above is executed but the script exits. My question is does redemption require the user account be logged in? The full piece of my code that is using redemption is below. Const olFolderInbox = 6 set Session = CreateObject("Redemption.RDOSession") Session.Logon set Inbox = Session.GetDefaultFolder(olFolderInbox) for each Msg in Inbox.Items for each att in msg.Attachments If lcase(left(att.filename,4)) = "fax-" Then If DateDiff("n",msg.ReceivedTime,FaxSentTime) 5 Then vSuccess = "yes" End If End If Next msg.delete Next |
#2
|
|||
|
|||
![]()
RDOSession does require a logon or an assignment of MAPIOBJECT. I would
check for Session.LoggedOn after the Logon call to verify that the session is truly logged on. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "dcook23" wrote in message ups.com... I have created a script that uses SMTP to send an email off a designated server and then uses redemption to check if the message has arrived in the specified mailbox. The script is being automatically kicked off by a monitoring product and running under an account that has an Outlook profile setup. The script works great if the account is logged on to the machine no matter if Outlook is already open or not. If the account is not logged on then the script will not continue beyond the line below. set Inbox = Session.GetDefaultFolder(olFolderInbox) I have tried to trap an error message but nothing after the line above is executed but the script exits. My question is does redemption require the user account be logged in? The full piece of my code that is using redemption is below. Const olFolderInbox = 6 set Session = CreateObject("Redemption.RDOSession") Session.Logon set Inbox = Session.GetDefaultFolder(olFolderInbox) for each Msg in Inbox.Items for each att in msg.Attachments If lcase(left(att.filename,4)) = "fax-" Then If DateDiff("n",msg.ReceivedTime,FaxSentTime) 5 Then vSuccess = "yes" End If End If Next msg.delete Next |
#3
|
|||
|
|||
![]()
Do you mean whether it makes any difference which Windows user identity your
code is running under? Of course, RDOSession.Logon will try to log to the default profile, which clearly depends on who the user is. It is possible that the current user (e.g. local service account) does not have any profiles at all. Or (if you are impersonating a user), the HKCU registry hive (where the profile are stored) for that user are not loaded. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message ups.com... I have created a script that uses SMTP to send an email off a designated server and then uses redemption to check if the message has arrived in the specified mailbox. The script is being automatically kicked off by a monitoring product and running under an account that has an Outlook profile setup. The script works great if the account is logged on to the machine no matter if Outlook is already open or not. If the account is not logged on then the script will not continue beyond the line below. set Inbox = Session.GetDefaultFolder(olFolderInbox) I have tried to trap an error message but nothing after the line above is executed but the script exits. My question is does redemption require the user account be logged in? The full piece of my code that is using redemption is below. Const olFolderInbox = 6 set Session = CreateObject("Redemption.RDOSession") Session.Logon set Inbox = Session.GetDefaultFolder(olFolderInbox) for each Msg in Inbox.Items for each att in msg.Attachments If lcase(left(att.filename,4)) = "fax-" Then If DateDiff("n",msg.ReceivedTime,FaxSentTime) 5 Then vSuccess = "yes" End If End If Next msg.delete Next |
#4
|
|||
|
|||
![]()
Thank you for the reply.
The monitoring product that executing the script is executing it using a run as so it is running using the credentials of the account that has the Outlook profile configured. Is this not enough to load the hive where the profile is stored? Would using the MAPIOBJECT make any difference? Dmitry Streblechenko wrote: Do you mean whether it makes any difference which Windows user identity your code is running under? Of course, RDOSession.Logon will try to log to the default profile, which clearly depends on who the user is. It is possible that the current user (e.g. local service account) does not have any profiles at all. Or (if you are impersonating a user), the HKCU registry hive (where the profile are stored) for that user are not loaded. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message ups.com... I have created a script that uses SMTP to send an email off a designated server and then uses redemption to check if the message has arrived in the specified mailbox. The script is being automatically kicked off by a monitoring product and running under an account that has an Outlook profile setup. The script works great if the account is logged on to the machine no matter if Outlook is already open or not. If the account is not logged on then the script will not continue beyond the line below. set Inbox = Session.GetDefaultFolder(olFolderInbox) I have tried to trap an error message but nothing after the line above is executed but the script exits. My question is does redemption require the user account be logged in? The full piece of my code that is using redemption is below. Const olFolderInbox = 6 set Session = CreateObject("Redemption.RDOSession") Session.Logon set Inbox = Session.GetDefaultFolder(olFolderInbox) for each Msg in Inbox.Items for each att in msg.Attachments If lcase(left(att.filename,4)) = "fax-" Then If DateDiff("n",msg.ReceivedTime,FaxSentTime) 5 Then vSuccess = "yes" End If End If Next msg.delete Next |
#5
|
|||
|
|||
![]()
Did you try to specify an explicit profile name when calling
RDOSession.Logon? How did you trap the error? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message oups.com... Thank you for the reply. The monitoring product that executing the script is executing it using a run as so it is running using the credentials of the account that has the Outlook profile configured. Is this not enough to load the hive where the profile is stored? Would using the MAPIOBJECT make any difference? Dmitry Streblechenko wrote: Do you mean whether it makes any difference which Windows user identity your code is running under? Of course, RDOSession.Logon will try to log to the default profile, which clearly depends on who the user is. It is possible that the current user (e.g. local service account) does not have any profiles at all. Or (if you are impersonating a user), the HKCU registry hive (where the profile are stored) for that user are not loaded. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message ups.com... I have created a script that uses SMTP to send an email off a designated server and then uses redemption to check if the message has arrived in the specified mailbox. The script is being automatically kicked off by a monitoring product and running under an account that has an Outlook profile setup. The script works great if the account is logged on to the machine no matter if Outlook is already open or not. If the account is not logged on then the script will not continue beyond the line below. set Inbox = Session.GetDefaultFolder(olFolderInbox) I have tried to trap an error message but nothing after the line above is executed but the script exits. My question is does redemption require the user account be logged in? The full piece of my code that is using redemption is below. Const olFolderInbox = 6 set Session = CreateObject("Redemption.RDOSession") Session.Logon set Inbox = Session.GetDefaultFolder(olFolderInbox) for each Msg in Inbox.Items for each att in msg.Attachments If lcase(left(att.filename,4)) = "fax-" Then If DateDiff("n",msg.ReceivedTime,FaxSentTime) 5 Then vSuccess = "yes" End If End If Next msg.delete Next |
#6
|
|||
|
|||
![]()
I tried specifying the profile name and I get the same results.
I have also tried trapping an error with no luck. I setup the script to create a log file when it runs. The logon code looks like this to do my logging: ' Use redemption to logon to default MAPI profile set Session = CreateObject("Redemption.RDOSession") objFile.writeline "going to logon" Session.Logon ObjFile.writeline "post logon" objFile.writeline session.loggedon If I have the user account logged into the server when the monitoring product kicks off the script I get the following written to my log: going to logon post logon True If the user account is not logged onto the machine when the script kicks off I get only the line that says "going to logon" and nothing more. I have also tried using "On Error Resume Next" before the logon even and then writing err.number immediately after logon. That results in 0 when the account is logged on and nothing is writen after "going to logon" when the account is not logged on. It appears the script exits at the "Session.Logon" if the account is not logged on. Does this make sense? Does anyone know if I should be able to get this to work without having the account logged in? I very much appreciate the help. Dmitry Streblechenko wrote: Did you try to specify an explicit profile name when calling RDOSession.Logon? How did you trap the error? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message oups.com... Thank you for the reply. The monitoring product that executing the script is executing it using a run as so it is running using the credentials of the account that has the Outlook profile configured. Is this not enough to load the hive where the profile is stored? Would using the MAPIOBJECT make any difference? Dmitry Streblechenko wrote: Do you mean whether it makes any difference which Windows user identity your code is running under? Of course, RDOSession.Logon will try to log to the default profile, which clearly depends on who the user is. It is possible that the current user (e.g. local service account) does not have any profiles at all. Or (if you are impersonating a user), the HKCU registry hive (where the profile are stored) for that user are not loaded. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message ups.com... I have created a script that uses SMTP to send an email off a designated server and then uses redemption to check if the message has arrived in the specified mailbox. The script is being automatically kicked off by a monitoring product and running under an account that has an Outlook profile setup. The script works great if the account is logged on to the machine no matter if Outlook is already open or not. If the account is not logged on then the script will not continue beyond the line below. set Inbox = Session.GetDefaultFolder(olFolderInbox) I have tried to trap an error message but nothing after the line above is executed but the script exits. My question is does redemption require the user account be logged in? The full piece of my code that is using redemption is below. Const olFolderInbox = 6 set Session = CreateObject("Redemption.RDOSession") Session.Logon set Inbox = Session.GetDefaultFolder(olFolderInbox) for each Msg in Inbox.Items for each att in msg.Attachments If lcase(left(att.filename,4)) = "fax-" Then If DateDiff("n",msg.ReceivedTime,FaxSentTime) 5 Then vSuccess = "yes" End If End If Next msg.delete Next |
#7
|
|||
|
|||
![]()
Hmmm.. Is that a PST or an Exchange mailbox?
Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message oups.com... I tried specifying the profile name and I get the same results. I have also tried trapping an error with no luck. I setup the script to create a log file when it runs. The logon code looks like this to do my logging: ' Use redemption to logon to default MAPI profile set Session = CreateObject("Redemption.RDOSession") objFile.writeline "going to logon" Session.Logon ObjFile.writeline "post logon" objFile.writeline session.loggedon If I have the user account logged into the server when the monitoring product kicks off the script I get the following written to my log: going to logon post logon True If the user account is not logged onto the machine when the script kicks off I get only the line that says "going to logon" and nothing more. I have also tried using "On Error Resume Next" before the logon even and then writing err.number immediately after logon. That results in 0 when the account is logged on and nothing is writen after "going to logon" when the account is not logged on. It appears the script exits at the "Session.Logon" if the account is not logged on. Does this make sense? Does anyone know if I should be able to get this to work without having the account logged in? I very much appreciate the help. Dmitry Streblechenko wrote: Did you try to specify an explicit profile name when calling RDOSession.Logon? How did you trap the error? Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message oups.com... Thank you for the reply. The monitoring product that executing the script is executing it using a run as so it is running using the credentials of the account that has the Outlook profile configured. Is this not enough to load the hive where the profile is stored? Would using the MAPIOBJECT make any difference? Dmitry Streblechenko wrote: Do you mean whether it makes any difference which Windows user identity your code is running under? Of course, RDOSession.Logon will try to log to the default profile, which clearly depends on who the user is. It is possible that the current user (e.g. local service account) does not have any profiles at all. Or (if you are impersonating a user), the HKCU registry hive (where the profile are stored) for that user are not loaded. Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "dcook23" wrote in message ups.com... I have created a script that uses SMTP to send an email off a designated server and then uses redemption to check if the message has arrived in the specified mailbox. The script is being automatically kicked off by a monitoring product and running under an account that has an Outlook profile setup. The script works great if the account is logged on to the machine no matter if Outlook is already open or not. If the account is not logged on then the script will not continue beyond the line below. set Inbox = Session.GetDefaultFolder(olFolderInbox) I have tried to trap an error message but nothing after the line above is executed but the script exits. My question is does redemption require the user account be logged in? The full piece of my code that is using redemption is below. Const olFolderInbox = 6 set Session = CreateObject("Redemption.RDOSession") Session.Logon set Inbox = Session.GetDefaultFolder(olFolderInbox) for each Msg in Inbox.Items for each att in msg.Attachments If lcase(left(att.filename,4)) = "fax-" Then If DateDiff("n",msg.ReceivedTime,FaxSentTime) 5 Then vSuccess = "yes" End If End If Next msg.delete Next |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Redemption and hiding user in exchange from address lists | [email protected] | Outlook and VBA | 8 | August 7th 06 07:53 PM |
User logged in on several systems | Charles MacLean | Outlook - Installation | 0 | June 1st 06 02:30 AM |
Outlook Interop COM Exception When Logged in as Windows Standard User | [email protected] | Add-ins for Outlook | 0 | April 27th 06 01:34 AM |
Possible to require e-mail be read? | Chase | Outlook and VBA | 1 | March 27th 06 06:37 AM |
Possible to require e-mail be read? | Chase | Outlook - Using Forms | 0 | March 27th 06 12:50 AM |