Beispiel #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.");
        }
        /// <summary>
        /// Builds a SendMail request by using the specified client Id, copyToSentItems option and mail mime content.
        /// In general, returns the XML formatted Sync request as follows:
        /// <!--
        /// <?xml version="1.0" encoding="utf-8"?>
        /// <SendMail xmlns="ComposeMail">
        ///   <ClientId>3</ClientId>
        ///   <SaveInSentItems/>
        ///   <Mime>....</Mime>
        /// </SendMail>
        /// -->
        /// </summary>
        /// <param name="clientId">Specify the client Id</param>
        /// <param name="saveInSentItems">Specify whether needs to store a mail copy to sent items</param>
        /// <param name="mime">Specify the mail mime</param>
        /// <returns>Returns the SendMailRequest instance</returns>
        internal static SendMailRequest CreateSendMailRequest(string clientId, bool saveInSentItems, string mime)
        {
            Request.SendMail sendMail = new Request.SendMail
            {
                SaveInSentItems = saveInSentItems ? string.Empty : null,
                ClientId        = clientId,
                Mime            = mime
            };

            SendMailRequest sendMailRequest = Common.CreateSendMailRequest();

            sendMailRequest.RequestData = sendMail;
            return(sendMailRequest);
        }
        public void MSASCMD_S21_TC08_CommonStatusCode_103()
        {
            #region Call SendMail command without Mime and AccountID.
            Request.SendMail sendMail = new Request.SendMail
            {
                ClientId = TestSuiteBase.ClientId
            };

            SendMailRequest request = new SendMailRequest();
            request.RequestData = sendMail;

            if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("12.1"))
            {
                try
                {
                    SendMailResponse response = this.CMDAdapter.SendMail(request);
                }
                catch (System.Net.WebException ex)
                {
                    this.Site.CaptureRequirementIfAreEqual <HttpStatusCode>(
                        HttpStatusCode.BadRequest,
                        ((HttpWebResponse)ex.Response).StatusCode,
                        7547,
                        @"[In Common Status Codes] When protocol version 2.5, 12.0, or 12.1 is used, an HTTP 400 response is returned instead of this status value [103].");
                }
            }
            if (Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.0") ||
                Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("14.1") ||
                Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site).Equals("16.0"))
            {
                SendMailResponse response = this.CMDAdapter.SendMail(request);

                this.Site.CaptureRequirementIfAreEqual <int>(
                    103,
                    int.Parse(response.ResponseData.Status),
                    4817,
                    @"[In Common Status Codes] When the protocol version is 14.0, 14.1 or 16.0,  [The meaning of the status value 103 is] The XML provided in the request does not follow the protocol requirements.");
            }
            #endregion
        }
        /// <summary>
        /// Builds a SendMail request by using the specified client Id, copyToSentItems option and mail mime content.
        /// In general, returns the XML formatted Sync request as follows:
        /// <!--
        /// <?xml version="1.0" encoding="utf-8"?>
        /// <SendMail xmlns="ComposeMail">
        ///   <ClientId>3</ClientId>
        ///   <SaveInSentItems/>
        ///   <Mime>....</Mime>
        /// </SendMail>
        /// -->
        /// </summary>
        /// <param name="clientId">Specify the client Id</param>
        /// <param name="saveInSentItems">Specify whether needs to store a mail copy to sent items</param>
        /// <param name="mime">Specify the mail mime</param>
        /// <returns>Returns the SendMailRequest instance</returns>
        internal static SendMailRequest CreateSendMailRequest(string clientId, bool saveInSentItems, string mime)
        {
            Request.SendMail sendMail = new Request.SendMail
            {
                SaveInSentItems = saveInSentItems ? string.Empty : null,
                ClientId = clientId,
                Mime = mime
            };

            SendMailRequest sendMailRequest = Common.CreateSendMailRequest();
            sendMailRequest.RequestData = sendMail;
            return sendMailRequest;
        }
        /// <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.");
        }
Beispiel #6
0
 /// <summary>
 /// Create a SendMailRequest instance using specified information
 /// </summary>
 /// <param name="accountId">Specified the account Id</param>
 /// <param name="clientId">Specified the client Id</param>
 /// <param name="mime">Specified the mime</param>
 /// <returns>A SendMailRequest instance</returns>
 public static SendMailRequest CreateSendMailRequest(string accountId, string clientId, string mime)
 {
     SendMailRequest request = new SendMailRequest();
     Request.SendMail requestData = new Request.SendMail
     {
         AccountId = accountId,
         ClientId = clientId,
         Mime = mime
     };
     request.RequestData = requestData;
     return request;
 }
Beispiel #7
0
 /// <summary>
 /// Create an empty SendMailRequest instance
 /// </summary>
 /// <returns>An empty SendMailRequest instance</returns>
 public static SendMailRequest CreateSendMailRequest()
 {
     SendMailRequest request = new SendMailRequest();
     Request.SendMail requestData = new Request.SendMail();
     request.RequestData = requestData;
     return request;
 }
        /// <summary>
        /// Builds a SendMail request by using the specified client Id, copyToSentItems option and mail mime content.
        /// In general, returns the XML formatted Sync request as follows:
        /// <!--
        /// <?xml version="1.0" encoding="utf-8"?>
        /// <SendMail xmlns="ComposeMail">
        ///   <ClientId>3</ClientId>
        ///   <SaveInSentItems/>
        ///   <Mime>....</Mime>
        /// </SendMail>
        /// -->
        /// </summary>
        /// <param name="clientId">Specify the client Id</param>
        /// <param name="copyToSentItems">Specify whether needs to store a mail copy to sent items</param>
        /// <param name="mime">Specify the mail mime</param>
        /// <returns>Returns the SendMailRequest instance</returns>
        internal static SendMailRequest CreateSendMailRequest(string clientId, bool copyToSentItems, string mime)
        {
            Request.SendMail sendMail = new Request.SendMail();

            // If true, save a copy to sent items folder, if false, doesn't save a copy to sent items folder
            if (copyToSentItems)
            {
                sendMail.SaveInSentItems = string.Empty;
            }

            sendMail.ClientId = clientId;
            sendMail.Mime = mime;

            SendMailRequest sendMailRequest = Common.CreateSendMailRequest();
            sendMailRequest.RequestData = sendMail;
            return sendMailRequest;
        }