Microsoft.Protocols.TestSuites.MS_ASAIRS.TestSuiteHelper.CreateMeetingRequestMime C# (CSharp) Method

CreateMeetingRequestMime() static private method

Create a meeting request mime
static private CreateMeetingRequestMime ( string from, string to, string subject, string body, string icalendarContent ) : string
from string The from address of mail
to string The to address of the mail
subject string The subject of the mail
body string The body content of the mail
icalendarContent string The content of iCalendar required by this meeting
return string
        internal static string CreateMeetingRequestMime(string from, string to, string subject, string body, string icalendarContent)
        {
            string meetingRequestMime =
@"From: {0}
To: {1}
Subject: {2}
Content-Type: multipart/alternative;
    boundary=""_001_MSASEMAIL_NextPart_""
MIME-Version: 1.0

--_001_MSASEMAIL_NextPart_
Content-Type: text/plain; charset=""us-ascii""

{3}

--_001_MSASEMAIL_NextPart_
Content-Type: text/calendar; charset=""us-ascii""; method=REQUEST

{4}

--_001_MSASEMAIL_NextPart_--

";
            return Common.FormatString(meetingRequestMime, from, to, subject, body, icalendarContent);
        }

Usage Example

Example #1
0
        /// <summary>
        /// Send a meeting request email.
        /// </summary>
        /// <param name="subject">The subject of email</param>
        /// <param name="calendar">The meeting calendar</param>
        private void SendMeetingRequest(string subject, Calendar calendar)
        {
            string emailBody = Common.GenerateResourceName(Site, "content");
            string icalendarFormatContent = TestSuiteHelper.CreateiCalendarFormatContent(calendar);

            string meetingEmailMime = TestSuiteHelper.CreateMeetingRequestMime(
                calendar.OrganizerEmail,
                calendar.Attendees.Attendee[0].Email,
                subject,
                emailBody,
                icalendarFormatContent);

            Request.SendMail sendMail = new Request.SendMail();

            sendMail.ClientId = Guid.NewGuid().ToString("N");
            sendMail.Mime     = meetingEmailMime;

            SendMailRequest sendMailRequest = Common.CreateSendMailRequest();

            sendMailRequest.RequestData = sendMail;

            this.SwitchUser(this.User1Information, false);
            SendMailResponse response = this.ASAIRSAdapter.SendMail(sendMailRequest);

            Site.Assert.AreEqual <string>(
                string.Empty,
                response.ResponseDataXML,
                "The server should return an empty xml response data to indicate SendMail command success.");
        }