![]() |
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
|
|||
|
|||
![]()
Hi,
I've written an console-application based on Redemption (http://www.dimastr.com/redemption/)). the following code tries to resolve the smtp-Address of the mailsender: if(addressEntry.Type.Equals("EX")){ //39FE = PR_SMTP_ADDRESS 001E for type PT_String8 String temp = (String)addressEntry.get_Fields(0x39FE001E); if(temp == null){ //403E = PR_OrgEmailAddr 001E for type PT_String8 temp = (String)addressEntry.get_Fields(0x403E001E); if(temp==null){ throw new Exceptions.MailAddressCouldNotExtractedException(a ddressEntry.Address); } } return temp; } In case of starting the application in normal way the shown code works. addressEntry.get_Fields(0x39FE001E) return the correct value. When handling the same mail by starting the app per sceduled task (same user performer) addressEntry.get_Fields(0x39FE001E) return null ! any idea? Thank you, Jan |
Ads |
#2
|
|||
|
|||
![]()
Are you using a Redemption RDOSession object or what? You don't show enough
of your code to tell. Generally if the user has started Outlook and you piggy-back on that session you're all logged in. If Outlook is started using automation you either have to log onto an RDOSession or if you're deriving things from NameSpace you need to logon to the NameSpace before anything else and then make sure you assign the NameSpace.MAPIOBJECT to the Redemption object's MAPIOBJECT. -- 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 "jpfi" wrote in message ups.com... Hi, I've written an console-application based on Redemption (http://www.dimastr.com/redemption/)). the following code tries to resolve the smtp-Address of the mailsender: if(addressEntry.Type.Equals("EX")){ //39FE = PR_SMTP_ADDRESS 001E for type PT_String8 String temp = (String)addressEntry.get_Fields(0x39FE001E); if(temp == null){ //403E = PR_OrgEmailAddr 001E for type PT_String8 temp = (String)addressEntry.get_Fields(0x403E001E); if(temp==null){ throw new Exceptions.MailAddressCouldNotExtractedException(a ddressEntry.Address); } } return temp; } In case of starting the application in normal way the shown code works. addressEntry.get_Fields(0x39FE001E) return the correct value. When handling the same mail by starting the app per sceduled task (same user performer) addressEntry.get_Fields(0x39FE001E) return null ! any idea? Thank you, Jan |
#3
|
|||
|
|||
![]()
Hi,
thanks Ken. I think my logon works correctly, because I can read the mail-properties of mails sent by smtp-mailaccounts. But I cannot read some mail-properties of mails sent by an exchange-account, e.g. addressEntry.Type ist null. It seems to me, that something around the addressbook doesn't work. A little bit in detail: I configure a scheduled task with username and password and my exe. This user has a configured outlook-profile. some code snippets: //main-method opens outlook-App Application outLookApp = new Application(); /* ... * find correct MAPIFolder... * get items of MAPIFolder... * for each item get recipients an extract smtp-address-- call extractTo(mailItem.Recipients) * for each item get Sender an extract smtp-address-- call extractMailAddress(mailItem.Sender) */ private StringCollection extractTo(SafeRecipients recipients){ System.Collections.IEnumerator enumerator = recipients.GetEnumerator(); StringCollection list = new StringCollection(); while(enumerator.MoveNext()){ SafeRecipient recipient = (SafeRecipient)enumerator.Current; if(OlMailRecipientType.olTo.GetHashCode() == recipient.Type) list.Add(extractMailAddress(recipient.AddressEntry )); } return list; } private String extractMailAddress(Redemption.AddressEntry addressEntry){ String temp; if(addressEntry.Type!=null && addressEntry.Type.Equals("EX")){ //39FE = PR_SMTP_ADDRESS 001E for type PT_String8 temp = (String)addressEntry.get_Fields(0x39FE001E); if(temp == null){ //403E = PR_OrgEmailAddr 001E for type PT_String8 temp = (String)addressEntry.get_Fields(0x403E001E); if(temp==null){ throw new Exceptions.MailAddressCouldNotExtractedException(a ddressEntry.Address); } } } else{ temp = addressEntry.Address; } log.Debug("Address found: "+temp); return temp; } jpfi Ken Slovak - [MVP - Outlook] schrieb: Are you using a Redemption RDOSession object or what? You don't show enough of your code to tell. Generally if the user has started Outlook and you piggy-back on that session you're all logged in. If Outlook is started using automation you either have to log onto an RDOSession or if you're deriving things from NameSpace you need to logon to the NameSpace before anything else and then make sure you assign the NameSpace.MAPIOBJECT to the Redemption object's MAPIOBJECT. -- 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 "jpfi" wrote in message ups.com... Hi, I've written an console-application based on Redemption (http://www.dimastr.com/redemption/)). the following code tries to resolve the smtp-Address of the mailsender: if(addressEntry.Type.Equals("EX")){ //39FE = PR_SMTP_ADDRESS 001E for type PT_String8 String temp = (String)addressEntry.get_Fields(0x39FE001E); if(temp == null){ //403E = PR_OrgEmailAddr 001E for type PT_String8 temp = (String)addressEntry.get_Fields(0x403E001E); if(temp==null){ throw new Exceptions.MailAddressCouldNotExtractedException(a ddressEntry.Address); } } return temp; } In case of starting the application in normal way the shown code works. addressEntry.get_Fields(0x39FE001E) return the correct value. When handling the same mail by starting the app per sceduled task (same user performer) addressEntry.get_Fields(0x39FE001E) return null ! any idea? Thank you, Jan |
#4
|
|||
|
|||
![]()
Hi,
I tried the same thing with RDO as workaround. SMTPAddress of RDOAdressEntry works correctly, also within a scheduled task. jpfi |
#5
|
|||
|
|||
![]()
Note that the scheduler runs as a service, and no Office app should be used
in a service. Most likely Redemption cannot automatically pick up the MAPI session used by Outlook, you can help it by calling something like the following first : set Utils = CreateObject("Redemption.MAPIUtils") Utils.MAPIOBJECT = YourOutlookApp.Session.MAPIOBJECT 'your old Redemption code goes here. Thiswill ensure that Redemption caches teh MAPI session used by Outlook. Or use the RDO family of objects... Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "jpfi" wrote in message ups.com... Hi, I've written an console-application based on Redemption (http://www.dimastr.com/redemption/)). the following code tries to resolve the smtp-Address of the mailsender: if(addressEntry.Type.Equals("EX")){ //39FE = PR_SMTP_ADDRESS 001E for type PT_String8 String temp = (String)addressEntry.get_Fields(0x39FE001E); if(temp == null){ //403E = PR_OrgEmailAddr 001E for type PT_String8 temp = (String)addressEntry.get_Fields(0x403E001E); if(temp==null){ throw new Exceptions.MailAddressCouldNotExtractedException(a ddressEntry.Address); } } return temp; } In case of starting the application in normal way the shown code works. addressEntry.get_Fields(0x39FE001E) return the correct value. When handling the same mail by starting the app per sceduled task (same user performer) addressEntry.get_Fields(0x39FE001E) return null ! any idea? Thank you, Jan |
#6
|
|||
|
|||
![]()
Hi,
I've tried setting the MAPIOBJECT, but it doesn't work. but Application outLookApp = new Application(); Redemption.RDOSession session = (Redemption.RDOSession)outLookApp.CreateObject("Re demption.RDOSession"); session.MAPIOBJECT = outLookApp.Session.MAPIOBJECT; RDOAddressEntry entry = session.GetAddressEntryFromID(addressEntry.ID,null ); String smtp = entry.SMTPAddress; works in all cases. I still don't figure out why using the other code... @Dimitry: Thanks for your great Utilities. My company just purchased a license! Well done. cheers, jan Dmitry Streblechenko schrieb: Note that the scheduler runs as a service, and no Office app should be used in a service. Most likely Redemption cannot automatically pick up the MAPI session used by Outlook, you can help it by calling something like the following first : set Utils = CreateObject("Redemption.MAPIUtils") Utils.MAPIOBJECT = YourOutlookApp.Session.MAPIOBJECT 'your old Redemption code goes here. Thiswill ensure that Redemption caches teh MAPI session used by Outlook. Or use the RDO family of objects... Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "jpfi" wrote in message ups.com... Hi, I've written an console-application based on Redemption (http://www.dimastr.com/redemption/)). the following code tries to resolve the smtp-Address of the mailsender: if(addressEntry.Type.Equals("EX")){ //39FE = PR_SMTP_ADDRESS 001E for type PT_String8 String temp = (String)addressEntry.get_Fields(0x39FE001E); if(temp == null){ //403E = PR_OrgEmailAddr 001E for type PT_String8 temp = (String)addressEntry.get_Fields(0x403E001E); if(temp==null){ throw new Exceptions.MailAddressCouldNotExtractedException(a ddressEntry.Address); } } return temp; } In case of starting the application in normal way the shown code works. addressEntry.get_Fields(0x39FE001E) return the correct value. When handling the same mail by starting the app per sceduled task (same user performer) addressEntry.get_Fields(0x39FE001E) return null ! any idea? Thank you, Jan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
inconsistent in Redemption | Vadivel | Outlook and VBA | 10 | April 25th 06 06:12 PM |
show all recurrences of a task in the task list | dash | Outlook - Calandaring | 2 | April 15th 06 02:45 AM |
How do I drag a task in task list of Outlook. It will not let me. | rpetralia | Outlook - Calandaring | 2 | April 5th 06 10:14 AM |
Redemption | Christoph | Add-ins for Outlook | 5 | March 6th 06 03:26 PM |
Redemption MAPITable | Dmitry Streblechenko | Add-ins for Outlook | 1 | January 12th 06 04:09 AM |