(Original) Ce mapi instance description-how to get all messages in inbox (2)

Source: Internet
Author: User

Step 3: Obtain the folder. Take drafts as an example.
lpspropvalue rgprops = NULL;
ulong ulvalues = 0;
// set the folder we want to use. For details, refer to the msdn introduction to imsgstore, here I will list the attribute values of several commonly used Folder:
// pr_ce_ipm_drafts_entryid drafts, draft box
// inbox, inbox
// pr_ipm_outbox_entryid outbox, sender
// pr_ipm_sentmail_entryid sentbox. What is the mail box? Is the box where the sent message is placed.
// pr_ipm_wastebasket_entryid bin
ulong rgtags [] = {1, pr_ce_ipm_drafts_entryid};

// Obtain the entry ID of the folder and obtain the object through openentry.
Pmsgstore-> getprops (lpsproptagarray) rgtags, mapi_unicode, & ulvalues, & rgprops );
Pmsgstore-> openentry (rgprops [0]. value. bin. CB, (lpentryid) rgprops [0]. value. bin. LPB, null, mapi_modify, null, (lpunknown *) pfolder );
Mapifreebuffer (rgprops );
In this way, I got the desired folder, and the last thing left is to traverse the message. In fact, the process is very similar to the process of getting the store.

Step 4: get the message.
 Lpmapitable ptable = NULL;
Lpsrowset prows = NULL;
Ulong ulnumcols = 1;
// Specify the entry ID attribute.
Sizedsproptagarray (ulnumcols, columns) =
{
Ulnumcols,
Pr_entryid
};

pfolder-> getcontentstable (0, & ptable);
hR = ptable-> setcolumns (lpsproptagarray) & columns, 0 );
// The Code shows that it is similar to the method used to obtain message store, only one is from the session object, and the other is from the folder.

while (succeeded (ptable-> queryrows (1, 0, & prows)
{< br> lpmessage PMSG = NULL;
ulong ulmesagetype;
// obtain the iMessage object through openentry
pfolder-> openentry (prows-> Arow [0]. lpprops [0]. value. bin. CB,
(lpentryid) prows-> Arow [0]. lpprops [0]. value. bin. LPB,
null,
mapi_best_access,
& ulmesagetype,
(lpunknown *) & PMSG );
// each iMessage object obtained here represents each message in the folder. You can perform operations on it. To obtain the desired information.
......
// release note when not required
PMSG-> release ();
freeprows (prows);
prows = NULL;
}< br> If (prows)
{< br> freeprows (prows);
}< br> If (ptable)
{< br> ptable-> release ();
}

Finally, I wrote it for the first time. I don't know what to say. If something is wrong, please correct it.

Bored customers
2005.8.11
Yzx0023@gmail.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.