Click here to Skip to main content
15,892,253 members
Articles / Mobile Apps

MAPIEx: Extended MAPI Wrapper

Rate me:
Please Sign up or sign in to vote.
4.93/5 (137 votes)
5 Dec 2009CDDL7 min read 4.4M   18.3K   228   2.2K
A (hopefully) complete extended MAPI wrapper for WinXP, WinCE, and .NET

Introduction

I've been using simple MAPI for years, and recently, I had to send some mail programmatically and was reminded of the dreaded Outlook security warnings. So, I decided to look into the extended MAPI. What I found was a huge collection of samples that did one thing or another, but nothing that really did everything related to messages that I needed. This class, hopefully, covers everything an average user would need to do, including sending and receiving mail including attachments, multiple recipients, CC, BCC, etc. I did not put any code to manipulate information stores or services. See the example CMapiAdmin on CodeProject for this functionality. I've also tested this class using Unicode as well as ANSI strings.

Using CMapiEx

I've included the sample TestMAPI (link above) to show two cases. The project has been updated to Visual Studio 8 (2005), but I believe could be adapted to nearly every version of Visual Studio and Embedded Visual Studio. It's been tested in WinXP using Office 2003, and on Windows Mobile 2003. With a small amount of work removing the MFC code from the class (basically just CString), the class will work on Windows SmartPhone as well. Some of the newer code, including Outlook Forms support and AddressBook support is not supported in Windows Mobile.

To use the class, simply do the following:

  • Call CMAPIEx::Init() and Login() to initialize and login to MAPI.
  • Use OpenMessageStore() to open the desired store, i.e., "SMS"; (NULL for the default store).
  • To receive, call OpenInbox() and GetContents() followed by a looping GetNextMessage() call for each message (optionally reading in only the unread messages).
  • Use HasAttachment and SaveAttachments() to access the message's attachments.
C#
void ReceiveTest(CMAPIEx& mapi)
{
    if(mapi.OpenInbox() && mapi.GetContents()) {
        CMAPIMessage message;
        while(mapi.GetNextMessage(message,TRUE)) {
            printf("Message from '%s' subject '%s'\n", 
              message.GetSenderName(),message.GetSubject());
            if(message.HasAttachments()) {
                printf("saving attachments...");
                message.SaveAttachments(MSG_ATTACHMENT_FOLDER);
                printf("done\n");
            }
        }
    }
}

To send, call OpenOutbox() and CMapiMessage::Create(). Then, set the message properties, and then call CMapiMessage::Send():

C#
void SendTest(CMAPIEx& mapi)
{
    if(mapi.OpenOutbox()) {
        CMAPIMessage message;
        if(message.Create(&mapi,IMPORTANCE_LOW)) {
            message.SetSenderName(FROM_NAME);
            message.SetSenderEmail(FROM_EMAIL);
            message.SetSubject(_T("Subject"));
            message.SetBody(_T("Body"));

            message.AddRecipient(TO_EMAIL);
            message.AddRecipient(TO_EMAIL2);
            message.AddAttachment(MSG_ATTACHMENT);

            if(message.Send()) printf("Sent Successfully");
        }
    }
}

Use Logout() and CMAPIEx::Term() to exit MAPI. Obviously, if you want to try CMAPIEx in a Unicode project, you'll have to use wprintf instead.

RTF/HTML Support

A lot of people requested support for HTML messages. After doing a bunch of research and testing, I found that HTML is actually usually stored in the PR_RTF_COMPRESSED property, and that it can be decoded into HTML if it contains the text \\fromhtml. Thanks to Lucian Wischik for his example, the decoding code in MAPIEx is basically lifted right from his example (see the source for the address). I took it a step further by allowing you to set the RTF property with HTML in order to send an HTML email. Take a look at the SetRTF example in the sample TestMAPI project above, for more details.

.NET Wrapper for CMAPIEx

I originally wrote the NetMAPI wrapper as a proof of concept; it has little functionality beyond the basics. However over the last few months, I received so many questions and requests for enhancements for .NET that I have completely rewritten NetMAPI to be a thin layer above the Win32 DLL, CMAPIEx. NetMAPI offers support for nearly every feature provided in the C++ interface. The included sample above contains a .NET console project, TestNetMAPI, illustrating its usage.

To use the wrapper, first make sure your program has a reference to NetMAPI, and that the compiled MAPIEx.dll is in your output folder or in your path. Then, use NetMAPI.Init() and Login functions to access it:

C#
if(NetMAPI.Init()) {
    NetMAPI mapi=new NetMAPI();
    if(mapi.Login()) {
        // Do some MAPI stuff here...
        mapi.Logout();
    }
    NetMAPI.Term();
}

