SETFBML?

Sep 12, 2007 at 6:36 PM
What is the reason to use setfbml and are there any examples out there of it when using the framework?
Also looking for examples on sendrequest and sendnotification if anyone has them.

I have just started facebook development 2 days a go so its all a bit new to me.
Thanks for your time.

www.poker-bud.com
Sep 12, 2007 at 8:46 PM
Hey,

SetFBML is the function that you use when you want to publish anything to the user profile. So for example if you want to publish something to the user profile:
Me.FBService.SetFBML("Hello " & u.Name & " you have " & f.Count & " friend" & s)
If you are using IFrame you can also include FBML markup language so that you can give it a cool Facebook look.
Sep 12, 2007 at 9:34 PM
Ok still a bit confused why wouldn't i just have a label control in my application where i would set.
lblHeader.Text = ("Hello " + u.Name.ToString() + " you have " + f.Count.ToString() + " friend")

I guess I don't understand where the SetFBML is actually setting the data if that makes sense is there a working example I could see.
Sep 13, 2007 at 1:17 AM
Hello again,

The facebook API has two concepts that you should understand. One is the canvas page (which can be an IFrame or rendered FBML) and the other one is the profile page which only renders fbml.

To guarantee a better interface and standardization of the profile page, you have to use the setFBML routine to publish anything that you want for the profile.
Here follows an example
Protected Shadows Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
MyBase.Api = FACEBOOKAPIKEY
MyBase.Secret = FACEBOOK_SECRET
MyBase.Page_Load(sender, e)

If (Not IsPostBack) Then
Try
' Use the FacebookService Component to populate Friends
Dim u As Facebook.Entity.User = Me.FBService.GetUserInfo()
Dim f As Collection(Of Facebook.Entity.User) = Me.FBService.GetFriends()

Dim s As String = ""
If f.Count <> 1 Then
s = "s"
End If
'this makes it available at the canvas page and shows it in a label.
This page is the page of the main app (apps.facebook.com/yourAppName)
lblHelloWorld.Text = "Hello " & u.Name & " you have " & f.Count & " friend" & s & "..." & Me.FBService.SessionKey

'this publishes "Hello Ricardo Santos you have 214 friends" to the profile of this user.
Me.FBService.SetFBML("Hello " & u.Name & " you have " & f.Count & " friend" & s)
'You can also use setFBML("string", userID) which sets it to a specific user.
Catch e1 As Exception
Hope this helps.

