public void PublishToMyWall() { try { attachment att = new attachment { name = "", href = "", caption = "has used the application", media = new List <attachment_media>() }; attachment_media_image attMEd = new attachment_media_image { src = "", href = "" }; att.media.Add(attMEd); action_link a = new action_link { text = "", href = "" }; IList <action_link> tempA = new List <action_link> { a }; fbService.Stream.PublishAsync(myWallTextBox.Text, att, tempA, null, 0, PublishAsyncCompleted, null); } catch (Exception) { } }
public void ProcessRequest(HttpContext context) { string message = "{*actor*} played this game"; string text = "Play Now"; string href = "http://yoururltoplaygamegere"; action_link link = new action_link(text, href); activity act = new activity(message, link); JavaScriptSerializer serializer = new JavaScriptSerializer(); context.Response.Write(serializer.Serialize(act)); context.Response.ContentType = "application/json"; }
public void publishTest4() { attachment attachment = new attachment(); attachment.caption = "www.youtube.com"; attachment.name = "ninja cat"; attachment.href = "http://www.youtube.com/watch?v=muLIPWjks_M"; attachment.description = "a sneaky cat"; attachment.properties = new List <attachment_property>() { new attachment_property { name = "category", value = new attachment_property_value { href = "http://www.youtube.com/browse?s=mp&t=t&c=15", text = "humor" } }, new attachment_property { name = "ratings", value = new attachment_property_value { text = "5 stars" } } }; attachment.media = new List <attachment_media>() { new attachment_media_video() { video_src = "http://www.youtube.com/v/fzzjgBAaWZw&hl=en&fs=1", preview_img = "http://img.youtube.com/vi/muLIPWjks_M/default.jpg?h=100&w=200&sigh=__wsYqEz4uZUOvBIb8g-wljxpfc3Q=", video_link = "http://www.youtube.com/watch?v=muLIPWjks_M", video_title = "ninja cat" } }; var link = new action_link(); link.href = "http://www.youtube.com/my_videos_upload"; link.text = "Upload a video"; var links = new List <action_link>() { link }; var actual = _api.Stream.Publish("Watch this video!", attachment, links, null, 0); Assert.IsNotNull(actual); }
public void publishTest3() { attachment attachment = new attachment(); attachment.caption = "www.icanhascheezburger.com"; attachment.name = "I am bursting with joy"; attachment.href = "http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/"; attachment.description = "a funny looking cat"; attachment.properties = new List <attachment_property>() { new attachment_property { name = "category", value = new attachment_property_value { href = "http://www.icanhascheezburger.com/category/humor", text = "humor" } }, new attachment_property { name = "ratings", value = new attachment_property_value { text = "5 stars" } } }; attachment.media = new List <attachment_media>() { new attachment_media_image() { src = "http://icanhascheezburger.files.wordpress.com/2009/03/funny-pictures-your-cat-is-bursting-with-joy1.jpg", href = "http://icanhascheezburger.com/2009/04/22/funny-pictures-bursting-with-joy/" } }; var link = new action_link(); link.href = "http://mine.icanhascheezburger.com/default.aspx?tiid=1192742&recap=1#step2"; link.text = "Recaption this"; var links = new List <action_link>() { link }; var actual = _api.Stream.Publish("testing stream.publish with image attachment", attachment, links, null, 0); Assert.IsNotNull(actual); }
public void PublishToAFriendWall() { try { attachment att = new attachment { // Name of link name = "", // URL of link href = "", caption = "", media = new List <attachment_media>() }; attachment_media_image attMEd = new attachment_media_image { // Image source src = "", // URL to go to if clicked href = "" }; att.media.Add(attMEd); action_link a = new action_link { text = "What's this", //URL to go to if clicked href = "" }; IList <action_link> tempA = new List <action_link> { a }; // Use the typed friend UID to publish the typed message fbService.Stream.PublishAsync(friendWallTextBox.Text, att, tempA, uidTextBox.Text, 0, PublishAsyncCompleted, null); } catch (Exception) { } }
public override void PostInserted(Post post) { // Send post to FaceBook try { ConnectSession session = new ConnectSession(ApiKey, AppSecret); session.SessionKey = SessionKey; if (session.IsConnected()) { Macros macros = new Macros(); Api api = new Api(session); string fullUrl = macros.FullUrl(post.Url); attachment attachment = new attachment(); attachment.name = post.Title; attachment.href = fullUrl; attachment.description = post.Excerpt("", "", "", 200); action_link link = new action_link(); link.href = fullUrl; link.text = "Read the full entry"; List <action_link> links = new List <action_link>(); links.Add(link); if (!String.IsNullOrEmpty(post.ImageUrl)) { attachment_media_image image = new attachment_media_image(); image.src = macros.FullUrl(post.ImageUrl); image.href = fullUrl; image.type = attachment_media_type.image; List <attachment_media> media = new List <attachment_media>(); media.Add(image); attachment.media = media; } foreach (long pageId in this.PageIdList) { try { api.Stream.Publish("", attachment, links, "", pageId); } catch (Exception ex) { Log.Error("Facebook Plugin", "Failed to submit status to Facebook. {0}", ex.Message); } } } else { Log.Error("Facebook Plugin", "Facebook Session ID not valid"); } } catch (Exception ex) { Log.Error("Facebook Plugin", "Failed to submit status to Facebook. {0}", ex.Message); } }