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);
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' "
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
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
People who like this
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
People who like this
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
People who like this
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
People who like this
Your answer

Follow this Question
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