question

owen1337 avatar image
0 Likes"
owen1337 asked

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][1] 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 [1]: https://pastebin.com/xM28EATr
ebay-api.NETc#.net sdk.net apiphotopicture url upload
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sree_developersupport avatar image
0 Likes"
sree_developersupport answered
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
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

owen1337 avatar image
0 Likes"
owen1337 answered
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
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tes-990 avatar image
0 Likes"
tes-990 answered
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
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

owen1337 avatar image
0 Likes"
owen1337 answered
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
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.