To receive in .NET (assumes you've logged in successfully):

  • Open the message store you want to access
  • Then open the inbox and get the contents table
  • Iterate through the message using GetNextMessage
  • Don't forget to Dispose of the message when you're finished with it!
C#
public static void ReceiveTest(NetMAPI mapi)
{
    if(mapi.OpenInbox() && mapi.GetContents()) {
        mapi.SortContents(false);

        MAPIMessage message;
        StringBuilder s=new StringBuilder(NetMAPI.DefaultBufferSize);
        while(mapi.GetNextMessage(out message,true)) {
            Console.Write("Message from '");
            message.GetSenderName(s);
            Console.Write(s.ToString()+"' (");
            message.GetSenderEmail(s);
            Console.Write(s.ToString()+"), subject '");
            message.GetSubject(s);
            Console.Write(s.ToString()+"', received: ");
            message.GetReceivedTime(s,"%m/%d/%Y %I:%M %p");
            Console.Write(s.ToString()+"\n");
            // use message.GetBody() to get the ANSI text body
            // use message.GetRTF() to get the RTF or decoded HTML email
            message.Dispose();
        }
    }
}

To send a message (assumes you've logged in successfully):

  • Open the message store you want to access
  • Open the outbox
  • Create a new message, set its priority if you like
  • Set its properties, recipients and attachments
  • Call Send
C#
public static void SendTest(NetMAPI mapi)
{
    if(mapi.OpenOutbox()) {
        MAPIMessage message=new MAPIMessage();
        if(message.Create(mapi,MAPIMessage.Priority.IMPORTANCE_LOW)) {
            message.SetSenderName("Noel");
            message.SetSenderEmail("noel@nospam.com");
            message.SetSubject("Subject");

            // user SetBody for ANSI text, SetRTF for HTML and Rich Text
            message.SetBody("Body");
            
            message.AddRecipient("noel@nospam.com");
            message.AddRecipient("noel@nospam2.com");

            if(message.Send()) Console.WriteLine("Sent Successfully");
        }
    }
}

See the ContactsTest and FoldersTest functions in TestNetMAPI for more examples.

Use the Logout and NetMAPI.Term() call to close the wrapper. To use Unicode, compile CMAPIEx with Unicode set, and change the DefaultCharSet variable in NetMAPI to CharSet.Unicode.

Future Improvements

I'd like to add more support for Calendar and Task items. Outlook 2010 support is another thing coming down the pipeline, currently no tests have been done.

I couldn't figure out how to create a One-Off EntryID in Windows Mobile, as the IAddressBook interface is not implemented. This has the annoying effect of not sending the outgoing emails on these devices until you manually open the message in your Outbox and hit Send. If anyone knows how this is done, please let me know, and I will update it.

This code is free to use as long as the copyright notice remains at the top of the file and any enhancements or bug fixes are posted here for the community. I hope it helps someone skip the pain I went through!

History

  • 07/01/2005 - Initial release
  • 07/13/2005 - Small bug fixes and additions, see below for details
  • 08/25/2005 - Small modifications and a .NET wrapper (see below)
  • 01/27/2006 - Added a bunch of new commands for handling folders and messages (see below)
  • 05/16/2006 - Added RTF and HTML support
  • 06/02/2006 - Added external folder support, and fixed a couple of small bugs (thanks to all who reported the issues)
  • 08/21/2006 - Reorganized files, added support for reading contacts, notifications, and fixed some minor bugs
  • 10/02/2006 - Complete rewrite of the .NET wrapper, with full MAPIEx access from .NET
  • 11/01/2006 - Added support for many new fields, added IMessage Form support and writeable contacts
  • 12/04/2009 - Enhanced performance, completed contacts and added rudimentary Calendar support

Detailed History

  • Fixed a bug with attachments (thanks alan, see forum below for details).
  • While in the attachment code, I modified PR_ATTACH_FILENAME to be the filename of the attachment instead of the full path.
  • Added support for Outlook 2000. To use this class with Outlook 2000, you must call CMAPIEx::Init with a value of zero instead of the default MAPI_UNICODE. Also, building the project for Unicode doesn't work with Office 2000 as far as I can tell (it responds with ANSI strings).
  • Fixed the "mail stays in Outbox after it's sent" problem. See the posting below for more info.
  • Added a priority field to CMAPIMessage::Create, you can now optionally set IMPORTANCE_LOW or IMPORTANCE_HIGH.
  • You can now call AddRecipient repeatedly to send to more than one user.
  • Updated project to Visual Studio 2008.
  • Added a post build step to copy MAPIEx.dll to the test projects' output folders.
  • Added subfolder support to the DLL, you can now iterate through and directly open subfolders.
  • Modified the Login command to take a profile name (thanks Chris, see forum for details).
  • Added the GetProfileName command to find out what the current profile's name is (thanks Jason, author of CMAPIAdmin).
  • Added the ReceivedTime property and the GetReceivedTime function to the message class (thanks again Chris, see forum).
  • Added a CopyMessage function to copy a message between folders as well as the DeleteMessage and MoveMessage functions.
  • Added the CreateSubFolder, DeleteSubFolder functions.
  • Added a OpenSentItems function.
  • Added a new RTF property, this allows us to set RTF text and even HTML (see TestMAPI, for an example).
  • Changed GetBody and GetRTF to be filled on demand rather than when opening the message.
  • MAPIEx can now extract SMTP email addresses from Exchange (EX) native addresses (see FillSenderEmail, for details).
  • MAPIEx can now receive notifications from MAPI (i.e., for new mail arrivals, message deletion etc., see NotificationTest for an example.
  • Added read only support for contacts, see ContactsTest for a sample).
  • Fixed a bug with bad strings from MAPI properties (see GetValidString for more info).
  • Added support for the MAPI_NO_CACHE flag (for Outlook 2003).
  • Added the OpenContacts and OpenDrafts functions.
  • Added a GetRowCount for providing progress feedback for long folder operations.
  • Added support for the AddressList form to get a list of recipients via the common UI. (C++ only, C# if people request it.)
  • Added support for custom Named Properties in Contacts and Messages.
  • Added IMessageForm support to show the default form for editing messages.
  • Added Save, SubmitTime, Sensitivity, MessageFlags, and DeliveryReceipt properties to messages.
  • Added support for enumerating recipients of a message.
  • MAPIContact now supports the three email fields.
  • Added many new fields to contacts such as Company, HomePage, DisplayAs, etc.
  • Added support for creating contacts.
  • Added rudimentary Calendar support (no create appointment functionality yet).
  • Added extensive folder support, see FolderTest for an example.
  • Added CreateProfile and DeleteProfile because of multiple requests.
  • Extended RTF and HTML support, added GetMessageEditorFormat to detect formats.
  • Many small improvements and additions requested by the userbase (too many to list, see forum below for details).

License

This article, along with any associated source code and files, is licensed under The Common Development and Distribution License (CDDL)


Written By
Software Developer (Senior)
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
AnswerRe: Trouble with very long EntryId Pin
vsjc915-May-13 2:06
vsjc915-May-13 2:06 
GeneralRe: Trouble with very long EntryId Pin
Noel Dillabough5-May-13 4:46
Noel Dillabough5-May-13 4:46 
QuestionMAPILogonEx flags Pin
vsjc912-May-13 23:02
vsjc912-May-13 23:02 
AnswerRe: MAPILogonEx flags Pin
Noel Dillabough3-May-13 3:45
Noel Dillabough3-May-13 3:45 
Questionfirst contact folder parse after while loop terminated ? Pin
Vijay Kumbhani2-May-13 19:31
Vijay Kumbhani2-May-13 19:31 
QuestionConditional DllImport Pin
vsjc912-May-13 3:33
vsjc912-May-13 3:33 
AnswerRe: Conditional DllImport Pin
Noel Dillabough2-May-13 3:47
Noel Dillabough2-May-13 3:47 
GeneralRe: Conditional DllImport Pin
vsjc912-May-13 23:07
vsjc912-May-13 23:07 
Well, it was every bit as tedious as I imagined, but here in case helpful to others are conditional DllImports. Please use at your own risk, as I have not checked all of these.

#region MAPIAppointment DLLCalls

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetSubject")]
protected static extern bool AppointmentGetSubject32(IntPtr pAppointment, StringBuilder strSubject, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetSubject")]
protected static extern bool AppointmentGetSubject64(IntPtr pAppointment, StringBuilder strSubject, int nMaxLength);
protected static bool AppointmentGetSubject(IntPtr pAppointment, StringBuilder strSubject, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return AppointmentGetSubject32(pAppointment, strSubject, nMaxLength);
else
return AppointmentGetSubject64(pAppointment, strSubject, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetLocation")]
protected static extern bool AppointmentGetLocation32(IntPtr pAppointment, StringBuilder strLocation, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetLocation")]
protected static extern bool AppointmentGetLocation64(IntPtr pAppointment, StringBuilder strLocation, int nMaxLength);
protected static bool AppointmentGetLocation(IntPtr pAppointment, StringBuilder strLocation, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return AppointmentGetLocation32(pAppointment, strLocation, nMaxLength);
else
return AppointmentGetLocation64(pAppointment, strLocation, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetStartTime")]
protected static extern bool AppointmentGetStartTime32(IntPtr pAppointment, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetStartTime")]
protected static extern bool AppointmentGetStartTime64(IntPtr pAppointment, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond);
protected static bool AppointmentGetStartTime(IntPtr pAppointment, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond)
{
if (IntPtr.Size * 8 == 32)
return AppointmentGetStartTime32(pAppointment, out nYear, out nMonth, out nDay, out nHour, out nMinute, out nSecond);
else
return AppointmentGetStartTime64(pAppointment, out nYear, out nMonth, out nDay, out nHour, out nMinute, out nSecond);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetStartTimeString")]
protected static extern bool AppointmentGetStartTimeString32(IntPtr pAppointment, StringBuilder strStartTime, int nMaxLength, string szFormat);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetStartTimeString")]
protected static extern bool AppointmentGetStartTimeString64(IntPtr pAppointment, StringBuilder strStartTime, int nMaxLength, string szFormat);
protected static bool AppointmentGetStartTimeString(IntPtr pAppointment, StringBuilder strStartTime, int nMaxLength, string szFormat)
{
if (IntPtr.Size * 8 == 32)
return AppointmentGetStartTimeString32(pAppointment, strStartTime, nMaxLength, szFormat);
else
return AppointmentGetStartTimeString64(pAppointment, strStartTime, nMaxLength, szFormat);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetEndTime")]
protected static extern bool AppointmentGetEndTime32(IntPtr pAppointment, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetEndTime")]
protected static extern bool AppointmentGetEndTime64(IntPtr pAppointment, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond);
protected static bool AppointmentGetEndTime(IntPtr pAppointment, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond)
{
if (IntPtr.Size * 8 == 32)
return AppointmentGetEndTime32(pAppointment, out nYear, out nMonth, out nDay, out nHour, out nMinute, out nSecond);
else
return AppointmentGetEndTime64(pAppointment, out nYear, out nMonth, out nDay, out nHour, out nMinute, out nSecond);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetEndTimeString")]
protected static extern bool AppointmentGetEndTimeString32(IntPtr pAppointment, StringBuilder strEndTime, int nMaxLength, string szFormat);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentGetEndTimeString")]
protected static extern bool AppointmentGetEndTimeString64(IntPtr pAppointment, StringBuilder strEndTime, int nMaxLength, string szFormat);
protected static bool AppointmentGetEndTimeString(IntPtr pAppointment, StringBuilder strEndTime, int nMaxLength, string szFormat)
{
if (IntPtr.Size * 8 == 32)
return AppointmentGetEndTimeString32(pAppointment, strEndTime, nMaxLength, szFormat);
else
return AppointmentGetEndTimeString64(pAppointment, strEndTime, nMaxLength, szFormat);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentSetSubject")]
protected static extern bool AppointmentSetSubject32(IntPtr pAppointment, string strSubject);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentSetSubject")]
protected static extern bool AppointmentSetSubject64(IntPtr pAppointment, string strSubject);
protected static bool AppointmentSetSubject(IntPtr pAppointment, string strSubject)
{
if (IntPtr.Size * 8 == 32)
return AppointmentSetSubject32(pAppointment, strSubject);
else
return AppointmentSetSubject64(pAppointment, strSubject);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentSetLocation")]
protected static extern bool AppointmentSetLocation32(IntPtr pAppointment, string strLocation);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentSetLocation")]
protected static extern bool AppointmentSetLocation64(IntPtr pAppointment, string strLocation);
protected static bool AppointmentSetLocation(IntPtr pAppointment, string strLocation)
{
if (IntPtr.Size * 8 == 32)
return AppointmentSetLocation32(pAppointment, strLocation);
else
return AppointmentSetLocation64(pAppointment, strLocation);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentSetStartTime")]
protected static extern bool AppointmentSetStartTime32(IntPtr pAppointment, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentSetStartTime")]
protected static extern bool AppointmentSetStartTime64(IntPtr pAppointment, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond);
protected static bool AppointmentSetStartTime(IntPtr pAppointment, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond)
{
if (IntPtr.Size * 8 == 32)
return AppointmentSetStartTime32(pAppointment, nYear, nMonth, nDay, nHour, nMinute, nSecond);
else
return AppointmentSetStartTime64(pAppointment, nYear, nMonth, nDay, nHour, nMinute, nSecond);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentSetEndTime")]
protected static extern bool AppointmentSetEndTime32(IntPtr pAppointment, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AppointmentSetEndTime")]
protected static extern bool AppointmentSetEndTime64(IntPtr pAppointment, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond);
protected static bool AppointmentSetEndTime(IntPtr pAppointment, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond)
{
if (IntPtr.Size * 8 == 32)
return AppointmentSetEndTime32(pAppointment, nYear, nMonth, nDay, nHour, nMinute, nSecond);
else
return AppointmentSetEndTime64(pAppointment, nYear, nMonth, nDay, nHour, nMinute, nSecond);
}

#endregion

#region MAPIContact DLLCalls

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactCreate")]
protected static extern bool ContactCreate32(IntPtr pMAPI, out IntPtr pContact, IntPtr pFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactCreate")]
protected static extern bool ContactCreate64(IntPtr pMAPI, out IntPtr pContact, IntPtr pFolder);
protected static bool ContactCreate(IntPtr pMAPI, out IntPtr pContact, IntPtr pFolder)
{
if (IntPtr.Size * 8 == 32)
return ContactCreate32(pMAPI, out pContact, pFolder);
else
return ContactCreate64(pMAPI, out pContact, pFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetName")]
protected static extern bool ContactGetName32(IntPtr pContact, StringBuilder strName, int nMaxLength, int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetName")]
protected static extern bool ContactGetName64(IntPtr pContact, StringBuilder strName, int nMaxLength, int nType);
protected static bool ContactGetName(IntPtr pContact, StringBuilder strName, int nMaxLength, int nType)
{
if (IntPtr.Size * 8 == 32)
return ContactGetName32(pContact, strName, nMaxLength, nType);
else
return ContactGetName64(pContact, strName, nMaxLength, nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetEmail")]
protected static extern bool ContactGetEmail32(IntPtr pContact, StringBuilder strEmail, int nMaxLength, int nIndex);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetEmail")]
protected static extern bool ContactGetEmail64(IntPtr pContact, StringBuilder strEmail, int nMaxLength, int nIndex);
protected static bool ContactGetEmail(IntPtr pContact, StringBuilder strEmail, int nMaxLength, int nIndex)
{
if (IntPtr.Size * 8 == 32)
return ContactGetEmail32(pContact, strEmail, nMaxLength, nIndex);
else
return ContactGetEmail64(pContact, strEmail, nMaxLength, nIndex);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetEmailDisplayAs")]
protected static extern bool ContactGetEmailDisplayAs32(IntPtr pContact, StringBuilder strDisplayAs, int nMaxLength, int nIndex);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetEmailDisplayAs")]
protected static extern bool ContactGetEmailDisplayAs64(IntPtr pContact, StringBuilder strDisplayAs, int nMaxLength, int nIndex);
protected static bool ContactGetEmailDisplayAs(IntPtr pContact, StringBuilder strDisplayAs, int nMaxLength, int nIndex)
{
if (IntPtr.Size * 8 == 32)
return ContactGetEmailDisplayAs32(pContact, strDisplayAs, nMaxLength, nIndex);
else
return ContactGetEmailDisplayAs64(pContact, strDisplayAs, nMaxLength, nIndex);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetHomePage")]
protected static extern bool ContactGetHomePage32(IntPtr pContact, StringBuilder strHomePage, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetHomePage")]
protected static extern bool ContactGetHomePage64(IntPtr pContact, StringBuilder strHomePage, int nMaxLength);
protected static bool ContactGetHomePage(IntPtr pContact, StringBuilder strHomePage, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetHomePage32(pContact, strHomePage, nMaxLength);
else
return ContactGetHomePage64(pContact, strHomePage, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetIMAddress")]
protected static extern bool ContactGetIMAddress32(IntPtr pContact, StringBuilder strIMAddress, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetIMAddress")]
protected static extern bool ContactGetIMAddress64(IntPtr pContact, StringBuilder strIMAddress, int nMaxLength);
protected static bool ContactGetIMAddress(IntPtr pContact, StringBuilder strIMAddress, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetIMAddress32(pContact, strIMAddress, nMaxLength);
else
return ContactGetIMAddress64(pContact, strIMAddress, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetProfession")]
protected static extern bool ContactGetProfession32(IntPtr pContact, StringBuilder strProfession, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetProfession")]
protected static extern bool ContactGetProfession64(IntPtr pContact, StringBuilder strProfession, int nMaxLength);
protected static bool ContactGetProfession(IntPtr pContact, StringBuilder strProfession, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetProfession32(pContact, strProfession, nMaxLength);
else
return ContactGetProfession64(pContact, strProfession, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetPhoneNumber")]
protected static extern bool ContactGetPhoneNumber32(IntPtr pContact, StringBuilder strPhoneNumber, int nMaxLength, int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetPhoneNumber")]
protected static extern bool ContactGetPhoneNumber64(IntPtr pContact, StringBuilder strPhoneNumber, int nMaxLength, int nType);
protected static bool ContactGetPhoneNumber(IntPtr pContact, StringBuilder strPhoneNumber, int nMaxLength, int nType)
{
if (IntPtr.Size * 8 == 32)
return ContactGetPhoneNumber32(pContact, strPhoneNumber, nMaxLength, nType);
else
return ContactGetPhoneNumber64(pContact, strPhoneNumber, nMaxLength, nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetAddress")]
protected static extern bool ContactGetAddress32(IntPtr pContact, out IntPtr pAddress, int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetAddress")]
protected static extern bool ContactGetAddress64(IntPtr pContact, out IntPtr pAddress, int nType);
protected static bool ContactGetAddress(IntPtr pContact, out IntPtr pAddress, int nType)
{
if (IntPtr.Size * 8 == 32)
return ContactGetAddress32(pContact, out pAddress, nType);
else
return ContactGetAddress64(pContact, out pAddress, nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetPostalAddress")]
protected static extern bool ContactGetPostalAddress32(IntPtr pContact, StringBuilder strAddress, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetPostalAddress")]
protected static extern bool ContactGetPostalAddress64(IntPtr pContact, StringBuilder strAddress, int nMaxLength);
protected static bool ContactGetPostalAddress(IntPtr pContact, StringBuilder strAddress, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetPostalAddress32(pContact, strAddress, nMaxLength);
else
return ContactGetPostalAddress64(pContact, strAddress, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetNotesSize")]
protected static extern int ContactGetNotesSize32(IntPtr pContact, bool bRTF);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetNotesSize")]
protected static extern int ContactGetNotesSize64(IntPtr pContact, bool bRTF);
protected static int ContactGetNotesSize(IntPtr pContact, bool bRTF)
{
if (IntPtr.Size * 8 == 32)
return ContactGetNotesSize32(pContact, bRTF);
else
return ContactGetNotesSize64(pContact, bRTF);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetNotes")]
protected static extern bool ContactGetNotes32(IntPtr pContact, StringBuilder strNotes, int nMaxLength, bool bRTF);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetNotes")]
protected static extern bool ContactGetNotes64(IntPtr pContact, StringBuilder strNotes, int nMaxLength, bool bRTF);
protected static bool ContactGetNotes(IntPtr pContact, StringBuilder strNotes, int nMaxLength, bool bRTF)
{
if (IntPtr.Size * 8 == 32)
return ContactGetNotes32(pContact, strNotes, nMaxLength, bRTF);
else
return ContactGetNotes64(pContact, strNotes, nMaxLength, bRTF);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetSensitivity")]
protected static extern int ContactGetSensitivity32(IntPtr pContact);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetSensitivity")]
protected static extern int ContactGetSensitivity64(IntPtr pContact);
protected static int ContactGetSensitivity(IntPtr pContact)
{
if (IntPtr.Size * 8 == 32)
return ContactGetSensitivity32(pContact);
else
return ContactGetSensitivity64(pContact);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetTitle")]
protected static extern bool ContactGetTitle32(IntPtr pContact, StringBuilder strTitle, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetTitle")]
protected static extern bool ContactGetTitle64(IntPtr pContact, StringBuilder strTitle, int nMaxLength);
protected static bool ContactGetTitle(IntPtr pContact, StringBuilder strTitle, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetTitle32(pContact, strTitle, nMaxLength);
else
return ContactGetTitle64(pContact, strTitle, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetCompany")]
protected static extern bool ContactGetCompany32(IntPtr pContact, StringBuilder strCompany, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetCompany")]
protected static extern bool ContactGetCompany64(IntPtr pContact, StringBuilder strCompany, int nMaxLength);
protected static bool ContactGetCompany(IntPtr pContact, StringBuilder strCompany, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetCompany32(pContact, strCompany, nMaxLength);
else
return ContactGetCompany64(pContact, strCompany, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetDisplayNamePrefix")]
protected static extern bool ContactGetDisplayNamePrefix32(IntPtr pContact, StringBuilder strDisplayNamePrefix, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetDisplayNamePrefix")]
protected static extern bool ContactGetDisplayNamePrefix64(IntPtr pContact, StringBuilder strDisplayNamePrefix, int nMaxLength);
protected static bool ContactGetDisplayNamePrefix(IntPtr pContact, StringBuilder strDisplayNamePrefix, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetDisplayNamePrefix32(pContact, strDisplayNamePrefix, nMaxLength);
else
return ContactGetDisplayNamePrefix64(pContact, strDisplayNamePrefix, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetGeneration")]
protected static extern bool ContactGetGeneration32(IntPtr pContact, StringBuilder strGeneration, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetGeneration")]
protected static extern bool ContactGetGeneration64(IntPtr pContact, StringBuilder strGeneration, int nMaxLength);
protected static bool ContactGetGeneration(IntPtr pContact, StringBuilder strGeneration, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetGeneration32(pContact, strGeneration, nMaxLength);
else
return ContactGetGeneration64(pContact, strGeneration, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetDepartment")]
protected static extern bool ContactGetDepartment32(IntPtr pContact, StringBuilder strDepartment, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetDepartment")]
protected static extern bool ContactGetDepartment64(IntPtr pContact, StringBuilder strDepartment, int nMaxLength);
protected static bool ContactGetDepartment(IntPtr pContact, StringBuilder strDepartment, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetDepartment32(pContact, strDepartment, nMaxLength);
else
return ContactGetDepartment64(pContact, strDepartment, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetOffice")]
protected static extern bool ContactGetOffice32(IntPtr pContact, StringBuilder strOffice, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetOffice")]
protected static extern bool ContactGetOffice64(IntPtr pContact, StringBuilder strOffice, int nMaxLength);
protected static bool ContactGetOffice(IntPtr pContact, StringBuilder strOffice, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetOffice32(pContact, strOffice, nMaxLength);
else
return ContactGetOffice64(pContact, strOffice, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetManagerName")]
protected static extern bool ContactGetManagerName32(IntPtr pContact, StringBuilder strManagerName, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetManagerName")]
protected static extern bool ContactGetManagerName64(IntPtr pContact, StringBuilder strManagerName, int nMaxLength);
protected static bool ContactGetManagerName(IntPtr pContact, StringBuilder strManagerName, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetManagerName32(pContact, strManagerName, nMaxLength);
else
return ContactGetManagerName64(pContact, strManagerName, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetAssistantName")]
protected static extern bool ContactGetAssistantName32(IntPtr pContact, StringBuilder strAssistantName, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetAssistantName")]
protected static extern bool ContactGetAssistantName64(IntPtr pContact, StringBuilder strAssistantName, int nMaxLength);
protected static bool ContactGetAssistantName(IntPtr pContact, StringBuilder strAssistantName, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetAssistantName32(pContact, strAssistantName, nMaxLength);
else
return ContactGetAssistantName64(pContact, strAssistantName, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetNickName")]
protected static extern bool ContactGetNickName32(IntPtr pContact, StringBuilder strNickName, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetNickName")]
protected static extern bool ContactGetNickName64(IntPtr pContact, StringBuilder strNickName, int nMaxLength);
protected static bool ContactGetNickName(IntPtr pContact, StringBuilder strNickName, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetNickName32(pContact, strNickName, nMaxLength);
else
return ContactGetNickName64(pContact, strNickName, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetSpouseName")]
protected static extern bool ContactGetSpouseName32(IntPtr pContact, StringBuilder strSpouseName, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetSpouseName")]
protected static extern bool ContactGetSpouseName64(IntPtr pContact, StringBuilder strSpouseName, int nMaxLength);
protected static bool ContactGetSpouseName(IntPtr pContact, StringBuilder strSpouseName, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetSpouseName32(pContact, strSpouseName, nMaxLength);
else
return ContactGetSpouseName64(pContact, strSpouseName, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetBirthday")]
protected static extern bool ContactGetBirthday32(IntPtr pContact, out int nYear, out int nMonth, out int nDay);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetBirthday")]
protected static extern bool ContactGetBirthday64(IntPtr pContact, out int nYear, out int nMonth, out int nDay);
protected static bool ContactGetBirthday(IntPtr pContact, out int nYear, out int nMonth, out int nDay)
{
if (IntPtr.Size * 8 == 32)
return ContactGetBirthday32(pContact, out nYear, out nMonth, out nDay);
else
return ContactGetBirthday64(pContact, out nYear, out nMonth, out nDay);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetAnniversary")]
protected static extern bool ContactGetAnniversary32(IntPtr pContact, out int nYear, out int nMonth, out int nDay);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetAnniversary")]
protected static extern bool ContactGetAnniversary64(IntPtr pContact, out int nYear, out int nMonth, out int nDay);
protected static bool ContactGetAnniversary(IntPtr pContact, out int nYear, out int nMonth, out int nDay)
{
if (IntPtr.Size * 8 == 32)
return ContactGetAnniversary32(pContact, out nYear, out nMonth, out nDay);
else
return ContactGetAnniversary64(pContact, out nYear, out nMonth, out nDay);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetCategories")]
protected static extern bool ContactGetCategories32(IntPtr pContact, StringBuilder strField, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactGetCategories")]
protected static extern bool ContactGetCategories64(IntPtr pContact, StringBuilder strField, int nMaxLength);
protected static bool ContactGetCategories(IntPtr pContact, StringBuilder strField, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ContactGetCategories32(pContact, strField, nMaxLength);
else
return ContactGetCategories64(pContact, strField, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetName")]
protected static extern bool ContactSetName32(IntPtr pContact, string strName, int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetName")]
protected static extern bool ContactSetName64(IntPtr pContact, string strName, int nType);
protected static bool ContactSetName(IntPtr pContact, string strName, int nType)
{
if (IntPtr.Size * 8 == 32)
return ContactSetName32(pContact, strName, nType);
else
return ContactSetName64(pContact, strName, nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetEmail")]
protected static extern bool ContactSetEmail32(IntPtr pContact, string strEmail, int nIndex);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetEmail")]
protected static extern bool ContactSetEmail64(IntPtr pContact, string strEmail, int nIndex);
protected static bool ContactSetEmail(IntPtr pContact, string strEmail, int nIndex)
{
if (IntPtr.Size * 8 == 32)
return ContactSetEmail32(pContact, strEmail, nIndex);
else
return ContactSetEmail64(pContact, strEmail, nIndex);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetEmailDisplayAs")]
protected static extern bool ContactSetEmailDisplayAs32(IntPtr pContact, string strDisplayAs, int nIndex);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetEmailDisplayAs")]
protected static extern bool ContactSetEmailDisplayAs64(IntPtr pContact, string strDisplayAs, int nIndex);
protected static bool ContactSetEmailDisplayAs(IntPtr pContact, string strDisplayAs, int nIndex)
{
if (IntPtr.Size * 8 == 32)
return ContactSetEmailDisplayAs32(pContact, strDisplayAs, nIndex);
else
return ContactSetEmailDisplayAs64(pContact, strDisplayAs, nIndex);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetHomePage")]
protected static extern bool ContactSetHomePage32(IntPtr pContact, string strHomePage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetHomePage")]
protected static extern bool ContactSetHomePage64(IntPtr pContact, string strHomePage);
protected static bool ContactSetHomePage(IntPtr pContact, string strHomePage)
{
if (IntPtr.Size * 8 == 32)
return ContactSetHomePage32(pContact, strHomePage);
else
return ContactSetHomePage64(pContact, strHomePage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetIMAddress")]
protected static extern bool ContactSetIMAddress32(IntPtr pContact, string strIMAddress);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetIMAddress")]
protected static extern bool ContactSetIMAddress64(IntPtr pContact, string strIMAddress);
protected static bool ContactSetIMAddress(IntPtr pContact, string strIMAddress)
{
if (IntPtr.Size * 8 == 32)
return ContactSetIMAddress32(pContact, strIMAddress);
else
return ContactSetIMAddress64(pContact, strIMAddress);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetProfession")]
protected static extern bool ContactSetProfession32(IntPtr pContact, string strProfession);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetProfession")]
protected static extern bool ContactSetProfession64(IntPtr pContact, string strProfession);
protected static bool ContactSetProfession(IntPtr pContact, string strProfession)
{
if (IntPtr.Size * 8 == 32)
return ContactSetProfession32(pContact, strProfession);
else
return ContactSetProfession64(pContact, strProfession);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetPhoneNumber")]
protected static extern bool ContactSetPhoneNumber32(IntPtr pContact, string strPhoneNumber, int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetPhoneNumber")]
protected static extern bool ContactSetPhoneNumber64(IntPtr pContact, string strPhoneNumber, int nType);
protected static bool ContactSetPhoneNumber(IntPtr pContact, string strPhoneNumber, int nType)
{
if (IntPtr.Size * 8 == 32)
return ContactSetPhoneNumber32(pContact, strPhoneNumber, nType);
else
return ContactSetPhoneNumber64(pContact, strPhoneNumber, nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetAddress")]
protected static extern bool ContactSetAddress32(IntPtr pContact, IntPtr pAddress, int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetAddress")]
protected static extern bool ContactSetAddress64(IntPtr pContact, IntPtr pAddress, int nType);
protected static bool ContactSetAddress(IntPtr pContact, IntPtr pAddress, int nType)
{
if (IntPtr.Size * 8 == 32)
return ContactSetAddress32(pContact, pAddress, nType);
else
return ContactSetAddress64(pContact, pAddress, nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetPostalAddress")]
protected static extern bool ContactSetPostalAddress32(IntPtr pContact, int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetPostalAddress")]
protected static extern bool ContactSetPostalAddress64(IntPtr pContact, int nType);
protected static bool ContactSetPostalAddress(IntPtr pContact, int nType)
{
if (IntPtr.Size * 8 == 32)
return ContactSetPostalAddress32(pContact, nType);
else
return ContactSetPostalAddress64(pContact, nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactUpdateDisplayAddress")]
protected static extern bool ContactUpdateDisplayAddress32(IntPtr pContact, int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactUpdateDisplayAddress")]
protected static extern bool ContactUpdateDisplayAddress64(IntPtr pContact, int nType);
protected static bool ContactUpdateDisplayAddress(IntPtr pContact, int nType)
{
if (IntPtr.Size * 8 == 32)
return ContactUpdateDisplayAddress32(pContact, nType);
else
return ContactUpdateDisplayAddress64(pContact, nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetNotes")]
protected static extern bool ContactSetNotes32(IntPtr pContact, string strNotes, bool bRTF);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetNotes")]
protected static extern bool ContactSetNotes64(IntPtr pContact, string strNotes, bool bRTF);
protected static bool ContactSetNotes(IntPtr pContact, string strNotes, bool bRTF)
{
if (IntPtr.Size * 8 == 32)
return ContactSetNotes32(pContact, strNotes, bRTF);
else
return ContactSetNotes64(pContact, strNotes, bRTF);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetSensitivity")]
protected static extern bool ContactSetSensitivity32(IntPtr pContact, int nSensitivity);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetSensitivity")]
protected static extern bool ContactSetSensitivity64(IntPtr pContact, int nSensitivity);
protected static bool ContactSetSensitivity(IntPtr pContact, int nSensitivity)
{
if (IntPtr.Size * 8 == 32)
return ContactSetSensitivity32(pContact, nSensitivity);
else
return ContactSetSensitivity64(pContact, nSensitivity);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetFileAs")]
protected static extern bool ContactSetFileAs32(IntPtr pContact, string strFileAs);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetFileAs")]
protected static extern bool ContactSetFileAs64(IntPtr pContact, string strFileAs);
protected static bool ContactSetFileAs(IntPtr pContact, string strFileAs)
{
if (IntPtr.Size * 8 == 32)
return ContactSetFileAs32(pContact, strFileAs);
else
return ContactSetFileAs64(pContact, strFileAs);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetTitle")]
protected static extern bool ContactSetTitle32(IntPtr pContact, string strTitle);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetTitle")]
protected static extern bool ContactSetTitle64(IntPtr pContact, string strTitle);
protected static bool ContactSetTitle(IntPtr pContact, string strTitle)
{
if (IntPtr.Size * 8 == 32)
return ContactSetTitle32(pContact, strTitle);
else
return ContactSetTitle64(pContact, strTitle);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetCompany")]
protected static extern bool ContactSetCompany32(IntPtr pContact, string strCompany);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetCompany")]
protected static extern bool ContactSetCompany64(IntPtr pContact, string strCompany);
protected static bool ContactSetCompany(IntPtr pContact, string strCompany)
{
if (IntPtr.Size * 8 == 32)
return ContactSetCompany32(pContact, strCompany);
else
return ContactSetCompany64(pContact, strCompany);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetDisplayNamePrefix")]
protected static extern bool ContactSetDisplayNamePrefix32(IntPtr pContact, string strPrefix);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetDisplayNamePrefix")]
protected static extern bool ContactSetDisplayNamePrefix64(IntPtr pContact, string strPrefix);
protected static bool ContactSetDisplayNamePrefix(IntPtr pContact, string strPrefix)
{
if (IntPtr.Size * 8 == 32)
return ContactSetDisplayNamePrefix32(pContact, strPrefix);
else
return ContactSetDisplayNamePrefix64(pContact, strPrefix);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetGeneration")]
protected static extern bool ContactSetGeneration32(IntPtr pContact, string strGeneration);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetGeneration")]
protected static extern bool ContactSetGeneration64(IntPtr pContact, string strGeneration);
protected static bool ContactSetGeneration(IntPtr pContact, string strGeneration)
{
if (IntPtr.Size * 8 == 32)
return ContactSetGeneration32(pContact, strGeneration);
else
return ContactSetGeneration64(pContact, strGeneration);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactUpdateDisplayName")]
protected static extern bool ContactUpdateDisplayName32(IntPtr pContact);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactUpdateDisplayName")]
protected static extern bool ContactUpdateDisplayName64(IntPtr pContact);
protected static bool ContactUpdateDisplayName(IntPtr pContact)
{
if (IntPtr.Size * 8 == 32)
return ContactUpdateDisplayName32(pContact);
else
return ContactUpdateDisplayName64(pContact);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetDepartment")]
protected static extern bool ContactSetDepartment32(IntPtr pContact, string strDepartment);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetDepartment")]
protected static extern bool ContactSetDepartment64(IntPtr pContact, string strDepartment);
protected static bool ContactSetDepartment(IntPtr pContact, string strDepartment)
{
if (IntPtr.Size * 8 == 32)
return ContactSetDepartment32(pContact, strDepartment);
else
return ContactSetDepartment64(pContact, strDepartment);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetOffice")]
protected static extern bool ContactSetOffice32(IntPtr pContact, string strOffice);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetOffice")]
protected static extern bool ContactSetOffice64(IntPtr pContact, string strOffice);
protected static bool ContactSetOffice(IntPtr pContact, string strOffice)
{
if (IntPtr.Size * 8 == 32)
return ContactSetOffice32(pContact, strOffice);
else
return ContactSetOffice64(pContact, strOffice);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetManagerName")]
protected static extern bool ContactSetManagerName32(IntPtr pContact, string strManagerName);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetManagerName")]
protected static extern bool ContactSetManagerName64(IntPtr pContact, string strManagerName);
protected static bool ContactSetManagerName(IntPtr pContact, string strManagerName)
{
if (IntPtr.Size * 8 == 32)
return ContactSetManagerName32(pContact, strManagerName);
else
return ContactSetManagerName64(pContact, strManagerName);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetAssistantName")]
protected static extern bool ContactSetAssistantName32(IntPtr pContact, string strAssistantName);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetAssistantName")]
protected static extern bool ContactSetAssistantName64(IntPtr pContact, string strAssistantName);
protected static bool ContactSetAssistantName(IntPtr pContact, string strAssistantName)
{
if (IntPtr.Size * 8 == 32)
return ContactSetAssistantName32(pContact, strAssistantName);
else
return ContactSetAssistantName64(pContact, strAssistantName);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetNickName")]
protected static extern bool ContactSetNickName32(IntPtr pContact, string strNickName);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetNickName")]
protected static extern bool ContactSetNickName64(IntPtr pContact, string strNickName);
protected static bool ContactSetNickName(IntPtr pContact, string strNickName)
{
if (IntPtr.Size * 8 == 32)
return ContactSetNickName32(pContact, strNickName);
else
return ContactSetNickName64(pContact, strNickName);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetSpouseName")]
protected static extern bool ContactSetSpouseName32(IntPtr pContact, string strSpouseName);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetSpouseName")]
protected static extern bool ContactSetSpouseName64(IntPtr pContact, string strSpouseName);
protected static bool ContactSetSpouseName(IntPtr pContact, string strSpouseName)
{
if (IntPtr.Size * 8 == 32)
return ContactSetSpouseName32(pContact, strSpouseName);
else
return ContactSetSpouseName64(pContact, strSpouseName);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetBirthday")]
protected static extern bool ContactSetBirthday32(IntPtr pContact, int nYear, int nMonth, int nDay);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetBirthday")]
protected static extern bool ContactSetBirthday64(IntPtr pContact, int nYear, int nMonth, int nDay);
protected static bool ContactSetBirthday(IntPtr pContact, int nYear, int nMonth, int nDay)
{
if (IntPtr.Size * 8 == 32)
return ContactSetBirthday32(pContact, nYear, nMonth, nDay);
else
return ContactSetBirthday64(pContact, nYear, nMonth, nDay);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetAnniversary")]
protected static extern bool ContactSetAnniversary32(IntPtr pContact, int nYear, int nMonth, int nDay);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetAnniversary")]
protected static extern bool ContactSetAnniversary64(IntPtr pContact, int nYear, int nMonth, int nDay);
protected static bool ContactSetAnniversary(IntPtr pContact, int nYear, int nMonth, int nDay)
{
if (IntPtr.Size * 8 == 32)
return ContactSetAnniversary32(pContact, nYear, nMonth, nDay);
else
return ContactSetAnniversary64(pContact, nYear, nMonth, nDay);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetCategories")]
protected static extern bool ContactSetCategories32(IntPtr pContact, string strCategories);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetCategories")]
protected static extern bool ContactSetCategories64(IntPtr pContact, string strCategories);
protected static bool ContactSetCategories(IntPtr pContact, string strCategories)
{
if (IntPtr.Size * 8 == 32)
return ContactSetCategories32(pContact, strCategories);
else
return ContactSetCategories64(pContact, strCategories);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetPicture")]
protected static extern bool ContactSetPicture32(IntPtr pContact, string strPath);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ContactSetPicture")]
protected static extern bool ContactSetPicture64(IntPtr pContact, string strPath);
protected static bool ContactSetPicture(IntPtr pContact, string strPath)
{
if (IntPtr.Size * 8 == 32)
return ContactSetPicture32(pContact, strPath);
else
return ContactSetPicture64(pContact, strPath);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressClose")]
protected static extern void AddressClose32(IntPtr pAddress);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressClose")]
protected static extern void AddressClose64(IntPtr pAddress);
protected static void AddressClose(IntPtr pAddress)
{
if (IntPtr.Size * 8 == 32)
AddressClose32(pAddress);
else
AddressClose64(pAddress);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetStreet")]
protected static extern void AddressGetStreet32(IntPtr pAddress, StringBuilder strStreet, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetStreet")]
protected static extern void AddressGetStreet64(IntPtr pAddress, StringBuilder strStreet, int nMaxLength);
protected static void AddressGetStreet(IntPtr pAddress, StringBuilder strStreet, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
AddressGetStreet32(pAddress, strStreet, nMaxLength);
else
AddressGetStreet64(pAddress, strStreet, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetCity")]
protected static extern void AddressGetCity32(IntPtr pAddress, StringBuilder strCity, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetCity")]
protected static extern void AddressGetCity64(IntPtr pAddress, StringBuilder strCity, int nMaxLength);
protected static void AddressGetCity(IntPtr pAddress, StringBuilder strCity, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
AddressGetCity32(pAddress, strCity, nMaxLength);
else
AddressGetCity64(pAddress, strCity, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetStateOrProvince")]
protected static extern void AddressGetStateOrProvince32(IntPtr pAddress, StringBuilder strStateOrProvince, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetStateOrProvince")]
protected static extern void AddressGetStateOrProvince64(IntPtr pAddress, StringBuilder strStateOrProvince, int nMaxLength);
protected static void AddressGetStateOrProvince(IntPtr pAddress, StringBuilder strStateOrProvince, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
AddressGetStateOrProvince32(pAddress, strStateOrProvince, nMaxLength);
else
AddressGetStateOrProvince64(pAddress, strStateOrProvince, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetPostalCode")]
protected static extern void AddressGetPostalCode32(IntPtr pAddress, StringBuilder strPostalCode, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetPostalCode")]
protected static extern void AddressGetPostalCode64(IntPtr pAddress, StringBuilder strPostalCode, int nMaxLength);
protected static void AddressGetPostalCode(IntPtr pAddress, StringBuilder strPostalCode, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
AddressGetPostalCode32(pAddress, strPostalCode, nMaxLength);
else
AddressGetPostalCode64(pAddress, strPostalCode, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetCountry")]
protected static extern void AddressGetCountry32(IntPtr pAddress, StringBuilder strCountry, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressGetCountry")]
protected static extern void AddressGetCountry64(IntPtr pAddress, StringBuilder strCountry, int nMaxLength);
protected static void AddressGetCountry(IntPtr pAddress, StringBuilder strCountry, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
AddressGetCountry32(pAddress, strCountry, nMaxLength);
else
AddressGetCountry64(pAddress, strCountry, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetStreet")]
protected static extern void AddressSetStreet32(IntPtr pAddress, string strStreet);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetStreet")]
protected static extern void AddressSetStreet64(IntPtr pAddress, string strStreet);
protected static void AddressSetStreet(IntPtr pAddress, string strStreet)
{
if (IntPtr.Size * 8 == 32)
AddressSetStreet32(pAddress, strStreet);
else
AddressSetStreet64(pAddress, strStreet);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetCity")]
protected static extern void AddressSetCity32(IntPtr pAddress, string strCity);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetCity")]
protected static extern void AddressSetCity64(IntPtr pAddress, string strCity);
protected static void AddressSetCity(IntPtr pAddress, string strCity)
{
if (IntPtr.Size * 8 == 32)
AddressSetCity32(pAddress, strCity);
else
AddressSetCity64(pAddress, strCity);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetStateOrProvince")]
protected static extern void AddressSetStateOrProvince32(IntPtr pAddress, string strStateOrProvince);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetStateOrProvince")]
protected static extern void AddressSetStateOrProvince64(IntPtr pAddress, string strStateOrProvince);
protected static void AddressSetStateOrProvince(IntPtr pAddress, string strStateOrProvince)
{
if (IntPtr.Size * 8 == 32)
AddressSetStateOrProvince32(pAddress, strStateOrProvince);
else
AddressSetStateOrProvince64(pAddress, strStateOrProvince);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetPostalCode")]
protected static extern void AddressSetPostalCode32(IntPtr pAddress, string strPostalCode);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetPostalCode")]
protected static extern void AddressSetPostalCode64(IntPtr pAddress, string strPostalCode);
protected static void AddressSetPostalCode(IntPtr pAddress, string strPostalCode)
{
if (IntPtr.Size * 8 == 32)
AddressSetPostalCode32(pAddress, strPostalCode);
else
AddressSetPostalCode64(pAddress, strPostalCode);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetCountry")]
protected static extern void AddressSetCountry32(IntPtr pAddress, string strCountry);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "AddressSetCountry")]
protected static extern void AddressSetCountry64(IntPtr pAddress, string strCountry);
protected static void AddressSetCountry(IntPtr pAddress, string strCountry)
{
if (IntPtr.Size * 8 == 32)
AddressSetCountry32(pAddress, strCountry);
else
AddressSetCountry64(pAddress, strCountry);
}

#endregion

#region MAPIFolder DLLCalls

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetHierarchy")]
protected static extern bool FolderGetHierarchy32(IntPtr pFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetHierarchy")]
protected static extern bool FolderGetHierarchy64(IntPtr pFolder);
protected static bool FolderGetHierarchy(IntPtr pFolder)
{
if (IntPtr.Size * 8 == 32)
return FolderGetHierarchy32(pFolder);
else
return FolderGetHierarchy64(pFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderOpenSubFolder")]
protected static extern IntPtr FolderOpenSubFolder32(IntPtr pFolder, string strSubFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderOpenSubFolder")]
protected static extern IntPtr FolderOpenSubFolder64(IntPtr pFolder, string strSubFolder);
protected static IntPtr FolderOpenSubFolder(IntPtr pFolder, string strSubFolder)
{
if (IntPtr.Size * 8 == 32)
return FolderOpenSubFolder32(pFolder, strSubFolder);
else
return FolderOpenSubFolder64(pFolder, strSubFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderCreateSubFolder")]
protected static extern IntPtr FolderCreateSubFolder32(IntPtr pFolder, string strSubFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderCreateSubFolder")]
protected static extern IntPtr FolderCreateSubFolder64(IntPtr pFolder, string strSubFolder);
protected static IntPtr FolderCreateSubFolder(IntPtr pFolder, string strSubFolder)
{
if (IntPtr.Size * 8 == 32)
return FolderCreateSubFolder32(pFolder, strSubFolder);
else
return FolderCreateSubFolder64(pFolder, strSubFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteSubFolderByName")]
protected static extern bool FolderDeleteSubFolderByName32(IntPtr pFolder, string strSubFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteSubFolderByName")]
protected static extern bool FolderDeleteSubFolderByName64(IntPtr pFolder, string strSubFolder);
protected static bool FolderDeleteSubFolderByName(IntPtr pFolder, string strSubFolder)
{
if (IntPtr.Size * 8 == 32)
return FolderDeleteSubFolderByName32(pFolder, strSubFolder);
else
return FolderDeleteSubFolderByName64(pFolder, strSubFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteSubFolder")]
protected static extern bool FolderDeleteSubFolder32(IntPtr pFolder, IntPtr pSubFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteSubFolder")]
protected static extern bool FolderDeleteSubFolder64(IntPtr pFolder, IntPtr pSubFolder);
protected static bool FolderDeleteSubFolder(IntPtr pFolder, IntPtr pSubFolder)
{
if (IntPtr.Size * 8 == 32)
return FolderDeleteSubFolder32(pFolder, pSubFolder);
else
return FolderDeleteSubFolder64(pFolder, pSubFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetContents")]
protected static extern bool FolderGetContents32(IntPtr pFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetContents")]
protected static extern bool FolderGetContents64(IntPtr pFolder);
protected static bool FolderGetContents(IntPtr pFolder)
{
if (IntPtr.Size * 8 == 32)
return FolderGetContents32(pFolder);
else
return FolderGetContents64(pFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetRowCount")]
protected static extern int FolderGetRowCount32(IntPtr pFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetRowCount")]
protected static extern int FolderGetRowCount64(IntPtr pFolder);
protected static int FolderGetRowCount(IntPtr pFolder)
{
if (IntPtr.Size * 8 == 32)
return FolderGetRowCount32(pFolder);
else
return FolderGetRowCount64(pFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderSortContents")]
protected static extern bool FolderSortContents32(IntPtr pFolder, bool bAscending, int nSortField);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderSortContents")]
protected static extern bool FolderSortContents64(IntPtr pFolder, bool bAscending, int nSortField);
protected static bool FolderSortContents(IntPtr pFolder, bool bAscending, int nSortField)
{
if (IntPtr.Size * 8 == 32)
return FolderSortContents32(pFolder, bAscending, nSortField);
else
return FolderSortContents64(pFolder, bAscending, nSortField);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderSetUnreadOnly")]
protected static extern bool FolderSetUnreadOnly32(IntPtr pFolder, bool bUnreadOnly);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderSetUnreadOnly")]
protected static extern bool FolderSetUnreadOnly64(IntPtr pFolder, bool bUnreadOnly);
protected static bool FolderSetUnreadOnly(IntPtr pFolder, bool bUnreadOnly)
{
if (IntPtr.Size * 8 == 32)
return FolderSetUnreadOnly32(pFolder, bUnreadOnly);
else
return FolderSetUnreadOnly64(pFolder, bUnreadOnly);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetNextMessage")]
protected static extern bool FolderGetNextMessage32(IntPtr pFolder, out IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetNextMessage")]
protected static extern bool FolderGetNextMessage64(IntPtr pFolder, out IntPtr pMessage);
protected static bool FolderGetNextMessage(IntPtr pFolder, out IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return FolderGetNextMessage32(pFolder, out pMessage);
else
return FolderGetNextMessage64(pFolder, out pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetNextContact")]
protected static extern bool FolderGetNextContact32(IntPtr pFolder, out IntPtr pContact);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetNextContact")]
protected static extern bool FolderGetNextContact64(IntPtr pFolder, out IntPtr pContact);
protected static bool FolderGetNextContact(IntPtr pFolder, out IntPtr pContact)
{
if (IntPtr.Size * 8 == 32)
return FolderGetNextContact32(pFolder, out pContact);
else
return FolderGetNextContact64(pFolder, out pContact);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetNextAppointment")]
protected static extern bool FolderGetNextAppointment32(IntPtr pFolder, out IntPtr pAppointment);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetNextAppointment")]
protected static extern bool FolderGetNextAppointment64(IntPtr pFolder, out IntPtr pAppointment);
protected static bool FolderGetNextAppointment(IntPtr pFolder, out IntPtr pAppointment)
{
if (IntPtr.Size * 8 == 32)
return FolderGetNextAppointment32(pFolder, out pAppointment);
else
return FolderGetNextAppointment64(pFolder, out pAppointment);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetNextSubFolder")]
protected static extern bool FolderGetNextSubFolder32(IntPtr pFolder, out IntPtr pSubFolder, StringBuilder strFolder, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderGetNextSubFolder")]
protected static extern bool FolderGetNextSubFolder64(IntPtr pFolder, out IntPtr pSubFolder, StringBuilder strFolder, int nMaxLength);
protected static bool FolderGetNextSubFolder(IntPtr pFolder, out IntPtr pSubFolder, StringBuilder strFolder, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return FolderGetNextSubFolder32(pFolder, out pSubFolder, strFolder, nMaxLength);
else
return FolderGetNextSubFolder64(pFolder, out pSubFolder, strFolder, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteMessage")]
protected static extern bool FolderDeleteMessage32(IntPtr pFolder, IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteMessage")]
protected static extern bool FolderDeleteMessage64(IntPtr pFolder, IntPtr pMessage);
protected static bool FolderDeleteMessage(IntPtr pFolder, IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return FolderDeleteMessage32(pFolder, pMessage);
else
return FolderDeleteMessage64(pFolder, pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderCopyMessage")]
protected static extern bool FolderCopyMessage32(IntPtr pFolder, IntPtr pMessage, IntPtr pFolderDest);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderCopyMessage")]
protected static extern bool FolderCopyMessage64(IntPtr pFolder, IntPtr pMessage, IntPtr pFolderDest);
protected static bool FolderCopyMessage(IntPtr pFolder, IntPtr pMessage, IntPtr pFolderDest)
{
if (IntPtr.Size * 8 == 32)
return FolderCopyMessage32(pFolder, pMessage, pFolderDest);
else
return FolderCopyMessage64(pFolder, pMessage, pFolderDest);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderMoveMessage")]
protected static extern bool FolderMoveMessage32(IntPtr pFolder, IntPtr pMessage, IntPtr pFolderDest);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderMoveMessage")]
protected static extern bool FolderMoveMessage64(IntPtr pFolder, IntPtr pMessage, IntPtr pFolderDest);
protected static bool FolderMoveMessage(IntPtr pFolder, IntPtr pMessage, IntPtr pFolderDest)
{
if (IntPtr.Size * 8 == 32)
return FolderMoveMessage32(pFolder, pMessage, pFolderDest);
else
return FolderMoveMessage64(pFolder, pMessage, pFolderDest);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteContact")]
protected static extern bool FolderDeleteContact32(IntPtr pFolder, IntPtr pContact);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteContact")]
protected static extern bool FolderDeleteContact64(IntPtr pFolder, IntPtr pContact);
protected static bool FolderDeleteContact(IntPtr pFolder, IntPtr pContact)
{
if (IntPtr.Size * 8 == 32)
return FolderDeleteContact32(pFolder, pContact);
else
return FolderDeleteContact64(pFolder, pContact);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteAppointment")]
protected static extern bool FolderDeleteAppointment32(IntPtr pFolder, IntPtr pAppointment);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "FolderDeleteAppointment")]
protected static extern bool FolderDeleteAppointment64(IntPtr pFolder, IntPtr pAppointment);
protected static bool FolderDeleteAppointment(IntPtr pFolder, IntPtr pAppointment)
{
if (IntPtr.Size * 8 == 32)
return FolderDeleteAppointment32(pFolder, pAppointment);
else
return FolderDeleteAppointment64(pFolder, pAppointment);
}

#endregion

#region MAPIMessage DLLCalls

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageCreate")]
protected static extern bool MessageCreate32(IntPtr pMAPI, out IntPtr pMessage, int nImportance, bool bSaveToSentFolder, IntPtr pFolder);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageCreate")]
protected static extern bool MessageCreate64(IntPtr pMAPI, out IntPtr pMessage, int nImportance, bool bSaveToSentFolder, IntPtr pFolder);
protected static bool MessageCreate(IntPtr pMAPI, out IntPtr pMessage, int nImportance, bool bSaveToSentFolder, IntPtr pFolder)
{
if (IntPtr.Size * 8 == 32)
return MessageCreate32(pMAPI, out pMessage, nImportance, bSaveToSentFolder, pFolder);
else
return MessageCreate64(pMAPI, out pMessage, nImportance, bSaveToSentFolder, pFolder);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSend")]
protected static extern bool MessageSend32(IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSend")]
protected static extern bool MessageSend64(IntPtr pMessage);
protected static bool MessageSend(IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageSend32(pMessage);
else
return MessageSend64(pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageShowForm")]
protected static extern int MessageShowForm32(IntPtr pMAPI, IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageShowForm")]
protected static extern int MessageShowForm64(IntPtr pMAPI, IntPtr pMessage);
protected static int MessageShowForm(IntPtr pMAPI, IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageShowForm32(pMAPI, pMessage);
else
return MessageShowForm64(pMAPI, pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageIsUnread")]
protected static extern bool MessageIsUnread32(IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageIsUnread")]
protected static extern bool MessageIsUnread64(IntPtr pMessage);
protected static bool MessageIsUnread(IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageIsUnread32(pMessage);
else
return MessageIsUnread64(pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageMarkAsRead")]
protected static extern bool MessageMarkAsRead32(IntPtr pMessage, bool bRead);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageMarkAsRead")]
protected static extern bool MessageMarkAsRead64(IntPtr pMessage, bool bRead);
protected static bool MessageMarkAsRead(IntPtr pMessage, bool bRead)
{
if (IntPtr.Size * 8 == 32)
return MessageMarkAsRead32(pMessage, bRead);
else
return MessageMarkAsRead64(pMessage, bRead);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetHeader")]
protected static extern bool MessageGetHeader32(IntPtr pMessage, StringBuilder strHeader, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetHeader")]
protected static extern bool MessageGetHeader64(IntPtr pMessage, StringBuilder strHeader, int nMaxLength);
protected static bool MessageGetHeader(IntPtr pMessage, StringBuilder strHeader, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return MessageGetHeader32(pMessage, strHeader, nMaxLength);
else
return MessageGetHeader64(pMessage, strHeader, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSenderName")]
protected static extern void MessageGetSenderName32(IntPtr pMessage, StringBuilder strSenderName, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSenderName")]
protected static extern void MessageGetSenderName64(IntPtr pMessage, StringBuilder strSenderName, int nMaxLength);
protected static void MessageGetSenderName(IntPtr pMessage, StringBuilder strSenderName, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
MessageGetSenderName32(pMessage, strSenderName, nMaxLength);
else
MessageGetSenderName64(pMessage, strSenderName, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSenderEmail")]
protected static extern void MessageGetSenderEmail32(IntPtr pMessage, StringBuilder strSenderEmail, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSenderEmail")]
protected static extern void MessageGetSenderEmail64(IntPtr pMessage, StringBuilder strSenderEmail, int nMaxLength);
protected static void MessageGetSenderEmail(IntPtr pMessage, StringBuilder strSenderEmail, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
MessageGetSenderEmail32(pMessage, strSenderEmail, nMaxLength);
else
MessageGetSenderEmail64(pMessage, strSenderEmail, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSubject")]
protected static extern void MessageGetSubject32(IntPtr pMessage, StringBuilder strSubject, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSubject")]
protected static extern void MessageGetSubject64(IntPtr pMessage, StringBuilder strSubject, int nMaxLength);
protected static void MessageGetSubject(IntPtr pMessage, StringBuilder strSubject, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
MessageGetSubject32(pMessage, strSubject, nMaxLength);
else
MessageGetSubject64(pMessage, strSubject, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetReceivedTime")]
protected static extern bool MessageGetReceivedTime32(IntPtr pMessage, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetReceivedTime")]
protected static extern bool MessageGetReceivedTime64(IntPtr pMessage, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond);
protected static bool MessageGetReceivedTime(IntPtr pMessage, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond)
{
if (IntPtr.Size * 8 == 32)
return MessageGetReceivedTime32(pMessage, out nYear, out nMonth, out nDay, out nHour, out nMinute, out nSecond);
else
return MessageGetReceivedTime64(pMessage, out nYear, out nMonth, out nDay, out nHour, out nMinute, out nSecond);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetReceivedTimeString")]
protected static extern bool MessageGetReceivedTimeString32(IntPtr pMessage, StringBuilder strReceivedTime, int nMaxLength, string szFormat);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetReceivedTimeString")]
protected static extern bool MessageGetReceivedTimeString64(IntPtr pMessage, StringBuilder strReceivedTime, int nMaxLength, string szFormat);
protected static bool MessageGetReceivedTimeString(IntPtr pMessage, StringBuilder strReceivedTime, int nMaxLength, string szFormat)
{
if (IntPtr.Size * 8 == 32)
return MessageGetReceivedTimeString32(pMessage, strReceivedTime, nMaxLength, szFormat);
else
return MessageGetReceivedTimeString64(pMessage, strReceivedTime, nMaxLength, szFormat);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSubmitTime")]
protected static extern bool MessageGetSubmitTime32(IntPtr pMessage, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSubmitTime")]
protected static extern bool MessageGetSubmitTime64(IntPtr pMessage, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond);
protected static bool MessageGetSubmitTime(IntPtr pMessage, out int nYear, out int nMonth, out int nDay, out int nHour, out int nMinute, out int nSecond)
{
if (IntPtr.Size * 8 == 32)
return MessageGetSubmitTime32(pMessage, out nYear, out nMonth, out nDay, out nHour, out nMinute, out nSecond);
else
return MessageGetSubmitTime64(pMessage, out nYear, out nMonth, out nDay, out nHour, out nMinute, out nSecond);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSubmitTimeString")]
protected static extern bool MessageGetSubmitTimeString32(IntPtr pMessage, StringBuilder strSubmitTime, int nMaxLength, string szFormat);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSubmitTimeString")]
protected static extern bool MessageGetSubmitTimeString64(IntPtr pMessage, StringBuilder strSubmitTime, int nMaxLength, string szFormat);
protected static bool MessageGetSubmitTimeString(IntPtr pMessage, StringBuilder strSubmitTime, int nMaxLength, string szFormat)
{
if (IntPtr.Size * 8 == 32)
return MessageGetSubmitTimeString32(pMessage, strSubmitTime, nMaxLength, szFormat);
else
return MessageGetSubmitTimeString64(pMessage, strSubmitTime, nMaxLength, szFormat);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetTo")]
protected static extern bool MessageGetTo32(IntPtr pMessage, StringBuilder strTo, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetTo")]
protected static extern bool MessageGetTo64(IntPtr pMessage, StringBuilder strTo, int nMaxLength);
protected static bool MessageGetTo(IntPtr pMessage, StringBuilder strTo, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return MessageGetTo32(pMessage, strTo, nMaxLength);
else
return MessageGetTo64(pMessage, strTo, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetCC")]
protected static extern bool MessageGetCC32(IntPtr pMessage, StringBuilder strCC, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetCC")]
protected static extern bool MessageGetCC64(IntPtr pMessage, StringBuilder strCC, int nMaxLength);
protected static bool MessageGetCC(IntPtr pMessage, StringBuilder strCC, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return MessageGetCC32(pMessage, strCC, nMaxLength);
else
return MessageGetCC64(pMessage, strCC, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetBCC")]
protected static extern bool MessageGetBCC32(IntPtr pMessage, StringBuilder strBCC, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetBCC")]
protected static extern bool MessageGetBCC64(IntPtr pMessage, StringBuilder strBCC, int nMaxLength);
protected static bool MessageGetBCC(IntPtr pMessage, StringBuilder strBCC, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return MessageGetBCC32(pMessage, strBCC, nMaxLength);
else
return MessageGetBCC64(pMessage, strBCC, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSensitivity")]
protected static extern int MessageGetSensitivity32(IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetSensitivity")]
protected static extern int MessageGetSensitivity64(IntPtr pMessage);
protected static int MessageGetSensitivity(IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageGetSensitivity32(pMessage);
else
return MessageGetSensitivity64(pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetPriority")]
protected static extern int MessageGetPriority32(IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetPriority")]
protected static extern int MessageGetPriority64(IntPtr pMessage);
protected static int MessageGetPriority(IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageGetPriority32(pMessage);
else
return MessageGetPriority64(pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetImportance")]
protected static extern int MessageGetImportance32(IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetImportance")]
protected static extern int MessageGetImportance64(IntPtr pMessage);
protected static int MessageGetImportance(IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageGetImportance32(pMessage);
else
return MessageGetImportance64(pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetRecipients")]
protected static extern bool MessageGetRecipients32(IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetRecipients")]
protected static extern bool MessageGetRecipients64(IntPtr pMessage);
protected static bool MessageGetRecipients(IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageGetRecipients32(pMessage);
else
return MessageGetRecipients64(pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetNextRecipient")]
protected static extern bool MessageGetNextRecipient32(IntPtr pMessage, StringBuilder strName, int nMaxLenName, StringBuilder strEmail, int nMaxLenEmail, out int nType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetNextRecipient")]
protected static extern bool MessageGetNextRecipient64(IntPtr pMessage, StringBuilder strName, int nMaxLenName, StringBuilder strEmail, int nMaxLenEmail, out int nType);
protected static bool MessageGetNextRecipient(IntPtr pMessage, StringBuilder strName, int nMaxLenName, StringBuilder strEmail, int nMaxLenEmail, out int nType)
{
if (IntPtr.Size * 8 == 32)
return MessageGetNextRecipient32(pMessage, strName, nMaxLenEmail, strEmail, nMaxLenEmail, out nType);
else
return MessageGetNextRecipient64(pMessage, strName, nMaxLenEmail, strEmail, nMaxLenEmail, out nType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetReplyTo")]
protected static extern bool MessageGetReplyTo32(IntPtr pMessage, StringBuilder strEmail, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetReplyTo")]
protected static extern bool MessageGetReplyTo64(IntPtr pMessage, StringBuilder strEmail, int nMaxLength);
protected static bool MessageGetReplyTo(IntPtr pMessage, StringBuilder strEmail, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return MessageGetReplyTo32(pMessage, strEmail, nMaxLength);
else
return MessageGetReplyTo64(pMessage, strEmail, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetAttachmentCount")]
protected static extern int MessageGetAttachmentCount32(IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetAttachmentCount")]
protected static extern int MessageGetAttachmentCount64(IntPtr pMessage);
protected static int MessageGetAttachmentCount(IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageGetAttachmentCount32(pMessage);
else
return MessageGetAttachmentCount64(pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetAttachmentCID")]
protected static extern bool MessageGetAttachmentCID32(IntPtr pMessage, StringBuilder strAttachmentCID, int nMaxLength, int nIndex);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetAttachmentCID")]
protected static extern bool MessageGetAttachmentCID64(IntPtr pMessage, StringBuilder strAttachmentCID, int nMaxLength, int nIndex);
protected static bool MessageGetAttachmentCID(IntPtr pMessage, StringBuilder strAttachmentCID, int nMaxLength, int nIndex)
{
if (IntPtr.Size * 8 == 32)
return MessageGetAttachmentCID32(pMessage, strAttachmentCID, nMaxLength, nIndex);
else
return MessageGetAttachmentCID64(pMessage, strAttachmentCID, nMaxLength, nIndex);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetAttachmentName")]
protected static extern bool MessageGetAttachmentName32(IntPtr pMessage, StringBuilder strAttachmentName, int nMaxLength, int nIndex);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageGetAttachmentName")]
protected static extern bool MessageGetAttachmentName64(IntPtr pMessage, StringBuilder strAttachmentName, int nMaxLength, int nIndex);
protected static bool MessageGetAttachmentName(IntPtr pMessage, StringBuilder strAttachmentName, int nMaxLength, int nIndex)
{
if (IntPtr.Size * 8 == 32)
return MessageGetAttachmentName32(pMessage, strAttachmentName, nMaxLength, nIndex);
else
return MessageGetAttachmentName64(pMessage, strAttachmentName, nMaxLength, nIndex);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSaveAttachment")]
protected static extern bool MessageSaveAttachment32(IntPtr pMessage, string strFolder, int nIndex);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSaveAttachment")]
protected static extern bool MessageSaveAttachment64(IntPtr pMessage, string strFolder, int nIndex);
protected static bool MessageSaveAttachment(IntPtr pMessage, string strFolder, int nIndex)
{
if (IntPtr.Size * 8 == 32)
return MessageSaveAttachment32(pMessage, strFolder, nIndex);
else
return MessageSaveAttachment64(pMessage, strFolder, nIndex);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageDeleteAttachment")]
protected static extern bool MessageDeleteAttachment32(IntPtr pMessage, int nIndex);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageDeleteAttachment")]
protected static extern bool MessageDeleteAttachment64(IntPtr pMessage, int nIndex);
protected static bool MessageDeleteAttachment(IntPtr pMessage, int nIndex)
{
if (IntPtr.Size * 8 == 32)
return MessageDeleteAttachment32(pMessage, nIndex);
else
return MessageDeleteAttachment64(pMessage, nIndex);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetMessageStatus")]
protected static extern bool MessageSetMessageStatus32(IntPtr pMessage, int nMessageStatus);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetMessageStatus")]
protected static extern bool MessageSetMessageStatus64(IntPtr pMessage, int nMessageStatus);
protected static bool MessageSetMessageStatus(IntPtr pMessage, int nMessageStatus)
{
if (IntPtr.Size * 8 == 32)
return MessageSetMessageStatus32(pMessage, nMessageStatus);
else
return MessageSetMessageStatus64(pMessage, nMessageStatus);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageAddRecipient")]
protected static extern bool MessageAddRecipient32(IntPtr pMessage, string strEmail, int nType, string strAddrType);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageAddRecipient")]
protected static extern bool MessageAddRecipient64(IntPtr pMessage, string strEmail, int nType, string strAddrType);
protected static bool MessageAddRecipient(IntPtr pMessage, string strEmail, int nType, string strAddrType)
{
if (IntPtr.Size * 8 == 32)
return MessageAddRecipient32(pMessage, strEmail, nType, strAddrType);
else
return MessageAddRecipient64(pMessage, strEmail, nType, strAddrType);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetSubject")]
protected static extern void MessageSetSubject32(IntPtr pMessage, string strSubject);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetSubject")]
protected static extern void MessageSetSubject64(IntPtr pMessage, string strSubject);
protected static void MessageSetSubject(IntPtr pMessage, string strSubject)
{
if (IntPtr.Size * 8 == 32)
MessageSetSubject32(pMessage, strSubject);
else
MessageSetSubject64(pMessage, strSubject);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetSender")]
protected static extern void MessageSetSender32(IntPtr pMessage, string strSenderName, string strSenderEmail);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetSender")]
protected static extern void MessageSetSender64(IntPtr pMessage, string strSenderName, string strSenderEmail);
protected static void MessageSetSender(IntPtr pMessage, string strSenderName, string strSenderEmail)
{
if (IntPtr.Size * 8 == 32)
MessageSetSender32(pMessage, strSenderName, strSenderEmail);
else
MessageSetSender64(pMessage, strSenderName, strSenderEmail);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetReceivedTime")]
protected static extern bool MessageSetReceivedTime32(IntPtr pMessage, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond, bool bLocal);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetReceivedTime")]
protected static extern bool MessageSetReceivedTime64(IntPtr pMessage, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond, bool bLocal);
protected static bool MessageSetReceivedTime(IntPtr pMessage, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond, bool bLocal)
{
if (IntPtr.Size * 8 == 32)
return MessageSetReceivedTime32(pMessage, nYear, nMonth, nDay, nHour, nMinute, nSecond, bLocal);
else
return MessageSetReceivedTime64(pMessage, nYear, nMonth, nDay, nHour, nMinute, nSecond, bLocal);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetSubmitTime")]
protected static extern bool MessageSetSubmitTime32(IntPtr pMessage, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond, bool bLocal);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetSubmitTime")]
protected static extern bool MessageSetSubmitTime64(IntPtr pMessage, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond, bool bLocal);
protected static bool MessageSetSubmitTime(IntPtr pMessage, int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond, bool bLocal)
{
if (IntPtr.Size * 8 == 32)
return MessageSetSubmitTime32(pMessage, nYear, nMonth, nDay, nHour, nMinute, nSecond, bLocal);
else
return MessageSetSubmitTime64(pMessage, nYear, nMonth, nDay, nHour, nMinute, nSecond, bLocal);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageAddAttachment")]
protected static extern bool MessageAddAttachment32(IntPtr pMessage, string strPath, string strName, string strCID);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageAddAttachment")]
protected static extern bool MessageAddAttachment64(IntPtr pMessage, string strPath, string strName, string strCID);
protected static bool MessageAddAttachment(IntPtr pMessage, string strPath, string strName, string strCID)
{
if (IntPtr.Size * 8 == 32)
return MessageAddAttachment32(pMessage, strPath, strName, strCID);
else
return MessageAddAttachment64(pMessage, strPath, strName, strCID);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetReadReceipt")]
protected static extern bool MessageSetReadReceipt32(IntPtr pMessage, bool bSet, string strReceiverEmail);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetReadReceipt")]
protected static extern bool MessageSetReadReceipt64(IntPtr pMessage, bool bSet, string strReceiverEmail);
protected static bool MessageSetReadReceipt(IntPtr pMessage, bool bSet, string strReceiverEmail)
{
if (IntPtr.Size * 8 == 32)
return MessageSetReadReceipt32(pMessage, bSet, strReceiverEmail);
else
return MessageSetReadReceipt64(pMessage, bSet, strReceiverEmail);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetDeliveryReceipt")]
protected static extern bool MessageSetDeliveryReceipt32(IntPtr pMessage, bool bSet);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetDeliveryReceipt")]
protected static extern bool MessageSetDeliveryReceipt64(IntPtr pMessage, bool bSet);
protected static bool MessageSetDeliveryReceipt(IntPtr pMessage, bool bSet)
{
if (IntPtr.Size * 8 == 32)
return MessageSetDeliveryReceipt32(pMessage, bSet);
else
return MessageSetDeliveryReceipt64(pMessage, bSet);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageMarkAsPrivate")]
protected static extern bool MessageMarkAsPrivate32(IntPtr pMessage);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageMarkAsPrivate")]
protected static extern bool MessageMarkAsPrivate64(IntPtr pMessage);
protected static bool MessageMarkAsPrivate(IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MessageMarkAsPrivate32(pMessage);
else
return MessageMarkAsPrivate64(pMessage);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetSensitivity")]
protected static extern bool MessageSetSensitivity32(IntPtr pMessage, int nSensitivity);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "MessageSetSensitivity")]
protected static extern bool MessageSetSensitivity64(IntPtr pMessage, int nSensitivity);
protected static bool MessageSetSensitivity(IntPtr pMessage, int nSensitivity)
{
if (IntPtr.Size * 8 == 32)
return MessageSetSensitivity32(pMessage, nSensitivity);
else
return MessageSetSensitivity64(pMessage, nSensitivity);
}

#endregion

#region MAPIObject DLLCalls

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectClose")]
protected static extern void ObjectClose32(IntPtr pObject);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectClose")]
protected static extern void ObjectClose64(IntPtr pObject);
protected static void ObjectClose(IntPtr pObject)
{
if (IntPtr.Size * 8 == 32)
ObjectClose32(pObject);
else
ObjectClose64(pObject);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSave")]
protected static extern bool ObjectSave32(IntPtr pObject, bool bClose);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSave")]
protected static extern bool ObjectSave64(IntPtr pObject, bool bClose);
protected static bool ObjectSave(IntPtr pObject, bool bClose)
{
if (IntPtr.Size * 8 == 32)
return ObjectSave32(pObject, bClose);
else
return ObjectSave64(pObject, bClose);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetMessageFlags")]
protected static extern int ObjectGetMessageFlags32(IntPtr pObject);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetMessageFlags")]
protected static extern int ObjectGetMessageFlags64(IntPtr pObject);
protected static int ObjectGetMessageFlags(IntPtr pObject)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetMessageFlags32(pObject);
else
return ObjectGetMessageFlags64(pObject);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetEntryID")]
protected static extern bool ObjectGetEntryID32(IntPtr pObject, StringBuilder strEntryID, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetEntryID")]
protected static extern bool ObjectGetEntryID64(IntPtr pObject, StringBuilder strEntryID, int nMaxLength);
protected static bool ObjectGetEntryID(IntPtr pObject, StringBuilder strEntryID, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetEntryID32(pObject, strEntryID, nMaxLength);
else
return ObjectGetEntryID64(pObject, strEntryID, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetMessageClass")]
protected static extern bool ObjectGetMessageClass32(IntPtr pObject, StringBuilder szMessageClass, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetMessageClass")]
protected static extern bool ObjectGetMessageClass64(IntPtr pObject, StringBuilder szMessageClass, int nMaxLength);
protected static bool ObjectGetMessageClass(IntPtr pObject, StringBuilder szMessageClass, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetMessageClass32(pObject, szMessageClass, nMaxLength);
else
return ObjectGetMessageClass64(pObject, szMessageClass, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetMessageEditorFormat")]
protected static extern int ObjectGetMessageEditorFormat32(IntPtr pObject);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetMessageEditorFormat")]
protected static extern int ObjectGetMessageEditorFormat64(IntPtr pObject);
protected static int ObjectGetMessageEditorFormat(IntPtr pObject)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetMessageEditorFormat32(pObject);
else
return ObjectGetMessageEditorFormat64(pObject);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetPropertyString")]
protected static extern bool ObjectGetPropertyString32(IntPtr pObject, uint ulProperty, StringBuilder strProperty, int nMaxLength, bool bStream);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetPropertyString")]
protected static extern bool ObjectGetPropertyString64(IntPtr pObject, uint ulProperty, StringBuilder strProperty, int nMaxLength, bool bStream);
protected static bool ObjectGetPropertyString(IntPtr pObject, uint ulProperty, StringBuilder strProperty, int nMaxLength, bool bStream)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetPropertyString32(pObject, ulProperty, strProperty, nMaxLength, bStream);
else
return ObjectGetPropertyString64(pObject, ulProperty, strProperty, nMaxLength, bStream);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetNamedProperty")]
protected static extern bool ObjectGetNamedProperty32(IntPtr pObject, string strFieldName, StringBuilder strField, int nMaxLength);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetNamedProperty")]
protected static extern bool ObjectGetNamedProperty64(IntPtr pObject, string strFieldName, StringBuilder strField, int nMaxLength);
protected static bool ObjectGetNamedProperty(IntPtr pObject, string strFieldName, StringBuilder strField, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetNamedProperty32(pObject, strFieldName, strField, nMaxLength);
else
return ObjectGetNamedProperty64(pObject, strFieldName, strField, nMaxLength);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetBody")]
protected static extern bool ObjectGetBody32(IntPtr pObject, out IntPtr szBody, bool bAutoDetect);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetBody")]
protected static extern bool ObjectGetBody64(IntPtr pObject, out IntPtr szBody, bool bAutoDetect);
protected static bool ObjectGetBody(IntPtr pObject, out IntPtr szBody, bool bAutoDetect)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetBody32(pObject, out szBody, bAutoDetect);
else
return ObjectGetBody64(pObject, out szBody, bAutoDetect);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetHTML")]
protected static extern bool ObjectGetHTML32(IntPtr pObject, out IntPtr szHTML);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetHTML")]
protected static extern bool ObjectGetHTML64(IntPtr pObject, out IntPtr szHTML);
protected static bool ObjectGetHTML(IntPtr pObject, out IntPtr szHTML)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetHTML32(pObject, out szHTML);
else
return ObjectGetHTML64(pObject, out szHTML);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetRTF")]
protected static extern bool ObjectGetRTF32(IntPtr pObject, out IntPtr szRTF);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectGetRTF")]
protected static extern bool ObjectGetRTF64(IntPtr pObject, out IntPtr szRTF);
protected static bool ObjectGetRTF(IntPtr pObject, out IntPtr szRTF)
{
if (IntPtr.Size * 8 == 32)
return ObjectGetRTF32(pObject, out szRTF);
else
return ObjectGetRTF64(pObject, out szRTF);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectFreeBody")]
protected static extern void ObjectFreeBody32();
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectFreeBody")]
protected static extern void ObjectFreeBody64();
protected static void ObjectFreeBody()
{
if (IntPtr.Size * 8 == 32)
ObjectFreeBody32();
else
ObjectFreeBody64();
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetMessageFlags")]
protected static extern bool ObjectSetMessageFlags32(IntPtr pObject, int nFlags);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetMessageFlags")]
protected static extern bool ObjectSetMessageFlags64(IntPtr pObject, int nFlags);
protected static bool ObjectSetMessageFlags(IntPtr pObject, int nFlags)
{
if (IntPtr.Size * 8 == 32)
return ObjectSetMessageFlags32(pObject, nFlags);
else
return ObjectSetMessageFlags64(pObject, nFlags);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetMessageEditorFormat")]
protected static extern bool ObjectSetMessageEditorFormat32(IntPtr pObject, int nFormat);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetMessageEditorFormat")]
protected static extern bool ObjectSetMessageEditorFormat64(IntPtr pObject, int nFormat);
protected static bool ObjectSetMessageEditorFormat(IntPtr pObject, int nFormat)
{
if (IntPtr.Size * 8 == 32)
return ObjectSetMessageEditorFormat32(pObject, nFormat);
else
return ObjectSetMessageEditorFormat64(pObject, nFormat);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetPropertyString")]
protected static extern bool ObjectSetPropertyString32(IntPtr pObject, uint ulProperty, string strProperty, bool bStream);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetPropertyString")]
protected static extern bool ObjectSetPropertyString64(IntPtr pObject, uint ulProperty, string strProperty, bool bStream);
protected static bool ObjectSetPropertyString(IntPtr pObject, uint ulProperty, string strProperty, bool bStream)
{
if (IntPtr.Size * 8 == 32)
return ObjectSetPropertyString32(pObject, ulProperty, strProperty, bStream);
else
return ObjectSetPropertyString64(pObject, ulProperty, strProperty, bStream);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetNamedProperty")]
protected static extern bool ObjectSetNamedProperty32(IntPtr pObject, string strFieldName, string strField, bool bCreate);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetNamedProperty")]
protected static extern bool ObjectSetNamedProperty64(IntPtr pObject, string strFieldName, string strField, bool bCreate);
protected static bool ObjectSetNamedProperty(IntPtr pObject, string strFieldName, string strField, bool bCreate)
{
if (IntPtr.Size * 8 == 32)
return ObjectSetNamedProperty32(pObject, strFieldName, strField, bCreate);
else
return ObjectSetNamedProperty64(pObject, strFieldName, strField, bCreate);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetBody")]
protected static extern bool ObjectSetBody32(IntPtr pObject, string strBody);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetBody")]
protected static extern bool ObjectSetBody64(IntPtr pObject, string strBody);
protected static bool ObjectSetBody(IntPtr pObject, string strBody)
{
if (IntPtr.Size * 8 == 32)
return ObjectSetBody32(pObject, strBody);
else
return ObjectSetBody64(pObject, strBody);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetHTML")]
protected static extern bool ObjectSetHTML32(IntPtr pObject, string strHTML);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetHTML")]
protected static extern bool ObjectSetHTML64(IntPtr pObject, string strHTML);
protected static bool ObjectSetHTML(IntPtr pObject, string strHTML)
{
if (IntPtr.Size * 8 == 32)
return ObjectSetHTML32(pObject, strHTML);
else
return ObjectSetHTML64(pObject, strHTML);
}

[DllImport(NetMAPI.MAPIExDLL32, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetRTF")]
protected static extern bool ObjectSetRTF32(IntPtr pObject, string strRTF);
[DllImport(NetMAPI.MAPIExDLL64, CharSet = NetMAPI.DefaultCharSet, EntryPoint = "ObjectSetRTF")]
protected static extern bool ObjectSetRTF64(IntPtr pObject, string strRTF);
protected static bool ObjectSetRTF(IntPtr pObject, string strRTF)
{
if (IntPtr.Size * 8 == 32)
return ObjectSetRTF32(pObject, strRTF);
else
return ObjectSetRTF64(pObject, strRTF);
}

#endregion

#region NetMAPI DLLCalls
// These shouldn't be called directly by the client, use the interface in NetMAPI for this.

// Initialize and Terminate

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIInit")]
protected static extern bool MAPIInit32(bool bMultiThreadedNotifications, bool bInitAsService);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIInit")]
protected static extern bool MAPIInit64(bool bMultiThreadedNotifications, bool bInitAsService);
protected static bool MAPIInit(bool bMultiThreadedNotifications, bool bInitAsService)
{
if (IntPtr.Size * 8 == 32)
return MAPIInit32(bMultiThreadedNotifications, bInitAsService);
else
return MAPIInit64(bMultiThreadedNotifications, bInitAsService);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPITerm")]
protected static extern bool MAPITerm32();
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPITerm")]
protected static extern bool MAPITerm64();
protected static bool MAPITerm()
{
if (IntPtr.Size * 8 == 32)
return MAPITerm32();
else
return MAPITerm64();
}

// Profiles, Message Store

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPILogin")]
protected static extern IntPtr MAPILogin32(string strProfile, bool bInitAsService);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPILogin")]
protected static extern IntPtr MAPILogin64(string strProfile, bool bInitAsService);
protected static IntPtr MAPILogin(string strProfile, bool bInitAsService)
{
if (IntPtr.Size * 8 == 32)
return MAPILogin32(strProfile, bInitAsService);
else
return MAPILogin64(strProfile, bInitAsService);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPILogout")]
protected static extern void MAPILogout32(IntPtr pMAPI);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPILogout")]
protected static extern void MAPILogout64(IntPtr pMAPI);
protected static void MAPILogout(IntPtr pMAPI)
{
if (IntPtr.Size * 8 == 32)
MAPILogout32(pMAPI);
else
MAPILogout64(pMAPI);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenMessageStore")]
protected static extern bool MAPIOpenMessageStore32(IntPtr pMAPI, string strStore);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenMessageStore")]
protected static extern bool MAPIOpenMessageStore64(IntPtr pMAPI, string strStore);
protected static bool MAPIOpenMessageStore(IntPtr pMAPI, string strStore)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenMessageStore32(pMAPI, strStore);
else
return MAPIOpenMessageStore64(pMAPI, strStore);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetFolder")]
protected static extern IntPtr MAPIGetFolder32(IntPtr pMAPI);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetFolder")]
protected static extern IntPtr MAPIGetFolder64(IntPtr pMAPI);
protected static IntPtr MAPIGetFolder(IntPtr pMAPI)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetFolder32(pMAPI);
else
return MAPIGetFolder64(pMAPI);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPISetFolder")]
protected static extern IntPtr MAPISetFolder32(IntPtr pMAPI, IntPtr pFolder);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPISetFolder")]
protected static extern IntPtr MAPISetFolder64(IntPtr pMAPI, IntPtr pFolder);
protected static IntPtr MAPISetFolder(IntPtr pMAPI, IntPtr pFolder)
{
if (IntPtr.Size * 8 == 32)
return MAPISetFolder32(pMAPI, pFolder);
else
return MAPISetFolder64(pMAPI, pFolder);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetProfileName")]
protected static extern bool MAPIGetProfileName32(IntPtr pMAPI, StringBuilder strProfileName, int nMaxLength);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetProfileName")]
protected static extern bool MAPIGetProfileName64(IntPtr pMAPI, StringBuilder strProfileName, int nMaxLength);
protected static bool MAPIGetProfileName(IntPtr pMAPI, StringBuilder strProfileName, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetProfileName32(pMAPI, strProfileName, nMaxLength);
else
return MAPIGetProfileName64(pMAPI, strProfileName, nMaxLength);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetProfileEmail")]
protected static extern bool MAPIGetProfileEmail32(IntPtr pMAPI, StringBuilder strProfileEmail, int nMaxLength);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetProfileEmail")]
protected static extern bool MAPIGetProfileEmail64(IntPtr pMAPI, StringBuilder strProfileEmail, int nMaxLength);
protected static bool MAPIGetProfileEmail(IntPtr pMAPI, StringBuilder strProfileEmail, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetProfileEmail32(pMAPI, strProfileEmail, nMaxLength);
else
return MAPIGetProfileEmail64(pMAPI, strProfileEmail, nMaxLength);
}

// POOM functions
[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetPOOM")]
protected static extern IntPtr MAPIGetPOOM32(IntPtr pMAPI);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetPOOM")]
protected static extern IntPtr MAPIGetPOOM64(IntPtr pMAPI);
protected static IntPtr MAPIGetPOOM(IntPtr pMAPI)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetPOOM32(pMAPI);
else
return MAPIGetPOOM64(pMAPI);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "POOMGetContents")]
protected static extern bool POOMGetContents32(IntPtr pPOOM);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "POOMGetContents")]
protected static extern bool POOMGetContents64(IntPtr pPOOM);
protected static bool POOMGetContents(IntPtr pPOOM)
{
if (IntPtr.Size * 8 == 32)
return POOMGetContents32(pPOOM);
else
return POOMGetContents64(pPOOM);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "POOMSortContents")]
protected static extern bool POOMSortContents32(IntPtr pPOOM, bool bDescending, string strSortField);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "POOMSortContents")]
protected static extern bool POOMSortContents64(IntPtr pPOOM, bool bDescending, string strSortField);
protected static bool POOMSortContents(IntPtr pPOOM, bool bDescending, string strSortField)
{
if (IntPtr.Size * 8 == 32)
return POOMSortContents32(pPOOM, bDescending, strSortField);
else
return POOMSortContents64(pPOOM, bDescending, strSortField);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "POOMGetRowCount")]
protected static extern int POOMGetRowCount32(IntPtr pPOOM);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "POOMGetRowCount")]
protected static extern int POOMGetRowCount64(IntPtr pPOOM);
protected static int POOMGetRowCount(IntPtr pPOOM)
{
if (IntPtr.Size * 8 == 32)
return POOMGetRowCount32(pPOOM);
else
return POOMGetRowCount64(pPOOM);
}

// Folders
[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenFolder")]
protected static extern IntPtr MAPIOpenFolder32(IntPtr pMAPI, string folderName, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenFolder")]
protected static extern IntPtr MAPIOpenFolder64(IntPtr pMAPI, string folderName, bool bInternal);
protected static IntPtr MAPIOpenFolder(IntPtr pMAPI, string folderName, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenFolder32(pMAPI, folderName, bInternal);
else
return MAPIOpenFolder64(pMAPI, folderName, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenRootFolder")]
protected static extern IntPtr MAPIOpenRootFolder32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenRootFolder")]
protected static extern IntPtr MAPIOpenRootFolder64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenRootFolder(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenRootFolder32(pMAPI, bInternal);
else
return MAPIOpenRootFolder64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenInbox")]
protected static extern IntPtr MAPIOpenInbox32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenInbox")]
protected static extern IntPtr MAPIOpenInbox64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenInbox(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenInbox32(pMAPI, bInternal);
else
return MAPIOpenInbox64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenOutbox")]
protected static extern IntPtr MAPIOpenOutbox32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenOutbox")]
protected static extern IntPtr MAPIOpenOutbox64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenOutbox(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenOutbox32(pMAPI, bInternal);
else
return MAPIOpenOutbox64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenSentItems")]
protected static extern IntPtr MAPIOpenSentItems32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenSentItems")]
protected static extern IntPtr MAPIOpenSentItems64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenSentItems(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenSentItems32(pMAPI, bInternal);
else
return MAPIOpenSentItems64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenDeletedItems")]
protected static extern IntPtr MAPIOpenDeletedItems32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenDeletedItems")]
protected static extern IntPtr MAPIOpenDeletedItems64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenDeletedItems(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenDeletedItems32(pMAPI, bInternal);
else
return MAPIOpenDeletedItems64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenContacts")]
protected static extern IntPtr MAPIOpenContacts32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenContacts")]
protected static extern IntPtr MAPIOpenContacts64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenContacts(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenContacts32(pMAPI, bInternal);
else
return MAPIOpenContacts64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenDrafts")]
protected static extern IntPtr MAPIOpenDrafts32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenDrafts")]
protected static extern IntPtr MAPIOpenDrafts64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenDrafts(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenDrafts32(pMAPI, bInternal);
else
return MAPIOpenDrafts64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenCalendar")]
protected static extern IntPtr MAPIOpenCalendar32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenCalendar")]
protected static extern IntPtr MAPIOpenCalendar64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenCalendar(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenCalendar32(pMAPI, bInternal);
else
return MAPIOpenCalendar64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenJunkFolder")]
protected static extern IntPtr MAPIOpenJunkFolder32(IntPtr pMAPI, bool bInternal);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIOpenJunkFolder")]
protected static extern IntPtr MAPIOpenJunkFolder64(IntPtr pMAPI, bool bInternal);
protected static IntPtr MAPIOpenJunkFolder(IntPtr pMAPI, bool bInternal)
{
if (IntPtr.Size * 8 == 32)
return MAPIOpenJunkFolder32(pMAPI, bInternal);
else
return MAPIOpenJunkFolder64(pMAPI, bInternal);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetHierarchy")]
protected static extern bool MAPIGetHierarchy32(IntPtr pMAPI);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetHierarchy")]
protected static extern bool MAPIGetHierarchy64(IntPtr pMAPI);
protected static bool MAPIGetHierarchy(IntPtr pMAPI)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetHierarchy32(pMAPI);
else
return MAPIGetHierarchy64(pMAPI);
}

// Messages

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetContents")]
protected static extern bool MAPIGetContents32(IntPtr pMAPI);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetContents")]
protected static extern bool MAPIGetContents64(IntPtr pMAPI);
protected static bool MAPIGetContents(IntPtr pMAPI)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetContents32(pMAPI);
else
return MAPIGetContents64(pMAPI);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetRowCount")]
protected static extern int MAPIGetRowCount32(IntPtr pMAPI);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetRowCount")]
protected static extern int MAPIGetRowCount64(IntPtr pMAPI);
protected static int MAPIGetRowCount(IntPtr pMAPI)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetRowCount32(pMAPI);
else
return MAPIGetRowCount64(pMAPI);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPISortContents")]
protected static extern bool MAPISortContents32(IntPtr pMAPI, bool bAscending, int nSortField);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPISortContents")]
protected static extern bool MAPISortContents64(IntPtr pMAPI, bool bAscending, int nSortField);
protected static bool MAPISortContents(IntPtr pMAPI, bool bAscending, int nSortField)
{
if (IntPtr.Size * 8 == 32)
return MAPISortContents32(pMAPI, bAscending, nSortField);
else
return MAPISortContents64(pMAPI, bAscending, nSortField);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPISetUnreadOnly")]
protected static extern bool MAPISetUnreadOnly32(IntPtr pMAPI, bool bUnreadOnly);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPISetUnreadOnly")]
protected static extern bool MAPISetUnreadOnly64(IntPtr pMAPI, bool bUnreadOnly);
protected static bool MAPISetUnreadOnly(IntPtr pMAPI, bool bUnreadOnly)
{
if (IntPtr.Size * 8 == 32)
return MAPISetUnreadOnly32(pMAPI, bUnreadOnly);
else
return MAPISetUnreadOnly64(pMAPI, bUnreadOnly);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetNextMessage")]
protected static extern bool MAPIGetNextMessage32(IntPtr pMAPI, out IntPtr pMessage);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetNextMessage")]
protected static extern bool MAPIGetNextMessage64(IntPtr pMAPI, out IntPtr pMessage);
protected static bool MAPIGetNextMessage(IntPtr pMAPI, out IntPtr pMessage)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetNextMessage32(pMAPI, out pMessage);
else
return MAPIGetNextMessage64(pMAPI, out pMessage);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetNextContact")]
protected static extern bool MAPIGetNextContact32(IntPtr pMAPI, out IntPtr pContact);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetNextContact")]
protected static extern bool MAPIGetNextContact64(IntPtr pMAPI, out IntPtr pContact);
protected static bool MAPIGetNextContact(IntPtr pMAPI, out IntPtr pContact)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetNextContact32(pMAPI, out pContact);
else
return MAPIGetNextContact64(pMAPI, out pContact);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetNextAppointment")]
protected static extern bool MAPIGetNextAppointment32(IntPtr pMAPI, out IntPtr pAppointment);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetNextAppointment")]
protected static extern bool MAPIGetNextAppointment64(IntPtr pMAPI, out IntPtr pAppointment);
protected static bool MAPIGetNextAppointment(IntPtr pMAPI, out IntPtr pAppointment)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetNextAppointment32(pMAPI, out pAppointment);
else
return MAPIGetNextAppointment64(pMAPI, out pAppointment);
}

[DllImport(MAPIExDLL32, CharSet = DefaultCharSet, EntryPoint = "MAPIGetNextSubFolder")]
protected static extern bool MAPIGetNextSubFolder32(IntPtr pMAPI, out IntPtr pFolder, StringBuilder strFolder, int nMaxLength);
[DllImport(MAPIExDLL64, CharSet = DefaultCharSet, EntryPoint = "MAPIGetNextSubFolder")]
protected static extern bool MAPIGetNextSubFolder64(IntPtr pMAPI, out IntPtr pFolder, StringBuilder strFolder, int nMaxLength);
protected static bool MAPIGetNextSubFolder(IntPtr pMAPI, out IntPtr pFolder, StringBuilder strFolder, int nMaxLength)
{
if (IntPtr.Size * 8 == 32)
return MAPIGetNextSubFolder32(pMAPI, out pFolder, strFolder, nMaxLength);
else
return MAPIGetNextSubFolder64(pMAPI, out pFolder, strFolder, nMaxLength);
}

#endregion
Questionhow get only contact folder in outlook? Pin
Vijay Kumbhani1-May-13 21:43
Vijay Kumbhani1-May-13 21:43 
AnswerRe: how get only contact folder in outlook? Pin
Noel Dillabough2-May-13 3:46
Noel Dillabough2-May-13 3:46 
GeneralRe: how get only contact folder in outlook? Pin
Vijay Kumbhani2-May-13 18:05
Vijay Kumbhani2-May-13 18:05 
QuestionDoes MAPIEx supports miscellaneous fields "User Field 1" to "User Field 4" of outlook contacts Pin
mayur.ce27-Mar-13 19:47
mayur.ce27-Mar-13 19:47 
AnswerRe: Does MAPIEx supports miscellaneous fields "User Field 1" to "User Field 4" of outlook contacts Pin
Noel Dillabough28-Mar-13 2:22
Noel Dillabough28-Mar-13 2:22 
GeneralRe: Does MAPIEx supports miscellaneous fields "User Field 1" to "User Field 4" of outlook contacts Pin
mayur.ce28-Mar-13 3:23
mayur.ce28-Mar-13 3:23 
QuestionHow can I get Message_ID and I cannot find PR_SEARCH_ID in the project? Pin
liuliulyh14-Mar-13 17:04
liuliulyh14-Mar-13 17:04 
AnswerRe: How can I get Message_ID and I cannot find PR_SEARCH_ID in the project? Pin
Noel Dillabough15-Mar-13 7:49
Noel Dillabough15-Mar-13 7:49 
GeneralRe: How can I get Message_ID and I cannot find PR_SEARCH_ID in the project? Pin
liuliulyh17-Mar-13 14:26
liuliulyh17-Mar-13 14:26 
QuestionWhy does the mapi.Login() function make errors? Pin
liuliulyh6-Mar-13 17:47
liuliulyh6-Mar-13 17:47 
AnswerRe: Why does the mapi.Login() function make errors? Pin
Noel Dillabough7-Mar-13 5:19
Noel Dillabough7-Mar-13 5:19 
GeneralRe: Why does the mapi.Login() function make errors? Pin
liuliulyh7-Mar-13 13:57
liuliulyh7-Mar-13 13:57 
QuestionReplyTo Functionality missing Pin
sveeramaneni11-Feb-13 8:05
sveeramaneni11-Feb-13 8:05 
AnswerRe: ReplyTo Functionality missing [RESOLVED] Pin
sveeramaneni14-Feb-13 4:16
sveeramaneni14-Feb-13 4:16 
Questionbuild error under 64 bit Pin
max_nowak5-Feb-13 3:48
max_nowak5-Feb-13 3:48 
AnswerRe: build error under 64 bit Pin
Noel Dillabough14-Feb-13 5:54
Noel Dillabough14-Feb-13 5:54 
QuestionUsing MAPI form windows service Pin
Amol_B22-Jan-13 22:09
professionalAmol_B22-Jan-13 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.