From the MAPISVC.inf file which is found on all client machines,
Here are the services available
[Services]
MSPST MS=Outlook 97-2002 Personal Folders File (.pst)
MSUPST MS=Office Outlook Personal Folders File (.pst)
I tried using the IMsgServiceAdmin::CreateMsgService using “MSUPST MS” as
the type of message service. And then IMsgServiceAdmin::ConfigureMsgService
setting Properties like PR_DISPLAY_NAME, PR_PST_PATH, PR_PST_ENCRYPTION
(IMsgServiceAdmin Obtained from IProfAdmin)
What i end up with is still a Outlook 97-2002 Personal Folders File (.pst)
file.
Any Suggestions.
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Sandeep" <San...@discussions.microsoft.com> wrote in message
news:B20F01C1-0CD5-44D2...@microsoft.com...
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Sandeep" <San...@discussions.microsoft.com> wrote in message
news:68035021-CD89-43AB...@microsoft.com...
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Sandeep" <San...@discussions.microsoft.com> wrote in message
news:70E3BCF1-6BCE-4D85...@microsoft.com...
RESULT CProfHelper::FinalConstruct()
{
LONG lRet;
DWORD dwRet;
HRESULT hr;
m_bMAPI = FALSE;
hr = MAPIInitialize(NULL);
if (S_OK == hr)
{
hr = MAPIAdminProfiles(0, &m_pProfAdmin);
}
return hr;
}
Parameters = "Test Profile", "MSUPST MS", "My PST File"
STDMETHODIMP CProfHelper::AddMessageService(BSTR ProfileName,
BSTR MsgServiceName,
BSTR MsgServiceDispName,
LONG* lRet)
{
CComPtr<IMsgServiceAdmin> pMsgSvcAdmin;
_bstr_t bstrPN;
_bstr_t bstrSN;
_bstr_t bstrDN;
ULONG ulFlags;
HRESULT hr;
if( IsBadWritePtr(lRet, sizeof(LONG)) )
{
hr = E_INVALIDARG;
}
else
{
ulFlags = 0;
ulFlags |= fMapiUnicode;
bstrPN = ProfileName;
hr = m_pProfAdmin->AdminServices((TCHAR*)bstrPN, NULL, NULL, ulFlags,
&pMsgSvcAdmin);
if(S_OK == hr)
{
bstrSN = MsgServiceName;
bstrDN = MsgServiceDispName;
hr = pMsgSvcAdmin->CreateMsgService((TCHAR*)bstrSN, (TCHAR*)bstrDN, NULL,
ulFlags);
}
}
*lRet = ResultCode(hr);
if (*lRet)
{
hr = RaiseException(*lRet);
}
return hr;
}
Parameters = "Test Profile", "MSUPST MS", "My PST File", "C:\TestMy.pst",
"Comment", NULL, NULL, FALSE, 0x80000000, 0
STDMETHODIMP CProfHelper::ConfigMSPSTMS(BSTR ProfileName,
BSTR MsgServiceName,
BSTR MsgServiceDisplayName,
BSTR Path,
BSTR Comment,
BSTR Password,
BSTR NewPassword,
VARIANT_BOOL RememberPwd,
LONG Encryption,
ULONG WindowHandle,
LONG* lRet)
{
CComPtr<IMsgServiceAdmin> pMsgSvcAdmin;
CComPtr<IMAPITable> pMsgSvcTable;
_bstr_t bstrPN;
_bstr_t bstrDN;
_bstr_t bstrPT;
_bstr_t bstrC;
_bstr_t bstrOP;
_bstr_t bstrNP;
LPSRowSet pRows;
ULONG ulFlags;
UINT idx;
SPropValue spv[7];
HRESULT hr;
if( IsBadWritePtr(lRet, sizeof(LONG)) )
{
hr = E_INVALIDARG;
}
else
{
ulFlags = 0;
ulFlags |= fMapiUnicode;
bstrPN = ProfileName;
hr = m_pProfAdmin->AdminServices((TCHAR*)bstrPN, NULL, NULL, ulFlags,
&pMsgSvcAdmin);
if (S_OK == hr)
{
hr = pMsgSvcAdmin->GetMsgServiceTable(ulFlags, &pMsgSvcTable);
if (S_OK == hr)
{
pRows = NULL;
hr = GetMAPITableRowSet(pMsgSvcTable, MsgServiceName, PR_SERVICE_NAME,
&pRows);
if (S_OK == hr)
{
if (WindowHandle)
ulFlags |= SERVICE_UI_ALWAYS;
for (int i=0; i < 7; i++)
ZeroMemory(&spv[i], sizeof(SPropValue));
bstrDN = MsgServiceDisplayName;
idx = 0;
spv[idx].ulPropTag = PR_DISPLAY_NAME;
if (fMapiUnicode)
spv[idx].Value.lpszW = (wchar_t*)bstrDN;
else
spv[idx].Value.lpszA = (char*)bstrDN;
bstrPT = Path;
idx++;
spv[idx].ulPropTag = PR_PST_PATH;
if (fMapiUnicode)
spv[idx].Value.lpszW = (wchar_t*)bstrPT;
else
spv[idx].Value.lpszA = (char*)bstrPT;
STORE_UNICODE_OK
bstrC = Comment;
idx++;
spv[idx].ulPropTag = PR_COMMENT;
if (fMapiUnicode)
spv[idx].Value.lpszW = (wchar_t*)bstrC;
else
spv[idx].Value.lpszA = (char*)bstrC;
bstrOP = Password;
idx++;
spv[idx].ulPropTag = PR_PST_PW_SZ_OLD;
if (fMapiUnicode)
spv[idx].Value.lpszW = (wchar_t*)bstrOP;
else
spv[idx].Value.lpszA = (char*)bstrOP;
bstrNP = NewPassword;
idx++;
spv[idx].ulPropTag = PR_PST_PW_SZ_NEW;
if (fMapiUnicode)
spv[idx].Value.lpszW = (wchar_t*)bstrNP;
else
spv[idx].Value.lpszA = (char*)bstrNP;
idx++;
spv[idx].ulPropTag = PR_PST_REMEMBER_PW;
spv[idx].Value.b = RememberPwd;
idx++;
spv[idx].ulPropTag = PR_PST_ENCRYPTION;
spv[idx].Value.l = Encryption;
idx++;
PR_STORE_SUPPORT_MASK
hr =
pMsgSvcAdmin->ConfigureMsgService((LPMAPIUID)(pRows->aRow->lpProps->Value.bin.lpb),
WindowHandle, ulFlags, idx, spv);
FreeProws(pRows);
}
}
}
}
*lRet = ResultCode(hr);
if (*lRet)
{
hr = RaiseException(*lRet);
}
return hr;
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Sandeep" <San...@discussions.microsoft.com> wrote in message
news:99246928-2624-4C08...@microsoft.com...
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Sandeep" <San...@discussions.microsoft.com> wrote in message
news:3BB07124-11E0-45B3...@microsoft.com...
OR
You should always delete all PSTs in your Profile for this code to work
properly.
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Anay Kulkarni" <bi...@windows.com> wrote in message news:...
> Message-ID: <981d55ddd11f46d3...@newspe.com>
> X-Mailer: http://www.umailcampaign.com, ip log:121.242.40.21
> Newsgroups: microsoft.public.win32.programmer.messaging
> NNTP-Posting-Host: 22.bb.5446.static.theplanet.com 70.84.187.34
> Path: TK2MSFTNGP01.phx.gbl!TK2MSFTNGP04.phx.gbl!newspe.com
> Lines: 1
> Xref: TK2MSFTNGP01.phx.gbl
> microsoft.public.win32.programmer.messaging:34287
We greatly appreciate your knowledge and the will to share it so freely with
others..
"Dmitry Streblechenko" wrote:
> .
>