How to post multiple images to wall post

Apr 1, 2010 at 3:23 PM

Hi all,

I am trying to figure out how I post multiple images to the wall using Stream.Publish.

What gets posted is only the first image of the list. Here is some sample code:

List<Facebook.Rest.attachment_media> mediaAttachments = new List<Facebook.Rest.attachment_media>();
      
            
            Facebook.Rest.attachment_media_image previewImageAttachment = new Facebook.Rest.attachment_media_image();
            previewImageAttachment.href = WebCommon.GetLinkToApplication();
            previewImageAttachment.src = previewImage;
            previewImageAttachment.type = attachment_media_type.image;
            mediaAttachments.Add(previewImageAttachment);

            Facebook.Rest.attachment_media_image myImageAttachment = new Facebook.Rest.attachment_media_image();
            cinematrixImageAttachment.href = WebCommon.GetLinkToApplication();
            cinematrixImageAttachment.src = Consts.DOMAIN + @"images/logo.png";
            cinematrixImageAttachment.type = attachment_media_type.image;
            mediaAttachments.Add(myImageAttachment);
                
            Facebook.Rest.attachment attachemnt = new Facebook.Rest.attachment();
            attachemnt.name = "New Picture";
            attachemnt.caption = pictureName;
            attachemnt.href = WebCommon.GetLinkToApplication();
            attachemnt.description = string.Format(@"{0} Just posted something new", WebCommon.CurrentUserName);

            attachemnt.media = mediaAttachments;

            List<Facebook.Schema.action_link> actionLinks = new List<Facebook.Schema.action_link>();
            Facebook.Schema.action_link action = new Facebook.Schema.action_link();
            
            action.href = WebCommon.GetLinkToApplication();
            action.text =string.Format("Visit {0}'s Page", WebCommon.CurrentUserName);

            actionLinks.Add(action);
            
            string targetId = WebCommon.CurrentUserId.ToString();

            WebCommon.FacebookApi.Stream.Publish(message,
                                                attachemnt,
                                                actionLinks,
                                                targetId,
                                                WebCommon.CurrentUserId);

Apr 3, 2010 at 6:37 AM

I would also love to know how to do this!