Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebookSDK - How to output results from a facebook call?
    primarykey
    data
    text
    <p>I am using FacebookSDK (ASP.Net MVC Facebook Canvas Application) and I am just trying to output the video id from two videos I have uploaded to Facebook. Using the SDK I have successfully retrieved the videos and it says it has the two videos however I am not sure how to write the code to grab and output the video ids themselves?</p> <p>My <i>Action</i> looks like this:</p> <p><pre><code> FacebookApp app = new FacebookApp();<br /> dynamic parameters = new ExpandoObject();<br /> parameters.fields = "id,videos";<br /> dynamic result = app.Api("me", parameters);<br /> return View(result); </code></pre><br /></p> <p>When I step through the code in ASP.Net and mouse over result after it has called app.API it says I have a Facebook.JsonObject with two items in it. One is my facebook userid the other is another Facebook.JsonObject with the two videos inside it. So my conclusion is that it is returning the user id and the videos associated to that user. That makes sense, but what is the best approach in outputting these types of structures?</p> <p>My <i>View</i> looks like this:</p> <p><pre> &lt;%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<code>&lt;dynamic&gt;</code>" %></p> <code>&lt;% foreach (var video in Model) { %&gt; &lt;object width="352" height="221" &gt; &lt;param name="allowfullscreen" value="true" /&gt; &lt;param name="allowscriptaccess" value="always" /&gt; &lt;param name="movie" value="http://www.facebook.com/v/&lt;%: video.id %&gt;" /&gt; &lt;embed src="http://www.facebook.com/v/&lt;%: video.id %&gt;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="352" height="221"&gt;&lt;/embed&gt; &lt;/object&gt; &lt;% } %&gt; </code></pre> <p>The above <i>View</i> is not working with an error saying it cannot find video.id. My guess is that I need to understand dynamic data types better and how the Facebook.JsonObject works.</p> <p>Anybody that has experience using the FacebookSDK and can help me to extract the video id from my facebook videos I would be much appreciated.</p> <p>Do I need to create a separate ViewModel Class specifically that has a user id and List type that holds the videos??</p> <p>Cheers Rob</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload