exclude_ids in invitation fbml page

Oct 25, 2007 at 11:10 AM

I have an IFrame application. Iframe based pages are working fine. But for inviting people, I created a page which derived from Facebook.WebControls.CanvasFBMLBasePage base class. On that page I put a literal control. And on page load I want to exclude the ids who already installed my appl. As you will see in below, it is so simple. But the below code does not work. Facebook popups an error says "unable to load invite.aspx?fbforcemode=fbml"

But when I manually type exclude ids, (replace excludeids='"+appUsers +"' part with excludeids='1212312,234243,2342342' ) it works.
Since it is FBML page I can not see the error caused this. But my test showed me that, whenever I call GetAppUsers() function, my invite page gives error. I tested this function by placing it on IFrame based page. this method gives me all the IDs as comma seperated. I copy the returned array and paste in exclude_ids attribute, than it works!!

I stopped. Could not find anyway..

Can you please help!

string appUsers = GetAppUsers();

mfSelector.Text="<fb:fbml><fb:request-form action='http://apps.facebook.com/hangidizi/' method='POST' invite='true' type='Hangi Dizi?' content=\"Ben en sevdigim diziyi sectim. Sende sec, bakalim ne kadar uyusuyor zevklerimiz. <fb:req-choice url='http://www.facebook.com/add.php?apikey=d43b5479ea3b7cc36f5c2bf479886366' label='En guzel dizi hangisi ' />\"><fb:multi-friend-selector showborder='false' actiontext='Bu uygulamayı yüklemesini istediğin arkadaşlarını seç.' excludeids='"+appUsers +"' max='20'></fb:request-form></fb:fbml>";

private string GetAppUsers()
string myFQLstring;
string myXMLString;
string friends = "";

myFQLstring = "SELECT uid FROM user WHERE hasaddedapp = 1 AND uid IN (SELECT uid2 FROM friend WHERE uid1 ='" + this.FBService.GetLoggedInUser() + "')";

myXMLString = this.FBService.DirectFQLQuery(myFQLstring);

DataSet MyDataSet;
System.IO.StringReader myXMLreader = new System.IO.StringReader(myXMLString);
DataView myDataView;

MyDataSet = new DataSet();

if (MyDataSet.Tables"user" != null)
myDataView = new DataView(MyDataSet.Tables"user");

foreach (DataRow drow in myDataView.Table.Rows)
friends += drow"uid".ToString() + ",";


if (friends.Length > 0)
friends = friends.TrimEnd(',');

//DataTable dtFriends = cls.GetData("Select * From fbDiziOylama Where UserID IN (" + friends + ")");



catch { }

return friends;


Oct 25, 2007 at 2:47 PM
From what I can tell, the code looks good, and when I test your GetAppUsers method, it seems to work fine (at least when it returns one user).

Try running the app, or at least part of it, on your local machine, and print out that string you're passing to mfSelector.Text to the console (Console.Writeline()). My first guess is that something is getting messed up with the quotes around the user ids, but I can't see anything in the code as your have it above that would do that. Anyway, make sure you print out the exact string you're passing in (either do Console.Writeline(mfSelector.text) or Console.Writeline("<fb:fbml><fb:request-form ...."), and check out that user id part to see if anything looks strange.

If that fails, maybe trying doing a string.Compare() on both the generated string, and the one you manually typed in. If they really are the same, then string.Compare should at least say so. That at least gives you a bit of a sanity check to see where the error is happening. Try outputting the strings to the console like I mentioned above, though, and let me know what you figure out.