Board index » delphi » MAPILogonEx in MS Exchange!
Bit
![]() Delphi Developer |
Bit
![]() Delphi Developer |
MAPILogonEx in MS Exchange!2003-09-27 09:20:14 PM delphi188 Hi people, How can logon my inbox without profile in MS Outlook, or either, direct in then Exchange? thx -- PAZ!! -=|ߡ?|=- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (www.grisoft.com). Version: 6.0.521 / Virus Database: 319 - Release Date: 23/9/2003 |
Dmitry Streblechenko
![]() Delphi Developer |
2003-09-29 06:14:19 AM
Re:MAPILogonEx in MS Exchange!
You need to create a temporary profile, populate its data with the name of
the server and mailbox, then use the name of the profile to call MAPILogonEx(). See Q170225 on MSDN. Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Bit" <XXXX@XXXXX.COM>writes QuoteHi people, |
Bit
![]() Delphi Developer |
2003-09-30 05:50:56 AM
Re:MAPILogonEx in MS Exchange!
thank you Dmitry!
The code below I not obtain to configure profile, wich the problem? function TCProfiles.ConfigureServerExchange(var pTree:TTreeView; hCurrentBranch:TTreeNode; pProfAdmin:IPROFADMIN; pszProfileName:PCHAR; psNomeServidor,psUsuario:String):HRESULT; var hr : HRESULT; pServices :IMsgServiceAdmin; pMTServices:IMAPITABLE; pProviderAdmin:IPROVIDERADMIN; hService:TTreeNode; ulRowCount, ulCount:ULONG; lpRows :PSRowSet; // Table lpRow :PSRow; // 1 row from table lpProp :PSPropValueArray; // 1 Prop (column) from row Columns:PSPropTagArray; pInfo : TCItemInfo; ppProfile:IOpenSectionHack; label ret; begin pServices:=nil; pMTServices:=nil; pProviderAdmin:=nil; ulRowCount:=0; lpRows :=nil; lpRow :=nil; Columns:=nil; hCurrentBranch.Selected:=True; hr:=MapiAllocateBuffer(Sizeof(TSPropTagArray)+Sizeof(ULONG)*2,Pointer(Column s)); if (FAILED(hr)) then begin EMAPILogger.LogMessage('MapiAllocateBuffer Failed!'); goto ret; end; Columns.cValues:=3; Columns.aulPropTag[Columns.cValues-3]:=PR_DISPLAY_NAME; Columns.aulPropTag[Columns.cValues-2]:=PR_SERVICE_NAME; Columns.aulPropTag[Columns.cValues-1]:=PR_INSTANCE_KEY; // Get a service admin interface hr := pProfAdmin.AdminServices(pszProfileName, // profile name nil, // no profile password ULONG(GetActiveWindow()), // parent wnd 0, // Allow UI pServices); // message service administration object pointer if(FAILED(hr)) then begin EMAPILogger.LogMessage('AdminServices Failed!'); goto ret; end; // Get a table of services in the provider. hr := pServices.GetMsgServiceTable(0, pMTServices); if(FAILED(hr)) then begin EMAPILogger.LogMessage('GetMsgServiceTable Failed!'); goto ret; end; hr := pMTServices.SetColumns(PSPropTagArray(Columns), 0); if(FAILED(hr)) then begin EMAPILogger.LogMessage('SetColumns Failed!'); goto ret; end; hr := pMTServices.GetRowCount(0, ulRowCount); if(FAILED(hr)) then begin EMAPILogger.LogMessage('GetRowCount Failed!'); goto ret; end; // Get all of the rows. hr := pMTServices.QueryRows(ulRowCount, 0, lpRows); if (FAILED(hr)) then begin EMAPILogger.LogMessage('QueryRows Failed!'); goto ret; end; MAPIAllocateBuffer(sizeof(TSPropValueArray)+sizeof(TSPropValue)*2,Pointer(lp Prop)); // Loop through all Services and get the providers for each lpProp[0].ulPropTag := PR_PROFILE_UNRESOLVED_SERVER; lpProp[0].Value.lpszA := PChar(psNomeServidor); lpProp[1].ulPropTag := PR_PROFILE_UNRESOLVED_NAME; lpProp[1].Value.lpszA := PChar(psUsuario); //THIS IS ROUTINE NOT CONFIGURE, ERROR!!! hr:= pServices.ConfigureMsgService(PMAPIUID(lpRow.lpProps[0].Value.bin.lpb),0,0,2 ,LPSPropValue(lpProp)); if FAILED(hr) then begin EMAPILogger.LogMessage('Configuracao do servidor Failed!'); goto ret; end; ret: if Assigned(lpRows) then FreeProws(lpRows); if Assigned(pMTServices) then pMTServices:=nil; if Assigned(pServices) then pServices:=nil; // Released in CItemInfo if Assigned(Columns) then MapiFreeBuffer(Columns); Result:=hr; end; "Dmitry Streblechenko" <XXXX@XXXXX.COM>escreveu na mensagem QuoteYou need to create a temporary profile, populate its data with the name of Checked by AVG anti-virus system (www.grisoft.com). Version: 6.0.522 / Virus Database: 320 - Release Date: 29/9/2003 |
Dmitry Streblechenko
![]() Delphi Developer |
2003-09-30 06:01:28 AM
Re:MAPILogonEx in MS Exchange!
What error do you get back?
Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Bit" <XXXX@XXXXX.COM>writes Quotethank you Dmitry! |
Bit
![]() Delphi Developer |
2003-09-30 08:13:35 PM
Re:MAPILogonEx in MS Exchange!
Acess Violation!!
I am wanting to configure profile with name of the server and the user without showing the box of I dialogue! hr:=pServices.ConfigureMsgService(PMAPIUID(lpRow.lpProps[0].Value.bin.lpb),0 ,0,2,LPSPropValue(lpProp)); Not configure!! thx -- PAZ!! -=|ߡ?|=- "Dmitry Streblechenko" <XXXX@XXXXX.COM>escreveu na mensagem QuoteWhat error do you get back? Checked by AVG anti-virus system (www.grisoft.com). Version: 6.0.522 / Virus Database: 320 - Release Date: 29/9/2003 |
Dmitry Streblechenko
![]() Delphi Developer |
2003-10-01 12:58:29 AM
Re:MAPILogonEx in MS Exchange!
I don't think lpRow is initialized, only lpRows is.
Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Bit" <XXXX@XXXXX.COM>writes QuoteAcess Violation!! |
Bit
![]() Delphi Developer |
2003-10-01 01:30:48 AM
Re:MAPILogonEx in MS Exchange!
Thank you!
I modified code, the error not occur but no arrives to configure the server and user name, what you the made a mistake one? hr:= pServices.ConfigureMsgService(PMAPIUID(lpRows.aRow[0].lpProps[0].value.bin.l pb),0,0,1,PSPropValue(lpProp)); -- PAZ!! -=|ߡ?|=- "Dmitry Streblechenko" <XXXX@XXXXX.COM>escreveu na mensagem QuoteI don't think lpRow is initialized, only lpRows is. and user name, what you the made a mistake one? hr:= pServices.ConfigureMsgService(PMAPIUID(lpRows.aRow[0].lpProps[0].value.bin.l pb),0,0,1,PSPropValue(lpProp)); -- PAZ!! -=|ߡ?|=- "Dmitry Streblechenko" <XXXX@XXXXX.COM>escreveu na mensagem QuoteI don't think lpRow is initialized, only lpRows is. |
Dmitry Streblechenko
![]() Delphi Developer |
2003-10-02 12:54:26 AM
Re:MAPILogonEx in MS Exchange!
I am not sure I understand. Why do you use 1 instead of 2? You need to pass
both the server name and the mailbox name. Dmitry Streblechenko (MVP) www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "Bit" <XXXX@XXXXX.COM>writes QuoteThank you! |