<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>解惑 &#187; program</title>
	<atom:link href="http://www.jiehoo.me/tag/program/feed" rel="self" type="application/rss+xml" />
	<link>http://www.jiehoo.me</link>
	<description>解己之惑，解人之惑</description>
	<lastBuildDate>Thu, 02 Sep 2010 03:29:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>用代码创建MAPI的Profile</title>
		<link>http://www.jiehoo.me/create-mapi-profile-programmatically.htm</link>
		<comments>http://www.jiehoo.me/create-mapi-profile-programmatically.htm#comments</comments>
		<pubDate>Mon, 31 Aug 2009 09:30:59 +0000</pubDate>
		<dc:creator>Cherami</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[MAPI]]></category>
		<category><![CDATA[profile]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://www.jiehoo.com/create-mapi-profile-programmatically.htm</guid>
		<description><![CDATA[这个问题曾经折磨了我好几天，最终放弃了。 最后在其他同事的不懈努力下最终解决： extern &#34;C&#34; __declspec(dllexport) bool CreateProfileWithIProfAdmin( LPTSTR szProfile,LPTSTR szMailbox,LPTSTR szServer) { &#160;&#160;&#160; HRESULT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hr = S_OK;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Result from MAPI calls. &#160;&#160;&#160; LPPROFADMIN&#160;&#160;&#160;&#160; lpProfAdmin = NULL;&#160;&#160;&#160;&#160; // Profile Admin object. &#160;&#160;&#160; LPSERVICEADMIN&#160; lpSvcAdmin = NULL;&#160;&#160;&#160;&#160;&#160; // Service Admin object. &#160;&#160;&#160; LPMAPITABLE&#160;&#160;&#160;&#160; lpMsgSvcTable = NULL;&#160;&#160; // Table to hold services. &#160;&#160;&#160; LPSRowSet&#160;&#160;&#160;&#160;&#160;&#160; lpSvcRows = NULL;&#160;&#160;&#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p class='fp'>这个问题曾经折磨了我好几天，最终放弃了。<br />
最后在其他同事的不懈努力下最终解决：</p>
<p>extern &quot;C&quot; __declspec(dllexport) bool CreateProfileWithIProfAdmin( LPTSTR szProfile,LPTSTR szMailbox,LPTSTR szServer)<br />
{<br />
&nbsp;&nbsp;&nbsp; HRESULT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr = S_OK;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Result from MAPI calls.<br />
&nbsp;&nbsp;&nbsp; LPPROFADMIN&nbsp;&nbsp;&nbsp;&nbsp; lpProfAdmin = NULL;&nbsp;&nbsp;&nbsp;&nbsp; // Profile Admin object.<br />
&nbsp;&nbsp;&nbsp; LPSERVICEADMIN&nbsp; lpSvcAdmin = NULL;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Service Admin object.<br />
&nbsp;&nbsp;&nbsp; LPMAPITABLE&nbsp;&nbsp;&nbsp;&nbsp; lpMsgSvcTable = NULL;&nbsp;&nbsp; // Table to hold services.<br />
&nbsp;&nbsp;&nbsp; LPSRowSet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lpSvcRows = NULL;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Rowset to hold results of table query.<br />
&nbsp;&nbsp;&nbsp; SPropValue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rgval[2];&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Property structure to hold values we want to set.<br />
&nbsp;&nbsp;&nbsp; SRestriction&nbsp;&nbsp;&nbsp; sres;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Restriction structure.<br />
&nbsp;&nbsp;&nbsp; SPropValue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SvcProps;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Property structure for restriction.</p>
<p>&nbsp;&nbsp;&nbsp; // This indicates columns we want returned from HrQueryAllRows.<br />
&nbsp;&nbsp;&nbsp; enum {iSvcName, iSvcUID, cptaSvc};<br />
&nbsp;&nbsp;&nbsp; SizedSPropTagArray(cptaSvc,sptCols) = { cptaSvc, PR_SERVICE_NAME, PR_SERVICE_UID };</p>
<p><span id="more-795"></span> &nbsp;&nbsp;&nbsp; try<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Initialize MAPI.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (FAILED(hr = MAPIInitialize(NULL)))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outputResult(&quot;MAPIInitialize&quot;,hr);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw -1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(DoesProfileExist(szProfile))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cout&lt;&lt;&quot;Profile Existed&quot;&lt;&lt;endl;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return TRUE;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Get an IProfAdmin interface.</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (FAILED(hr = MAPIAdminProfiles(0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Flags.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;lpProfAdmin))) // Pointer to new IProfAdmin.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outputResult(&quot;MAPIAdminProfiles&quot;,hr);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw -1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Create a new profile.</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (FAILED(hr = lpProfAdmin-&gt;CreateProfile(szProfile,&nbsp;&nbsp;&nbsp;&nbsp; // Name of new profile.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Password for profile.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Handle to parent window.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL)))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Flags.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outputResult(&quot;CreateProfile&quot;,hr);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw -1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Get an IMsgServiceAdmin interface off of the IProfAdmin interface.</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (FAILED(hr = lpProfAdmin-&gt;AdminServices(szProfile,&nbsp;&nbsp;&nbsp;&nbsp; // Profile that we want to modify.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Password for that profile.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Handle to parent window.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Flags.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;lpSvcAdmin))) // Pointer to new IMsgServiceAdmin.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outputResult(&quot;AdminServices&quot;,hr);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw -1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Create the new message service for Exchange.</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (FAILED(hr = lpSvcAdmin-&gt;CreateMsgService(&quot;MSEMS&quot;,&nbsp;&nbsp;&nbsp;&nbsp; // Name of service from MAPISVC.INF.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Display name of service.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Handle to parent window.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL)))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Flags.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outputResult(&quot;CreateMsgService&quot;,hr);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw -1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // You now have to obtain the entry id for the new service.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // You can do this by getting the message service table<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // and getting the entry that corresponds to the new service.</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (FAILED(hr = lpSvcAdmin-&gt;GetMsgServiceTable(0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Flags.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;lpMsgSvcTable)))&nbsp; // Pointer to table.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outputResult(&quot;GetMsgServiceTable&quot;,hr);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw -1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Set up restriction to query table.</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sres.rt = RES_CONTENT;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sres.res.resContent.ulFuzzyLevel = FL_FULLSTRING;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sres.res.resContent.ulPropTag = PR_SERVICE_NAME;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sres.res.resContent.lpProp = &amp;SvcProps;</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SvcProps.ulPropTag = PR_SERVICE_NAME;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SvcProps.Value.lpszA = &quot;MSEMS&quot;;</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Query the table to obtain the entry for the newly created message service.</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (FAILED(hr = HrQueryAllRows(lpMsgSvcTable,<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (LPSPropTagArray)&amp;sptCols,<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;sres,<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0,<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &amp;lpSvcRows)))<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outputResult(&quot;HrQueryAllRows&quot;,hr);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw -1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Set up a SPropValue array for the properties that you have to configure.<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // First, the server name.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ZeroMemory(&amp;rgval[1], sizeof(SPropValue) );<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rgval[1].ulPropTag = PR_PROFILE_UNRESOLVED_SERVER;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rgval[1].Value.lpszA = szServer;</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Next, the mailbox name.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ZeroMemory(&amp;rgval[0], sizeof(SPropValue) );<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rgval[0].ulPropTag = PR_PROFILE_UNRESOLVED_NAME; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rgval[0].Value.lpszA = szMailbox;</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Configure the message service by using the previous properties.<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (FAILED(hr = lpSvcAdmin-&gt;ConfigureMsgService(<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (LPMAPIUID)lpSvcRows-&gt;aRow-&gt;lpProps[iSvcUID].Value.bin.lpb, // Entry ID of service to configure.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NULL,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Handle to parent window.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Flags.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 2,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Number of properties we are setting.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; rgval)))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Pointer to SPropValue array.<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; outputResult(&quot;ConfigureMsgService&quot;,hr);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw -1;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; catch(&#8230;)<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (lpSvcRows) FreeProws(lpSvcRows);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (lpMsgSvcTable) lpMsgSvcTable-&gt;Release();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (lpSvcAdmin) lpSvcAdmin-&gt;Release();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (lpProfAdmin) lpProfAdmin-&gt;Release();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; MAPIUninitialize();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return FALSE;<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; if (lpSvcRows) FreeProws(lpSvcRows);<br />
&nbsp;&nbsp;&nbsp; if (lpMsgSvcTable) lpMsgSvcTable-&gt;Release();<br />
&nbsp;&nbsp;&nbsp; if (lpSvcAdmin) lpSvcAdmin-&gt;Release();<br />
&nbsp;&nbsp;&nbsp; if (lpProfAdmin) lpProfAdmin-&gt;Release();<br />
&nbsp;&nbsp;&nbsp; MAPIUninitialize();</p>
<p>&nbsp;&nbsp;&nbsp; return TRUE;</p>
<p>}</p>
<p>需要的参数比较简单，就是profile的名字，mailbox的名字和exchange server的地址。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jiehoo.me/create-mapi-profile-programmatically.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
