// Send a message to buyer. // Note we can send a message to multiple users in single API call. // See reference: AddMemberMessageAAQToPartner // http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/AddMemberMessageAAQToPartner.html // public static bool SendMessageToBuyer(AccountType account, String buyerId, String itemId, String subject, String body, bool emailCopyToSender, QuestionTypeCodeType questionType) { if (account == null || account.SellerApiContext == null) return false; AddMemberMessageAAQToPartnerCall apiCall = new AddMemberMessageAAQToPartnerCall(account.SellerApiContext); apiCall.ItemID = itemId; apiCall.MemberMessage = new MemberMessageType(); apiCall.MemberMessage.EmailCopyToSender = emailCopyToSender; apiCall.MemberMessage.QuestionType = questionType; StringCollection recipientIds = new StringCollection(); recipientIds.Add(buyerId); apiCall.MemberMessage.RecipientID = recipientIds; apiCall.MemberMessage.Subject = ""; apiCall.MemberMessage.Body = body; bool result = false; try { apiCall.AddMemberMessageAAQToPartner(apiCall.ItemID, apiCall.MemberMessage); result = true; } catch (System.Exception ex) { Logger.WriteSystemUserLog(string.Format("Error when sending message to buyer, msg={0}", ex.Message)); } Logger.WriteSystemLog(String.Format("Successfully sent message to buyer = {0}", buyerId)); return result; }
public void AddMemberMessageAAQToPartner() { AddMemberMessageAAQToPartnerCall api = new AddMemberMessageAAQToPartnerCall(apiContext); MemberMessageType memberMsg = new MemberMessageType(); memberMsg.Subject = "SDK Sanity Test ASQ"; memberMsg.Body = "SDK sanity test body"; memberMsg.DisplayToPublic = false; memberMsg.DisplayToPublicSpecified = true; memberMsg.EmailCopyToSender = false; memberMsg.EmailCopyToSenderSpecified = true; memberMsg.HideSendersEmailAddress = true; memberMsg.HideSendersEmailAddressSpecified = true; memberMsg.MessageType = MessageTypeCodeType.ContactEbayMember; memberMsg.QuestionType = QuestionTypeCodeType.General; memberMsg.RecipientID = new StringCollection(); memberMsg.RecipientID.Add(TestData.ApiUserID); // Make API call. ApiException gotException = null; // Negative test. try { api.AddMemberMessageAAQToPartner("1111111111", memberMsg); } catch (ApiException ex) { gotException = ex; } Assert.IsNotNull(gotException); }