This is a multi-part message in MIME format.
------=_NextPart_000_0025_01C8C017.664A5F30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have developed an outlook 2003 professional addin.=20
I used the code below to add a named property to an outlook mail item, =
with the magic guid {00020386-0000-0000-C000-000000000046}=20
I was under the impression that named properties (with that guid) were =
added the the trans****t header whent he email was sent. Is this correct =
??
If not how do i add custom Trans****t/internet headers to exchange mail =
messages. The email will never go throught the internet i want to move =
mail from one exchange box to another and keep the headers and then add =
some custom headers. =20
object currentItem =3D null;
Outlook._MailItem _mail =3D null;
Outlook._NameSpace ns =3D null;
string entryID =3D null;
currentItem =3D mail;
_mail =3D currentItem as Outlook._MailItem;
if (_mail =3D=3D null) return;
//add named property
ns =3D OutlookApp.GetNamespace("MAPI");
entryID =3D _mail.EntryID;
AddNamedProperty(entryID, "X-Aplitrak-Responding-Board-Name:", "Here is =
the City");
_mail.To =3D "dereke@[EMAIL PROTECTED]
";
_mail.Save();
_mail.Send();
-------------------------------------------------Addnamed property =
method-----------------------------
public bool AddNamedProperty(string entryID, string propertyName, string =
_value)
{
object obj =3D null;
bool retVal =3D false;
IMAPIProp mail =3D null;
Outlook._NameSpace ns =3D null;
Outlook._MailItem mailObj =3D null;
try
{
ns =3D OutlookApp.GetNamespace("MAPI");
obj =3D ns.GetItemFromID(entryID, Type.Missing);
if (obj is Outlook.MailItem)
{
mailObj =3D obj as Outlook.MailItem;
try
{
mail =3D mailObj.MAPIOBJECT as IMAPIProp;
if (mail !=3D null)
{
IntPtr p =3D IntPtr.Zero;
IntPtr lpszStr =3D IntPtr.Zero;
IntPtr propTags =3D IntPtr.Zero;
IntPtr lpszValue =3D IntPtr.Zero;
IntPtr lpProblems =3D IntPtr.Zero;
IntPtr lpPropValue =3D IntPtr.Zero;
IntPtr _mapiNameID =3D IntPtr.Zero;
SPropValue propValue =3D new SPropValue();
MAPINAMEID mapiNameID =3D new MAPINAMEID();
try
{
Guid g =3D new Guid(magicGUID);
_mapiNameID =3D =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(MAPINAMEID)));
p =3D Marshal.AllocHGlobal(Marshal.SizeOf(g));
Marshal.StructureToPtr(g, p, false);
mapiNameID.lpguid =3D p;
mapiNameID.ulKind =3D 1;
lpszStr =3D Marshal.StringToHGlobalUni(propertyName);
mapiNameID.lpwstrName =3D lpszStr;
Marshal.StructureToPtr(mapiNameID, _mapiNameID, false);
if (mail.GetIDsFromNames(1, ref _mapiNameID, 0x00000002, out propTags) =
=3D=3D MAPI.S_OK)
{
int count =3D Marshal.ReadInt32(propTags);
if (count =3D=3D 1)
{
uint tag =3D (uint)Marshal.ReadInt32(new IntPtr(propTags.ToInt32() + =
4));
tag =3D (tag | MAPI.PT_STRING8);
lpPropValue =3D =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SPropValue)));
propValue.ulPropTag =3D tag;
propValue.dwAlignPad =3D 0;
lpszValue =3D Marshal.StringToHGlobalAnsi(_value);
propValue.Value =3D lpszValue.ToInt64();
Marshal.StructureToPtr(propValue, lpPropValue, false);
if (mail.SetProps(1, lpPropValue, out lpProblems) =3D=3D MAPI.S_OK)
{
if (mail.SaveChanges(0x00000004) =3D=3D MAPI.S_OK)
{
retVal =3D true;
}
}
}
}
}
finally
{
if (lpszValue !=3D IntPtr.Zero)
Marshal.FreeHGlobal(lpszValue);
if (lpPropValue !=3D IntPtr.Zero)
Marshal.DestroyStructure(lpPropValue, typeof(SPropValue));
if (propTags !=3D IntPtr.Zero)
MAPI.MAPIFreeBuffer(propTags);
if (p !=3D IntPtr.Zero)
Marshal.DestroyStructure(p, typeof(Guid));
if (lpszStr !=3D IntPtr.Zero)
Marshal.FreeHGlobal(lpszStr);
if (_mapiNameID !=3D IntPtr.Zero)
Marshal.DestroyStructure(_mapiNameID, typeof(MAPINAMEID));
}
}
}
finally
{
if (mail !=3D null)
Marshal.ReleaseComObject(mail);
}
}
}
catch
{
}
finally
{
if (obj !=3D null)
Marshal.ReleaseComObject(obj);
if (ns !=3D null)
Marshal.ReleaseComObject(ns);
}
return retVal;
}
------=_NextPart_000_0025_01C8C017.664A5F30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.6000.16640" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT color=3D#0000ff size=3D2>
<P><FONT face=3DArial color=3D#000000>I have developed an outlook 2003 =
professional=20
addin. </FONT></P>
<P><FONT face=3DArial color=3D#000000>I used the code below to add a =
named property=20
to an outlook mail item, with the magic guid {<FONT color=3D#800000=20
size=3D2>00020386-0000-0000-C000-000000000046</FONT>} </FONT></P>
<P><FONT face=3DArial color=3D#000000>I was under the impression that =
named=20
properties (with that guid) were added the the trans****t header whent he =
email=20
was sent. Is this correct ??<BR><BR>If not how do i add custom=20
Trans****t/internet headers to exchange mail messages. The email =
will never=20
go throught the internet i want to move mail from one exchange box to =
another=20
and keep the headers and then add some custom =
headers. </FONT></P>
<P><FONT face=3DArial color=3D#000000></FONT> </P>
<P><FONT face=3DArial>object</FONT></FONT><FONT face=3DArial><FONT =
size=3D2>=20
currentItem =3D </FONT><FONT color=3D#0000ff size=3D2>null</FONT><FONT=20
size=3D2>;</FONT></FONT></P>
<P><FONT face=3DArial><FONT size=3D2>Outlook.</FONT><FONT =
color=3D#008080=20
size=3D2>_MailItem</FONT><FONT size=3D2> _mail =3D </FONT><FONT =
color=3D#0000ff=20
size=3D2>null</FONT></FONT><FONT size=3D2><FONT =
face=3DArial>;</FONT></P>
<P><FONT face=3DArial>Outlook.</FONT></FONT><FONT face=3DArial><FONT =
color=3D#008080=20
size=3D2>_NameSpace</FONT><FONT size=3D2> ns =3D </FONT><FONT =
color=3D#0000ff=20
size=3D2>null</FONT></FONT><FONT size=3D2><FONT =
face=3DArial>;</FONT></P>
<P></FONT><FONT face=3DArial><FONT color=3D#0000ff =
size=3D2>string</FONT><FONT size=3D2>=20
entryID =3D </FONT><FONT color=3D#0000ff =
size=3D2>null</FONT></FONT><FONT size=3D2><FONT=20
face=3DArial>;</FONT></P>
<P><FONT face=3DArial>currentItem =3D mail;</FONT></P>
<P><FONT face=3DArial>_mail =3D currentItem </FONT></FONT><FONT =
face=3DArial><FONT=20
color=3D#0000ff size=3D2>as</FONT><FONT size=3D2> Outlook.</FONT><FONT =
color=3D#008080=20
size=3D2>_MailItem</FONT></FONT><FONT size=3D2><FONT =
face=3DArial>;</FONT></P>
<P></FONT><FONT face=3DArial><FONT color=3D#0000ff =
size=3D2>if</FONT><FONT size=3D2>=20
(_mail =3D=3D </FONT><FONT color=3D#0000ff size=3D2>null</FONT><FONT =
size=3D2>)=20
</FONT><FONT color=3D#0000ff size=3D2>return</FONT></FONT><FONT =
size=3D2><FONT=20
face=3DArial>;</FONT></P>
<P></FONT><FONT color=3D#008000 size=3D2><FONT face=3DArial>//add named=20
property</FONT></P></FONT><FONT size=3D2>
<P><FONT face=3DArial>ns =3D OutlookApp.GetNamespace(</FONT></FONT><FONT =
face=3DArial=20
color=3D#800000 size=3D2>"MAPI"</FONT><FONT size=3D2><FONT =
face=3DArial>);</FONT></P>
<P><FONT face=3DArial>entryID =3D _mail.EntryID;</FONT></P>
<P><FONT face=3DArial>AddNamedProperty(entryID, </FONT></FONT><FONT=20
face=3DArial><FONT color=3D#800000=20
size=3D2>"X-Aplitrak-Responding-Board-Name:"</FONT><FONT size=3D2>, =
</FONT><FONT=20
color=3D#800000 size=3D2>"Here is the City"</FONT><FONT=20
size=3D2>);</FONT></FONT></P><FONT size=3D2>
<P><FONT face=3DArial>_mail.To =3D </FONT></FONT><FONT face=3DArial =
color=3D#800000=20
size=3D2>"dereke@[EMAIL PROTECTED]
"</FONT><FONT size=3D2><FONT=20
face=3DArial>;</FONT></P>
<P><FONT face=3DArial>_mail.Save();</FONT></P>
<P><FONT face=3DArial>_mail.Send();</FONT></P>
<P><FONT =
face=3DArial>-------------------------------------------------Addnamed=20
property method-----------------------------</FONT></P><FONT =
face=3DArial><FONT=20
color=3D#0000ff size=3D2>
<P>public</FONT><FONT size=3D2> </FONT><FONT color=3D#0000ff =
size=3D2>bool</FONT><FONT=20
size=3D2> AddNamedProperty(</FONT><FONT color=3D#0000ff =
size=3D2>string</FONT><FONT=20
size=3D2> entryID, </FONT><FONT color=3D#0000ff =
size=3D2>string</FONT><FONT size=3D2>=20
propertyName, </FONT><FONT color=3D#0000ff size=3D2>string</FONT><FONT =
size=3D2>=20
_value)</P>
<P>{</P>
<P></FONT><FONT color=3D#0000ff size=3D2>object</FONT><FONT size=3D2> =
obj =3D=20
</FONT><FONT color=3D#0000ff size=3D2>null</FONT><FONT size=3D2>;</P>
<P></FONT><FONT color=3D#0000ff size=3D2>bool</FONT><FONT size=3D2> =
retVal =3D=20
</FONT><FONT color=3D#0000ff size=3D2>false</FONT><FONT size=3D2>;</P>
<P></FONT><FONT color=3D#008080 size=3D2>IMAPIProp</FONT><FONT size=3D2> =
mail =3D=20
</FONT><FONT color=3D#0000ff size=3D2>null</FONT><FONT size=3D2>;</P>
<P>Outlook.</FONT><FONT color=3D#008080 size=3D2>_NameSpace</FONT><FONT =
size=3D2> ns =3D=20
</FONT><FONT color=3D#0000ff size=3D2>null</FONT><FONT size=3D2>;</P>
<P>Outlook.</FONT><FONT color=3D#008080 size=3D2>_MailItem</FONT><FONT =
size=3D2>=20
mailObj =3D </FONT><FONT color=3D#0000ff size=3D2>null</FONT><FONT =
size=3D2>;</P>
<P></FONT><FONT color=3D#0000ff size=3D2>try</P></FONT><FONT size=3D2>
<P>{</P>
<P>ns =3D OutlookApp.GetNamespace(</FONT><FONT color=3D#800000=20
size=3D2>"MAPI"</FONT><FONT size=3D2>);</P>
<P>obj =3D ns.GetItemFromID(entryID, </FONT><FONT color=3D#008080=20
size=3D2>Type</FONT><FONT size=3D2>.Missing);</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> (obj =
</FONT><FONT=20
color=3D#0000ff size=3D2>is</FONT><FONT size=3D2> Outlook.</FONT><FONT =
color=3D#008080=20
size=3D2>MailItem</FONT><FONT size=3D2>)</P>
<P>{</P>
<P>mailObj =3D obj </FONT><FONT color=3D#0000ff size=3D2>as</FONT><FONT =
size=3D2>=20
Outlook.</FONT><FONT color=3D#008080 size=3D2>MailItem</FONT><FONT =
size=3D2>;</P>
<P></FONT><FONT color=3D#0000ff size=3D2>try</P></FONT><FONT size=3D2>
<P>{</P>
<P>mail =3D mailObj.MAPIOBJECT </FONT><FONT color=3D#0000ff =
size=3D2>as</FONT><FONT=20
size=3D2> </FONT><FONT color=3D#008080 size=3D2>IMAPIProp</FONT><FONT =
size=3D2>;</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> (mail =
!=3D=20
</FONT><FONT color=3D#0000ff size=3D2>null</FONT><FONT size=3D2>)</P>
<P>{</P>
<P></FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2> p =
=3D </FONT><FONT=20
color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2>.Zero;</P>
<P></FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2> =
lpszStr =3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero;</P>
<P></FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2> =
propTags =3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero;</P>
<P></FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2> =
lpszValue =3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero;</P>
<P></FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2> =
lpProblems =3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero;</P>
<P></FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2> =
lpPropValue =3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero;</P>
<P></FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2> =
_mapiNameID =3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero;</P>
<P></FONT><FONT color=3D#008080 size=3D2>SPropValue</FONT><FONT =
size=3D2> propValue =3D=20
</FONT><FONT color=3D#0000ff size=3D2>new</FONT><FONT size=3D2> =
</FONT><FONT=20
color=3D#008080 size=3D2>SPropValue</FONT><FONT size=3D2>();</P>
<P></FONT><FONT color=3D#008080 size=3D2>MAPINAMEID</FONT><FONT =
size=3D2> mapiNameID =3D=20
</FONT><FONT color=3D#0000ff size=3D2>new</FONT><FONT size=3D2> =
</FONT><FONT=20
color=3D#008080 size=3D2>MAPINAMEID</FONT><FONT size=3D2>();</P>
<P></FONT><FONT color=3D#0000ff size=3D2>try</P></FONT><FONT size=3D2>
<P>{</P>
<P></FONT><FONT color=3D#008080 size=3D2>Guid</FONT><FONT size=3D2> g =
=3D </FONT><FONT=20
color=3D#0000ff size=3D2>new</FONT><FONT size=3D2> </FONT><FONT =
color=3D#008080=20
size=3D2>Guid</FONT><FONT size=3D2>(magicGUID);</P>
<P>_mapiNameID =3D </FONT><FONT color=3D#008080 =
size=3D2>Marshal</FONT><FONT=20
size=3D2>.AllocHGlobal(</FONT><FONT color=3D#008080 =
size=3D2>Marshal</FONT><FONT=20
size=3D2>.SizeOf(</FONT><FONT color=3D#0000ff =
size=3D2>typeof</FONT><FONT=20
size=3D2>(</FONT><FONT color=3D#008080 size=3D2>MAPINAMEID</FONT><FONT =
size=3D2>)));</P>
<P>p =3D </FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.AllocHGlobal(</FONT><FONT color=3D#008080 =
size=3D2>Marshal</FONT><FONT=20
size=3D2>.SizeOf(g));</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.StructureToPtr(g, p, </FONT><FONT color=3D#0000ff =
size=3D2>false</FONT><FONT=20
size=3D2>);</P>
<P>mapiNameID.lpguid =3D p;</P>
<P>mapiNameID.ulKind =3D 1;</P>
<P>lpszStr =3D </FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT =
size=3D2>.StringToHGlobalUni(propertyName);</P>
<P>mapiNameID.lpwstrName =3D lpszStr;</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.StructureToPtr(mapiNameID, _mapiNameID, </FONT><FONT =
color=3D#0000ff=20
size=3D2>false</FONT><FONT size=3D2>);</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2>=20
(mail.GetIDsFromNames(1, </FONT><FONT color=3D#0000ff =
size=3D2>ref</FONT><FONT=20
size=3D2> _mapiNameID, 0x00000002, </FONT><FONT color=3D#0000ff=20
size=3D2>out</FONT><FONT size=3D2> propTags) =3D=3D </FONT><FONT =
color=3D#008080=20
size=3D2>MAPI</FONT><FONT size=3D2>.S_OK)</P>
<P>{</P>
<P></FONT><FONT color=3D#0000ff size=3D2>int</FONT><FONT size=3D2> count =
=3D=20
</FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.ReadInt32(propTags);</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> (count =
=3D=3D 1)</P>
<P>{</P>
<P></FONT><FONT color=3D#0000ff size=3D2>uint</FONT><FONT size=3D2> tag =
=3D=20
(</FONT><FONT color=3D#0000ff size=3D2>uint</FONT><FONT =
size=3D2>)</FONT><FONT=20
color=3D#008080 size=3D2>Marshal</FONT><FONT =
size=3D2>.ReadInt32(</FONT><FONT=20
color=3D#0000ff size=3D2>new</FONT><FONT size=3D2> </FONT><FONT =
color=3D#008080=20
size=3D2>IntPtr</FONT><FONT size=3D2>(propTags.ToInt32() + 4));</P>
<P>tag =3D (tag | </FONT><FONT color=3D#008080 size=3D2>MAPI</FONT><FONT =
size=3D2>.PT_STRING8);</P>
<P>lpPropValue =3D </FONT><FONT color=3D#008080 =
size=3D2>Marshal</FONT><FONT=20
size=3D2>.AllocHGlobal(</FONT><FONT color=3D#008080 =
size=3D2>Marshal</FONT><FONT=20
size=3D2>.SizeOf(</FONT><FONT color=3D#0000ff =
size=3D2>typeof</FONT><FONT=20
size=3D2>(</FONT><FONT color=3D#008080 size=3D2>SPropValue</FONT><FONT =
size=3D2>)));</P>
<P>propValue.ulPropTag =3D tag;</P>
<P>propValue.dwAlignPad =3D 0;</P>
<P>lpszValue =3D </FONT><FONT color=3D#008080 =
size=3D2>Marshal</FONT><FONT=20
size=3D2>.StringToHGlobalAnsi(_value);</P>
<P>propValue.Value =3D lpszValue.ToInt64();</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.StructureToPtr(propValue, lpPropValue, </FONT><FONT =
color=3D#0000ff=20
size=3D2>false</FONT><FONT size=3D2>);</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> =
(mail.SetProps(1,=20
lpPropValue, </FONT><FONT color=3D#0000ff size=3D2>out</FONT><FONT =
size=3D2>=20
lpProblems) =3D=3D </FONT><FONT color=3D#008080 =
size=3D2>MAPI</FONT><FONT=20
size=3D2>.S_OK)</P>
<P>{</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2>=20
(mail.SaveChanges(0x00000004) =3D=3D </FONT><FONT color=3D#008080=20
size=3D2>MAPI</FONT><FONT size=3D2>.S_OK)</P>
<P>{</P>
<P>retVal =3D </FONT><FONT color=3D#0000ff size=3D2>true</FONT><FONT =
size=3D2>;</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P></FONT><FONT color=3D#0000ff size=3D2>finally</P></FONT><FONT =
size=3D2>
<P>{</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> =
(lpszValue !=3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero)</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.FreeHGlobal(lpszValue);</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> =
(lpPropValue !=3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero)</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.DestroyStructure(lpPropValue, </FONT><FONT color=3D#0000ff=20
size=3D2>typeof</FONT><FONT size=3D2>(</FONT><FONT color=3D#008080=20
size=3D2>SPropValue</FONT><FONT size=3D2>));</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> =
(propTags !=3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero)</P>
<P></FONT><FONT color=3D#008080 size=3D2>MAPI</FONT><FONT=20
size=3D2>.MAPIFreeBuffer(propTags);</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> (p =
!=3D </FONT><FONT=20
color=3D#008080 size=3D2>IntPtr</FONT><FONT size=3D2>.Zero)</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.DestroyStructure(p, </FONT><FONT color=3D#0000ff =
size=3D2>typeof</FONT><FONT=20
size=3D2>(</FONT><FONT color=3D#008080 size=3D2>Guid</FONT><FONT =
size=3D2>));</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> =
(lpszStr !=3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero)</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.FreeHGlobal(lpszStr);</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> =
(_mapiNameID !=3D=20
</FONT><FONT color=3D#008080 size=3D2>IntPtr</FONT><FONT =
size=3D2>.Zero)</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.DestroyStructure(_mapiNameID, </FONT><FONT color=3D#0000ff=20
size=3D2>typeof</FONT><FONT size=3D2>(</FONT><FONT color=3D#008080=20
size=3D2>MAPINAMEID</FONT><FONT size=3D2>));</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P></FONT><FONT color=3D#0000ff size=3D2>finally</P></FONT><FONT =
size=3D2>
<P>{</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> (mail =
!=3D=20
</FONT><FONT color=3D#0000ff size=3D2>null</FONT><FONT size=3D2>)</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.ReleaseComObject(mail);</P>
<P>}</P>
<P>}</P>
<P>}</P>
<P></FONT><FONT color=3D#0000ff size=3D2>catch</P></FONT><FONT size=3D2>
<P>{</P>
<P>}</P>
<P></FONT><FONT color=3D#0000ff size=3D2>finally</P></FONT><FONT =
size=3D2>
<P>{</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> (obj =
!=3D </FONT><FONT=20
color=3D#0000ff size=3D2>null</FONT><FONT size=3D2>)</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.ReleaseComObject(obj);</P>
<P></FONT><FONT color=3D#0000ff size=3D2>if</FONT><FONT size=3D2> (ns =
!=3D </FONT><FONT=20
color=3D#0000ff size=3D2>null</FONT><FONT size=3D2>)</P>
<P></FONT><FONT color=3D#008080 size=3D2>Marshal</FONT><FONT=20
size=3D2>.ReleaseComObject(ns);</P>
<P>}</P>
<P></FONT><FONT color=3D#0000ff size=3D2>return</FONT><FONT size=3D2> =
retVal;</P>
<P>}</P></FONT></FONT>
<P><FONT face=3DArial></FONT> </P></FONT>
<P><FONT size=3D2><FONT =
face=3DArial></FONT> </P></FONT></DIV></BODY></HTML>
------=_NextPart_000_0025_01C8C017.664A5F30--


|