Re: Message stays in outbox
- From: "Iv. Kozhuharov" <imi@xxxxxxxxx>
- Date: Wed, 4 Jun 2008 13:09:38 +0300
And it fail also if you use:
toProps[0].ulPropTag = PR_DISPLAY_NAME;
toProps[0].Value.lpsz = "test@xxxxxxxxxxxxxx"; /* toAdd */
toProps[1].ulPropTag = PR_RECIPIENT_TYPE;
toProps[1].Value.l = MAPI_TO;
Very strange....
"Ashutosh Bhawasinka" <smbs-msdn@xxxxxxxxxxxxx> wrote in message
news:uyIpvMixIHA.420@xxxxxxxxxxxxxxxxxxxxxxx
| Hi Iv,
| I have tried that also :)
| No, I get S_OK for all other method/functions
|
| Thanks & Regards,
| Ashutosh Bhawasinka
|
|
|
| Iv. Kozhuharov wrote:
| > So, go thru whole thread, and see that you receive 0x80040103 for
| > ResolveName. Right?
| > Is your code work without errors, if you force resolving with ANSI
string
| > (Stephen hinting)?
| >
| > CHAR toAdd[] = "test@xxxxxxxxxxxxxx";
| > SPropValue toProps[2];
| >
| > toProps[0].ulPropTag = PR_DISPLAY_NAME_A;
| > toProps[0].Value.lpszA = toAdd;
| >
| >
| > Are you receive any warnings (not errors) when you call
OpenAddressBook???
| >
| >
| > "Ashutosh Bhawasinka" <smbs-msdn@xxxxxxxxxxxxx> wrote in message
| > news:OuFnfGhxIHA.704@xxxxxxxxxxxxxxxxxxxxxxx
| > | Hi Iv,
| > | Thanks for your comment. I would stick to the same COM/MAPI as this
code
| > | runs in a thread started by a thread running in C# application.
| > |
| > | About the address resolution, I have already tried that. :(
| > |
| > | Thanks & Regards,
| > | Ashutosh Bhawasinka
| > |
| > |
| > |
| > | Iv. Kozhuharov wrote:
| > | > Ashutosh,
| > | >
| > | > Can you do some modification inside your code?
| > | >
| > | > First of all, when you call MAPIInitialize, try to pass flag
| > | > MAPI_NO_COINIT - you already have COM initialization. MAPI, by
default,
| > will
| > | > try to initialize COM with a call to CoInitialize.
| > | > This initializes COM with a single threaded apartment model. If you
like
| > to
| > | > run it inside multithreaded model, call CoInitializeEx with the
| > | > COINIT_MULTITHREADED flag, and add MAPI_MULTITHREADED_NOTIFICATIONS
| > also.
| > | >
| > | > If a MAPIINIT_0 structure is passed into MAPIInitialize
| > | > with ulFlags set to MAPI_NO_COINIT, MAPI will assume that COM has
| > already
| > | > been initialized
| > | > and bypass the call to CoInitialize.:
| > | >
| > | > hRes = CoInitialize(0);
| > | > .....
| > | > hRes = MAPIInitialize(NULL);
| > | >
| > | > pseudo code
| > | >
| > | > MAPI_NO_COINIT = $00000008;
| > | >
| > | > MAPIINIT.ulVersion := MAPI_INIT_VERSION;
| > | > MAPIINIT.ulFlags := MAPI_NO_COINIT (* or MAPI_NT_SERVICE or
| > | > MAPI_MULTITHREADED_NOTIFICATIONS *) ;
| > | > hr := MapiInitialize( @MAPIINIT);
| > | >
| > | > Second:
| > | >
| > | > Remove (for tests only) flag AB_NO_DIALOG from
| > | > hRes = lpSession->OpenAddressBook
| > | >
| > | > then check hRes value from
| > | > hRes = pAddrBook->ResolveName(0, 0, 0, pAddressList);
| > | >
| > | >
| > | > Regards,
| > | > Iv
| > | >
| > | >
| > | > "Ashutosh Bhawasinka" <smbs-msdn@xxxxxxxxxxxxx> wrote in message
| > | > news:uH9Si7exIHA.2188@xxxxxxxxxxxxxxxxxxxxxxx
| > | > | Hi Stephen,
| > | > | Thanks for your reply. What you mentioned was the first place I
| > suspected.
| > | > | I had already tried what you just mentioned. Moreover, the project
I
| > am
| > | > | using has UNICODE defined and there is no way its going to run on
non
| > NT
| > | > | systems.
| > | > |
| > | > | To add to it, since UNICODE is always defined, PR_DISPLAY_NAME or
| > | > | PR_DISPLAY_NAME_W, both have the same value. Also, LPSZ is defined
as
| > | > | lpszW (when unicode).
| > | > |
| > | > | Secondly, weather UNICODE is used or not both lpszA or lpszW will
have
| > | > | the same effect because they are in a union and are pointer.
| > | > |
| > | > | So to summarize, even after this I am getting the same error. :(
| > | > |
| > | > | However, I checked the error codes at
| > | > | http://www.mapi33.adexsolutions.com/docs/MAPI33.Error.html
| > | > | which says that the error as/is
| > | > | BadCharWidth 0x80040103
| > | > |
| > | > | Any clue?? Can you please try to run this code?
| > | > |
| > | > | Regards,
| > | > | Ashutosh
| > | > |
| > | > | Stephen Griffin [MSFT] wrote:
| > | > | > This code:
| > | > | > WCHAR toAdd[]=L"test@xxxxxxxxxxxxxx";
| > | > | > SPropValue toProps[2];
| > | > | >
| > | > | > toProps[0].ulPropTag = PR_DISPLAY_NAME;
| > | > | > toProps[0].Value.LPSZ = toAdd;
| > | > | >
| > | > | > is broken if UNICODE isn't defined. You're using macros
| > (PR_DISPLAY_NAME
| > | > and
| > | > | > LPSZ) that mean one thing when UNICODE isn't defined and another
| > when it
| > | > is.
| > | > | > Without UNICODE, your code is equivalent to:
| > | > | >
| > | > | > WCHAR toAdd[]=L"test@xxxxxxxxxxxxxx";
| > | > | > SPropValue toProps[2];
| > | > | >
| > | > | > toProps[0].ulPropTag = PR_DISPLAY_NAME_A;
| > | > | > toProps[0].Value.lpszA = toAdd;
| > | > | >
| > | > | > Which is garbage code, since you're declaring that you have an
ANSI
| > | > string,
| > | > | > yet you pass a unicode buffer.
| > | > | >
| > | > | > Given that you're hard coding the buffer as Unicode, you should
also
| > | > | > hardcode the rest as unicode. The code should look like this:
| > | > | > WCHAR toAdd[]=L"test@xxxxxxxxxxxxxx";
| > | > | > SPropValue toProps[2];
| > | > | >
| > | > | > toProps[0].ulPropTag = PR_DISPLAY_NAME_W;
| > | > | > toProps[0].Value.lpszW = toAdd;
| > | > | >
| > | > | > You make this same error many places in the code.
| > | > | >
| > | > | > "Ashutosh Bhawasinka" <smbs-msdn@xxxxxxxxxxxxx> wrote in message
| > From: "Iv. Kozhuharov" <imi@xxxxxxxxx>
| > References: <u#fp6vMxIHA.3336@xxxxxxxxxxxxxxxxxxxx>
<OBnCn7MxIHA.4864@xxxxxxxxxxxxxxxxxxxx>
<O61SGNNxIHA.1240@xxxxxxxxxxxxxxxxxxxx>
<uf#0P5OxIHA.420@xxxxxxxxxxxxxxxxxxxx>
<ewFyufUxIHA.3336@xxxxxxxxxxxxxxxxxxxx>
<u4wVhkXxIHA.2340@xxxxxxxxxxxxxxxxxxxx>
<uTCxlwXxIHA.4564@xxxxxxxxxxxxxxxxxxxx>
<OJbz8McxIHA.4848@xxxxxxxxxxxxxxxxxxxx>
<uH9Si7exIHA.2188@xxxxxxxxxxxxxxxxxxxx>
<eBm2M3gxIHA.524@xxxxxxxxxxxxxxxxxxxx>
<OuFnfGhxIHA.704@xxxxxxxxxxxxxxxxxxxx>
| > Subject: Re: Message stays in outbox
| > Date: Wed, 4 Jun 2008 11:01:59 +0300
| > Lines: 211
| > Organization: IMI
| > X-Priority: 3
| > X-MSMail-Priority: Normal
| > X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
| > X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
| > X-Antivirus: avast! (VPS 080602-0, 02.06.2008), Outbound message
| > X-Antivirus-Status: Clean
| > Message-ID: <OvECHlhxIHA.1980@xxxxxxxxxxxxxxxxxxxx>
| > Newsgroups: microsoft.public.win32.programmer.messaging
| > NNTP-Posting-Host: gprs-nat.mtel.net 213.226.53.254
| > Path: TK2MSFTNGP01.phx.gbl!TK2MSFTNGP02.phx.gbl
| > Xref: TK2MSFTNGP01.phx.gbl
microsoft.public.win32.programmer.messaging:32162
| >
| > So, go thru whole thread, and see that you receive 0x80040103 for
| > ResolveName. Right?
| > Is your code work without errors, if you force resolving with ANSI
string
| > (Stephen hinting)?
| >
| > CHAR toAdd[] = "test@xxxxxxxxxxxxxx";
| > SPropValue toProps[2];
| >
| > toProps[0].ulPropTag = PR_DISPLAY_NAME_A;
| > toProps[0].Value.lpszA = toAdd;
| >
| >
| > Are you receive any warnings (not errors) when you call
OpenAddressBook???
| >
| >
| > "Ashutosh Bhawasinka" <smbs-msdn@xxxxxxxxxxxxx> wrote in message
| > news:OuFnfGhxIHA.704@xxxxxxxxxxxxxxxxxxxxxxx
| > | Hi Iv,
| > | Thanks for your comment. I would stick to the same COM/MAPI as this
code
| > | runs in a thread started by a thread running in C# application.
| > |
| > | About the address resolution, I have already tried that. :(
| > |
| > | Thanks & Regards,
| > | Ashutosh Bhawasinka
| > |
| > |
| > |
| > | Iv. Kozhuharov wrote:
| > | > Ashutosh,
| > | >
| > | > Can you do some modification inside your code?
| > | >
| > | > First of all, when you call MAPIInitialize, try to pass flag
| > | > MAPI_NO_COINIT - you already have COM initialization. MAPI, by
default,
| > will
| > | > try to initialize COM with a call to CoInitialize.
| > | > This initializes COM with a single threaded apartment model. If you
like
| > to
| > | > run it inside multithreaded model, call CoInitializeEx with the
| > | > COINIT_MULTITHREADED flag, and add MAPI_MULTITHREADED_NOTIFICATIONS
| > also.
| > | >
| > | > If a MAPIINIT_0 structure is passed into MAPIInitialize
| > | > with ulFlags set to MAPI_NO_COINIT, MAPI will assume that COM has
| > already
| > | > been initialized
| > | > and bypass the call to CoInitialize.:
| > | >
| > | > hRes = CoInitialize(0);
| > | > .....
| > | > hRes = MAPIInitialize(NULL);
| > | >
| > | > pseudo code
| > | >
| > | > MAPI_NO_COINIT = $00000008;
| > | >
| > | > MAPIINIT.ulVersion := MAPI_INIT_VERSION;
| > | > MAPIINIT.ulFlags := MAPI_NO_COINIT (* or MAPI_NT_SERVICE or
| > | > MAPI_MULTITHREADED_NOTIFICATIONS *) ;
| > | > hr := MapiInitialize( @MAPIINIT);
| > | >
| > | > Second:
| > | >
| > | > Remove (for tests only) flag AB_NO_DIALOG from
| > | > hRes = lpSession->OpenAddressBook
| > | >
| > | > then check hRes value from
| > | > hRes = pAddrBook->ResolveName(0, 0, 0, pAddressList);
| > | >
| > | >
| > | > Regards,
| > | > Iv
| > | >
| > | >
| > | > "Ashutosh Bhawasinka" <smbs-msdn@xxxxxxxxxxxxx> wrote in message
| > | > news:uH9Si7exIHA.2188@xxxxxxxxxxxxxxxxxxxxxxx
| > | > | Hi Stephen,
| > | > | Thanks for your reply. What you mentioned was the first place I
| > suspected.
| > | > | I had already tried what you just mentioned. Moreover, the project
I
| > am
| > | > | using has UNICODE defined and there is no way its going to run on
non
| > NT
| > | > | systems.
| > | > |
| > | > | To add to it, since UNICODE is always defined, PR_DISPLAY_NAME or
| > | > | PR_DISPLAY_NAME_W, both have the same value. Also, LPSZ is defined
as
| > | > | lpszW (when unicode).
| > | > |
| > | > | Secondly, weather UNICODE is used or not both lpszA or lpszW will
have
| > | > | the same effect because they are in a union and are pointer.
| > | > |
| > | > | So to summarize, even after this I am getting the same error. :(
| > | > |
| > | > | However, I checked the error codes at
| > | > | http://www.mapi33.adexsolutions.com/docs/MAPI33.Error.html
| > | > | which says that the error as/is
| > | > | BadCharWidth 0x80040103
| > | > |
| > | > | Any clue?? Can you please try to run this code?
| > | > |
| > | > | Regards,
| > | > | Ashutosh
| > | > |
| > | > | Stephen Griffin [MSFT] wrote:
| > | > | > This code:
| > | > | > WCHAR toAdd[]=L"test@xxxxxxxxxxxxxx";
| > | > | > SPropValue toProps[2];
| > | > | >
| > | > | > toProps[0].ulPropTag = PR_DISPLAY_NAME;
| > | > | > toProps[0].Value.LPSZ = toAdd;
| > | > | >
| > | > | > is broken if UNICODE isn't defined. You're using macros
| > (PR_DISPLAY_NAME
| > | > and
| > | > | > LPSZ) that mean one thing when UNICODE isn't defined and another
| > when it
| > | > is.
| > | > | > Without UNICODE, your code is equivalent to:
| > | > | >
| > | > | > WCHAR toAdd[]=L"test@xxxxxxxxxxxxxx";
| > | > | > SPropValue toProps[2];
| > | > | >
| > | > | > toProps[0].ulPropTag = PR_DISPLAY_NAME_A;
| > | > | > toProps[0].Value.lpszA = toAdd;
| > | > | >
| > | > | > Which is garbage code, since you're declaring that you have an
ANSI
| > | > string,
| > | > | > yet you pass a unicode buffer.
| > | > | >
| > | > | > Given that you're hard coding the buffer as Unicode, you should
also
| > | > | > hardcode the rest as unicode. The code should look like this:
| > | > | > WCHAR toAdd[]=L"test@xxxxxxxxxxxxxx";
| > | > | > SPropValue toProps[2];
| > | > | >
| > | > | > toProps[0].ulPropTag = PR_DISPLAY_NAME_W;
| > | > | > toProps[0].Value.lpszW = toAdd;
| > | > | >
| > | > | > You make this same error many places in the code.
| > | > | >
| > | > | > "Ashutosh Bhawasinka" <smbs-msdn@xxxxxxxxxxxxx> wrote in message
| > | > | > news:uTCxlwXxIHA.4564@xxxxxxxxxxxxxxxxxxxxxxx
| > | > | >> There is however one difference when the same code used to run
over
| > a
| > | > year
| > | > | >> back (it was just a test code). Earlier I used only ANSI
strings
| > and
| > | > now I
| > | > | >> am using Unicode strings.
| > | > | >>
| > | > | >> Stephen Griffin [MSFT] wrote:
| > | > | >>> Ok - forget about submitting the message - that's not going to
| > work
| > | > until
| > | > | >>> you fix the issue with ResolveName. Until ResolveName is
working,
| > the
| > | > | >>> message isn't addressed, and there's no chance it could be
sent.
| > | > | >>>
| > | > | >>> So - what are you passing into ResolveName? What is
pAddressList?
| > Can
| > | > you
| > | > | >>> show the code that builds it?
| > | > | >>>
| > | > | >>> Steve
| > | > | >>>
| > | > | >>> "Ashutosh Bhawasinka" <smbs-msdn@xxxxxxxxxxxxx> wrote in
message
| > | > | >>> news:ewFyufUxIHA.3336@xxxxxxxxxxxxxxxxxxxxxxx
| > | > | >>>> Hi,
| > | > | >>>> I checked
| > | > | >>>> 1) with a profile having only a exchange account (NOT in
cached
| > mode)
| > | > | >>>> - The message is NOT italicized in the outbox.
| > | > | >>>> - When submitting message the return code was E_FAIL
| > | > | >>>> 2) with a profile having Just a POP account(s)/pst
| > | > | >>>> - The message is italicized
| > | > | >>>> - Submit message succeeds but it remains in outbox
| > | > | >>>>
| > | > | >>>> hRes = pAddrBook->ResolveName(0, 0, 0, pAddressList);
| > | > | >>>> always fails
| > | > | >>>>
| > | > | >>>> I even changed
| > | > | >>>> hRes = pMsg->SaveChanges(KEEP_OPEN_READWRITE)
| > | > | >>>> pMsg->SubmitMessage(FORCE_SUBMIT )
| > | > | >>>>
| > | > | >>>> to
| > | > | >>>> hRes = pMsg->SaveChanges(0)
| > | > | >>>> pMsg->SubmitMessage(0 )
| > | > | >>>>
| > | > | >>>> Even then the same result.
| > | > | >>>>
| > | > | >>>> Regards,
| > | > | >>>> Ashutosh
| > | > | >>>>
| > | > | >>>>
| > | > | >>>> Dmitry Streblechenko wrote:
| > | > | >>>>> Does it work if you switch profile to using the online mode
| > (uncheck
| > | > | >>>>> the "use cached mode" checkbox)?
| > | > | >>>>>
| > | > | >>>
| > | > | >>
| > | > | >> --
| > | > | >> Ashutosh Bhawasinka
| > | > | >> email:expert@xxxxxxxxxxx
| > | > | >
| > | > | >
| > | >
| > | >
| >
| >
.
- References:
- Message stays in outbox
- From: Ashutosh Bhawasinka
- Re: Message stays in outbox
- From: Dmitry Streblechenko
- Re: Message stays in outbox
- From: Ashutosh Bhawasinka
- Re: Message stays in outbox
- From: Dmitry Streblechenko
- Re: Message stays in outbox
- From: Ashutosh Bhawasinka
- Re: Message stays in outbox
- From: Stephen Griffin [MSFT]
- Re: Message stays in outbox
- From: Ashutosh Bhawasinka
- Re: Message stays in outbox
- From: Stephen Griffin [MSFT]
- Re: Message stays in outbox
- From: Ashutosh Bhawasinka
- Re: Message stays in outbox
- From: Iv. Kozhuharov
- Re: Message stays in outbox
- From: Ashutosh Bhawasinka
- Re: Message stays in outbox
- From: Iv. Kozhuharov
- Re: Message stays in outbox
- From: Ashutosh Bhawasinka
- Message stays in outbox
- Prev by Date: Re: Message stays in outbox
- Next by Date: Re: Preview Window not displaying in Outlook 2003
- Previous by thread: Re: Message stays in outbox
- Next by thread: Re: Message stays in outbox
- Index(es):
Relevant Pages
|