eBay Developers Program
  • Forums Sign in
  • My Account
    • My Developer Account
    • Solutions Directory
    • Applications Settings
  • Forums
    • Orders, Returns and Feedback
    • Java SDK for Trading API
    • Search
    • Selling
    • Talk to Your Fellow Devs
    • .Net SDK for Trading API
    • Tokens, Notifications, Messages
    • Feedback & Suggestions
  • Documentation
    • Release Notes
    • Finding API
    • Shopping API
    • Trading API
    • Large Merchant Services
    • Marketing Handbook
    • All Features Comparison
    • All API Documentation
  • Support
    • eBay SDKs
    • API Site Status
    • Program & News Blog
    • Compatible Application Check
    • Support Ticket
    • Knowledge Base
    • Developer Help Center
    • Search Details
  • Home
  • eBay Forums
  • eBay APIs: .NET SDK for Trading API /
avatar image

Question by owen1337 · Mar 27, 2017 at 02:40 AM · c#.NET.net sdk.net apiebay-apiphotopicture url upload

Sending a Picture Attachment in MemberMessageType?

Hi,

I'm trying to add a picture that was uploaded via EPS to "MessageMedia" inside MemberMessageType. Sending a message works fine but I found that MessageMedia was needed to send a picture.

So far I have this (I had to upload to Pastebin since the editor didn't keep the formatting);

https://pastebin.com/ckkKmMtt

but if I had the following below, I get the error " Cannot implicitly convert type 'eBay.Service.Core.Soap.MessageMediaType' to 'eBay.Service.Core.Soap.MessageMediaTypeCollection' "

https://pastebin.com/xM28EATr

GetImageURL is a string that has the returned FullURL of the image uploaded.

Has anyone managed to do this or have any idea? I can't seem to find a solution to this problem.

Thanks, Owen

People who like this

0
Comment
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by sree_developersupport · Mar 29, 2017 at 10:56 AM

Hi owen,

Thanks for your post.

You will need to create an instance of MessageMediaTypeCollection as shown below and add a MessageMediaType and provide EPS Url as MediaURL.

Please also refer to the documentation also: https://developer.ebay.com/devzone/xml/docs/reference/ebay/types/MessageMediaType.html

 MemberMessageType memberMessageType = new MemberMessageType();
 memberMessageType.MessageMedia = new MessageMediaTypeCollection();                
 
  MessageMediaType messageMediaType = new MessageMediaType();
  messageMediaType.MediaName = "Test";
  messageMediaType.MediaURL = "Your EPS URL";
  memberMessageType.MessageMedia.Add(messageMediaType);


Best Regards,

eBay Developer Support

Comment

People who like this

0 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by owen1337 · Mar 30, 2017 at 08:52 AM

Hi there,

Thank you for your reply. That worked great!

I've now got an issue in which I'm trying to add multiple eBay EPS URL's and it is only using one image from my loop, which attaches the same image twice.

This is what I'm doing; https://pastebin.com/5JAryYqt

Any ideas?

Thanks, Owen

Comment

People who like this

0 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by tes-990 · Mar 30, 2017 at 11:45 AM

Hi Owen,

You need to create a CollectionObject first as shown below:

 MessageMediaTypeCollection messageMediaTypeCollection = new MessageMediaTypeCollection();
 
 foreach (var eBayURLs in eBayImageURLs)
 {
     messageMediaType.MediaURL = eBayURLs; // Set the URL of the Image on eBays Servers
     messageMediaTypeCollection.Add( messageMediaType );
 }
 
 and then assign the MessageMedia Property with the Collection Value.
 memberMessageType.MessageMedia = messageMediaTypeCollection;

Hope this helps.

Best Regards,

eBay Developer Support

Comment

People who like this

0 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by owen1337 · Apr 10, 2017 at 02:26 AM

Hi tes,

Thank you for the example, however I've noticed that I have to create a new instance inside the foreach loop instead of creating it outside since it will keep adding the same object to memory each time it loops thus causing a duplicate again of the first eBayURL that it starts with.

Therefore;

 MessageMediaTypeCollection messageMediaTypeCollection = new MessageMediaTypeCollection();
  
  foreach (var eBayURLs in eBayImageURLs)
  {
      MessageMediaType messageMediaType = new MessageMediaType();
 
      messageMediaType.MediaURL = eBayURLs; // Set the URL of the Image on eBays Servers
 
      messageMediaTypeCollection.Add( messageMediaType );
  }

Thanks, Owen

Comment

People who like this

0 · Share
10 |600 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Operation Timeout of Ebay Motors Post from .NET SDK 1 Answer

Upload pictures .NET SDK - Error: Attachment request file is missing 11 Answers

API GetSessionID and FetchToken 2 Answers

ReviseFixedPriceItem remove scheduled time 1 Answer

What to put in the second parameter of AddtowatchLIst method 0 Answers


Support

Developer Help Center
eBay Developers Program Blog
API Site Status
Request Support
Knowledge Base
Developer Forums
eBay Software Development Kits

API Information

API License Agreement
API Documentation
API Call Limits
Marketing Handbook
API Features Comparison

Apps Center

Applications Directory
Solutions Directory

Social Media

     

Programs

About Us
Success Stories
Affiliate Developers
eBay Market Data Program
Developer Directory
Developer Jobs
Copyright 1999 - 2019 eBay Inc. All rights reserved. User Agreement | Privacy Policy.    Site Feedback
  • Anonymous
  • Login with eBay
  • Create
  • Ask a question
  • Forums
  • Buy APIs (BETA) - Browse
  • Buy APIs (BETA) - Order
  • Feedback, Comments, Suggestions
  • New Sell APIs - Account, Inventory, Catalog and Compliance
  • New Sell APIs - Fulfillment
  • New Sell APIs - Marketing, Analytics, Metadata
  • Post Order APIs - Cancellation
  • Post Order APIs - Inquiry, Case Management
  • Post Order APIs - Return
  • Talk to your fellow developers
  • Token, Messaging, Sandbox related issues
  • eBay APIs: .NET SDK for Trading API
  • eBay APIs: Java SDK for Trading API
  • eBay APIs: Orders, resolutions and feedback
  • eBay APIs: Search
  • eBay APIs: Selling
  • Explore
  • Tags
  • Questions
  • Users
  • Badges