Highlighted
Absent Member.
Absent Member.
1502 views

Can MAPI script be used for simulating Outlook Calendar

Hi, I'm using LR 9.5 and I've successfully been able to simulate user logon to an Outlook profile and do simple ops like read/send/rec/del email but now I have a requirement to simulate user interaction with the Calendar objects such as meetings and appointments.

Does anyone know how to go about this? What about loading a list of contacts?

Any help is greatly appreciated.
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

Do you want to accurately simulate the MS Outlook Client to load test an MS Exchange Server?
0 Likes
Highlighted
Absent Member.
Absent Member.

Short sample script illustrating the use of LoadRunner MAPI functions

General Information
MAPI (Messaging Application Programming Interface) is the heart of Microsoft's messaging programs. To test this form of mailing service, you can use the MAPI template solution from LoadRunner.

The MAPI protocol will allow you to use simple MAPI functions to create the same requests made by Outlook to Exchange Server. Each MAPI function begins with a MAPI prefix:

Function Name Description
mapi_logon[_ex] Logs onto MS Exchange.
mapi_read_next_mail[_ex] Reads the next E-mail in the mailbox.
mapi_delete_mail[_ex] Deletes the current or selected E-mail entries.
mapi_get_property_sz[_ex] Obtains a property value from the MAPI sessions.
mapi_set_property_sz[_ex] Sets an MAPI attribute.
mapi_send_mail[_ex] Sends an E-mail to recipients.
mapi_logout[_ex] Logs out of MS Exchange.

For detailed syntax information on these functions, see the LoadRunner Function Reference (Help -> Function Reference).


Tips and Tricks
1. Does Outlook need to be running while the script is being executed?

Yes. Having Outlook open means the profile is authenticated on the server. The mapi_logon[_ex] function merely tells the MAPI libraries to use the specified profile with the provided password.

2. What MAPI parameters can be accessed with the mapi_get_property_sz and mapi_set_property_sz() commands?

These are the different parameters for mapi_get_property_sz() and mapi_get_property_sz() as defined in the header file:

#define MAPI_MESSAGE_ID "Message ID"
#define MAPI_FROM "From"
#define MAPI_SUBJECT "Subject"
#define MAPI_CONTENT "Content"
#define MAPI_RECIPIENT_COUNT "RecipientCount"
#define MAPI_FILE_COUNT "FileCount"

3. How do you read the body of an E-mail? The mapi_get_property_sz("Content") function does not work.

The mapi_get_property_sz function should be used in conjunction with the mapi_read_next_mail() function using the "save=body" argument.

Example:
mapi_read_next_mail("Next Mail","Show=all", "Peek=true", "Save=body", LAST);
lr_output_message("%s", mapi_get_property_sz("Content"));

4. What about Subject, attachments, etc.?

* Subject is available through mapi_get_property_sz("Subject");
* Attachments are saved in variables as mapi_attachment_1, mapi_attachment_2, and so on. The output of the following function will give information on which attachment is stored in what variable:

mapi_read_next_mail("Next Mail","Show=all", "Peek=true", "Save=body", LAST);

5. The mapi_get_property_sz("Message ID") function returned a Message ID with a long string of data that look encrypted. However, Outlook does display a nice and clean Message ID of an E-mail.

The Message ID that is returned from mapi_get_property_sz() may not be a cleanly formatted message. The format varies from one Mail Server to another. In the case of Outlook, the client understands the Message Format and interprets it accordingly. The mapi_get_property_sz() function gets the "Message ID" as returned from the server and does no parsing to the received data.

6. Is it possible to record with other protocols such as POP3/SMTP/IMAP?

If you wish to use a recording solution with the POP3/SMTP/IMAP protocols, you will need to reconfigure the MS Outlook:

1. Go to Tools -> Options and select the Mail Services tab.
2. Click on the "Reconfigure Mail Support" button at the bottom.
3. Select the "Internet Only" option and click .
4. You will then have to restart Outlook and add the Microsoft Exchange server as the default mail server.

Example:
Attached is a short sample script.

Add some points if this helped you
0 Likes
Highlighted
Absent Member.
Absent Member.


The sample script does not answer the question in the original post.

They were asking how (if possible) to add calendar appointments and contacts.

Do yu have a sample script for adding calendar and contacts?

I haven't found it in the manuals as yet.
Still looking.

Note from the manuals - the "StickyNote" example does create a "postit" note in Outlook but when I try to delete it (when it is open) Outlook 2003 crashes. I can delete it successfully from the "list of messages" though with no problem
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.