If not take a look at the documentation here (http://www.codeplex.com/FacebookToolkit/Release/ProjectReleases.aspx?ReleaseId=5387)
Come back to me if you are still having problems with the concepts.



Throw
End Try
End If
End Sub
Sep 13, 2007 at 5:43 AM
So in the example that you gave if i am part of your application I would always see

"Hello Ricardo Santos you have 214 friends" (Assuming I am Ricardo)

On my profile under the name of your application?
Sep 13, 2007 at 8:04 AM
Ok it makes sense to me now. Now the next question is where would I find documention on the FBML Markup Language so I know what I can send in wiht SetFBML

Thanks
Sep 13, 2007 at 8:43 AM
Why does the following not work


string utf8Blurb = Encoding.UTF8.GetString(Encoding.Default.GetBytes(@"<fb:profile-action url=""http://msn.com"">click me</fb:profile-action>"));

_fbService.SetFBML(utf8Blurb);


doing _fbService.SetFBML("HELLO");

works fine but now i would like to start using the FML language.
Sep 13, 2007 at 9:51 AM
Hello!

there are several issues with the setFBML service.
First of all keep in mind that facebook does cache things, specially whatever it goes on the setFBML routine. There are ways around it, but it might end up being tricky. The profile page (the part of your app) is updated everytime you go to the canvas page.
Take a look at this to see what you can use http://wiki.developers.facebook.com/index.php/FBML
http://wiki.developers.facebook.com/index.php/Category:FBML_tags

Here is an example:
Me.FBService.SetFBML("<fb:subtitle><fb:action href='http://apps.facebook.com/ponanatest' >More Events</fb:action>Po Na Na Norwich</fb:subtitle><table border='0' cellpadding='0' cellspacing='0' name='MAINTABLE' style='height: 100%; margin: 0px; vertical-align: top;'><tr><td style=' height: 14px; text-align: left;' colspan='2'><b>Tuesday March 21st</b></td></tr><tr><td rowspan='3' style=' height: 100px; width: 110px; text-align: left; padding-top: 5px; padding-bottom: 7px;'><a href='#'>" & "<img border='0' src='http://www.ratethehottest.co.uk/ponanaApp/images/loveyourjob5cj.gif' width='100' height='100'></a></td><td style='vertical-align: top; padding-top: 2px; height: 70px;' ><a href='#'>Nearly new night is the finest funky soul night in Norwich. There will be a much better blurb HERE once it's complete...</a></td></tr><tr><td style='height: 15px;'>Free b4 10 | 8 after 12 | More later</td></tr><tr><td style='vertical-align: top; height: 15px; padding-bottom: 5px;' ><a href='#'>View Facebook Event</a></td></tr><tr><td style='text-align: left;' colspan='2'><a href='#'><span style='width: 160px;'><table border='0' cellpadding='0' cellspacing='0' style='border: 1px solid; border-color: #94a5c8 #1d326d #1d326d #94a5c8; background-color: #1032c8; width: 160px; text-align: center; margin: 0px; height: 14px'><tr><td style='text-align: center; color: #FFFFFF;'><font color='#FFFFFF'> Get VIP </font></td></tr></table></span></a></td></tr></table>")

This works fine. If you want to add certain things, just merge them in the string using the '&'
I am assuming you are using IFrame

Good luck,

Ricardo
Oct 29, 2007 at 6:27 PM
setfbml does not seem to work any longer. I tried the above code snippets. IT is returning string "1", which in wiki seems to indicate unknown error. I know sendnotification (or was it sendrequest) was dectivatd by facebook. Is this also deactivated? If so, what is best way to allow users to quickly add my app. are there any more updates coming to this dll?
thanks Frank
Developer
Oct 29, 2007 at 6:59 PM
Does anything at all work for you in SetFBML? Like, if you just type "hello" as the markup, does that get displayed? Also, what version of the toolkit are you running?

To answer your other questions, no, Facebook is not deactivating this method, and a new version of the toolkit should be coming out in about a week or so, hopefully.
Oct 29, 2007 at 10:00 PM
hello as markup - does not display. Facebook.dll, I am using 1.2.0.0, assembly version: 1.2.2742.25082
So far everything else I have tried is working great. I can send notifications, but what I really want to do is send invites, thus why I am trying to use SetFBML.

thanks for the quick response, Glad to hear about the new release. you guys rock!

frank
Developer
Oct 29, 2007 at 11:14 PM
This may not have been clear (partially because our documentation could use some work), but SetFBML only sets the markup for the application box that goes on a user's profile page. I could be wrong, but I don't think you can send invitations through that box. I think it has to be through your canvas page, or some other similar method. For those, you just have to create the markup like you would for normal HTML, embedded in the rest of your page.

Is that the problem, or did you already know all that and something else isn't working for you? Sorry, it's just hard to judge how much people know about this stuff when everyone is at a different level of experience.
Oct 30, 2007 at 3:01 PM
OK. sounds like that must be the problem. Duh right? So how do I send out invites. Right now I am just using send notification as a temporary thing, but I read some place that those have a limit on them each day, etc, so I was hoping to do this another way. Once a user has my app, I want them to be able to click a button and send invites to their friends from my app. Which command in facebook.dll should I use or is there a link where I can read how to do this? Sorry for confusing the problem in the first place.

thanks frank
Developer
Oct 30, 2007 at 3:35 PM
It depends if you're running a desktop or web app. If it's a web app, you have to either create a page with the multifriendselector tag on it (see http://wiki.developers.facebook.com/index.php/Fb:multi-friend-selector), or link to the full multi friend selector page. That link should explain the various methods.

If it's a desktop app, unfortunately you either need to get the newest version from source control (see the Source Code tab at the top of the page for more info), or code up something similar to what I made on your own. Facebook recently deprecated their old invitation system, and our implementation of the new system hasn't been released yet (that's one of the things coming in the new release). Anyway, if you get the newest version, there's a method called SendRequest which should do it. It basically just opens up a web browser with the multi friend selector on it, and the parameters are similar to those for the selector page, as described in the Facebook wiki.

It is a bit complicated, but that's just Facebook's way of making sure that people aren't totally spamming users with invites and everything. Let me know if you have any problems or questions. Good luck!