/// <summary>
        /// Builds a SmartForward request by using the specified source folder Id, source server Id and forward mime information.
        /// </summary>
        /// <param name="sourceFolderId">Specify the folder id of original mail item being forwarded</param>
        /// <param name="sourceServerId">Specify the server Id of original mail item being forwarded</param>
        /// <param name="forwardMime">The total forward mime</param>
        /// <returns>Returns the SmartForward request instance</returns>
        internal static SmartForwardRequest CreateSmartForwardRequest(string sourceFolderId, string sourceServerId, string forwardMime)
        {
            SmartForwardRequest request = new SmartForwardRequest
            {
                RequestData = new Request.SmartForward
                {
                    ClientId = System.Guid.NewGuid().ToString(),
                    Source = new Request.Source { FolderId = sourceFolderId, ItemId = sourceServerId },
                    Mime = forwardMime
                }
            };

            request.SetCommandParameters(new Dictionary<CmdParameterName, object>
            {
                {
                    CmdParameterName.CollectionId, sourceFolderId
                },
                {
                    CmdParameterName.ItemId, sourceServerId
                }
            });
            return request;
        }
Example #2
0
 /// <summary>
 /// Create a SmartForwardRequest 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>
 /// <param name="source">Specified the SmartForwardSource</param>
 /// <returns>A SmartForwardRequest instance</returns>
 public static SmartForwardRequest CreateSmartForwardRequest(string accountId, string clientId, string mime, Request.Source source)
 {
     SmartForwardRequest request = new SmartForwardRequest();
     Request.SmartForward requestData = new Request.SmartForward
     {
         AccountId = accountId,
         ClientId = clientId,
         Mime = mime,
         Source = source
     };
     request.RequestData = requestData;
     return request;
 }
Example #3
0
 /// <summary>
 /// Create an empty SmartForwardRequest instance
 /// </summary>
 /// <returns>An empty SmartForwardRequest instance</returns>
 public static SmartForwardRequest CreateSmartForwardRequest()
 {
     SmartForwardRequest request = new SmartForwardRequest();
     Request.SmartForward requestData = new Request.SmartForward();
     request.RequestData = requestData;
     return request;
 }
 /// <summary>
 /// Forwards messages without retrieving the full, original message from the server.
 /// </summary>
 /// <param name="smartForwardRequest">The request for SmartForward operation.</param>
 /// <returns>The SmartForward response which is returned from the server.</returns>
 public SmartForwardResponse SmartForward(SmartForwardRequest smartForwardRequest)
 {
     SmartForwardResponse response = this.activeSyncClient.SmartForward(smartForwardRequest);
     Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null.");
     this.VerifyTransport();
     return response;
 }
 /// <summary>
 /// Forward messages without retrieving the full, original message from the server.
 /// </summary>
 /// <param name="request">A SmartForwardRequest object that contains the request information.</param>
 /// <returns>A SmartForwardResponse object.</returns>
 public SmartForwardResponse SmartForward(SmartForwardRequest request)
 {
     SmartForwardResponse response = this.activeSyncClient.SmartForward(request);
     Site.Assert.IsNotNull(response, "If the SmartForward command executes successfully, the response from server should not be null.");
     return response;
 }
        /// <summary>
        /// Create a SmartForward request.
        /// </summary>
        /// <param name="folderId">The value of the FolderId element.</param>
        /// <param name="serverId">The value of the ServerId element.</param>
        /// <param name="from">The value of the From element.</param>
        /// <param name="to">The value of the To element.</param>
        /// <param name="cc">The value of the Cc element.</param>
        /// <param name="bcc">The value of the Bcc element.</param>
        /// <param name="subject">The value of the Subject element.</param>
        /// <param name="content">The value of the Content element.</param>
        /// <returns>the SmartForward request.</returns>
        protected SmartForwardRequest CreateSmartForwardRequest(string folderId, string serverId, string from, string to, string cc, string bcc, string subject, string content)
        {
            SmartForwardRequest request = new SmartForwardRequest
            {
                RequestData = new Request.SmartForward
                {
                    ClientId = TestSuiteBase.ClientId,
                    Source = new Request.Source { FolderId = folderId, ItemId = serverId }
                }
            };

            string mime = Common.CreatePlainTextMime(from, to, cc, bcc, subject, content);
            request.RequestData.Mime = mime;
            request.SetCommandParameters(new Dictionary<CmdParameterName, object>
            {
                {
                    CmdParameterName.CollectionId, folderId
                },
                {
                    CmdParameterName.ItemId, serverId
                }
            });

            return request;
        }
        public void MSASCMD_S17_TC02_SmartForward_Fail()
        {
            Site.Assume.AreNotEqual<string>("12.1", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The AccountID element is not supported when the MS-ASProtocolVersion header is set to 12.1. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            Site.Assume.AreNotEqual<string>("14.0", Common.GetConfigurationPropertyValue("ActiveSyncProtocolVersion", this.Site), "The AccountID element is not supported when the MS-ASProtocolVersion header is set to 14.0. MS-ASProtocolVersion header value is determined using Common PTFConfig property named ActiveSyncProtocolVersion.");
            #region Call SendMail command to send one plain text email messages to user2.
            string emailSubject = Common.GenerateResourceName(Site, "subject");
            this.SendPlainTextEmail(null, emailSubject, this.User1Information.UserName, this.User2Information.UserName, null);
            #endregion

            #region Call Sync command to sync user2 mailbox changes
            this.SwitchUser(this.User2Information);
            SyncResponse syncChangeResponse = this.GetMailItem(this.User2Information.InboxCollectionId, emailSubject);
            string originalServerId = TestSuiteBase.FindServerId(syncChangeResponse, "Subject", emailSubject);
            #endregion

            #region Record user name, folder collectionId and item subject that are used in this case
            TestSuiteBase.RecordCaseRelativeItems(this.User2Information, this.User2Information.InboxCollectionId, emailSubject);
            #endregion

            #region Call SmartForward command to forward messages without retrieving the full, original message from the server
            // Create invalid SmartForward request
            SmartForwardRequest smartForwardRequest = new SmartForwardRequest
            {
                RequestData = new Request.SmartForward
                {
                    ClientId = System.Guid.NewGuid().ToString(),
                    Source = new Request.Source
                    {
                        FolderId = this.User2Information.InboxCollectionId,
                        ItemId = originalServerId
                    },
                    Mime = string.Empty,
                    AccountId = "InvalidValueAccountID"
                }
            };

            smartForwardRequest.SetCommandParameters(new Dictionary<CmdParameterName, object>
            {
                {
                    CmdParameterName.CollectionId, this.User2Information.InboxCollectionId
                },
                {
                    CmdParameterName.ItemId, "5:" + originalServerId
                }
            });

            SmartForwardResponse smartForwardResponse = this.CMDAdapter.SmartForward(smartForwardRequest);
            #endregion

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-ASCMD_R4408");

            // Verify MS-ASCMD requirement: MS-ASCMD_R4408
            // If SmartForward operation failed, server will return Status element in response, then MS-ASCMD_4408 is verified.
            Site.CaptureRequirementIfIsNotNull(
                smartForwardResponse.ResponseData.Status,
                4408,
                @"[In Status(SmartForward and SmartReply)] If the SmartForward command request [or SmartReply command request] fails, the Status element contains a code that indicates the type of failure.");
        }
        /// <summary>
        /// Forwards messages without retrieving the full, original message from the server.
        /// </summary>
        /// <param name="smartForwardRequest">A SmartForwardRequest object that contains the request information.</param>
        /// <returns>SmartForward command response.</returns>
        public SmartForwardResponse SmartForward(SmartForwardRequest smartForwardRequest)
        {
            SmartForwardResponse smartForwardResponse = this.activeSyncClient.SmartForward(smartForwardRequest);
            Site.Assert.IsNotNull(smartForwardResponse, "The SmartForward response returned from server should not be null.");

            return smartForwardResponse;
        }