hello,
i need help from anyone that has ever done and solved the problem when trying to use this API, and got an error of The Given Key Was Not Present...
i got an error when trying post to facebook timeline., the accesstoken, and facebookid already store in database.
and here is the code
public void SendComment(string p_strIdFB, string p_strMessage, string p_strWebLink, string p_strLinkAlias,
string p_strCaption, string p_strDescription, string p_strPictLink, string p_strIconLink, string p_strIdgods)
{
try
{
IDictionary<string, object> dict = new Dictionary<string, object>();
dict.Add("message", p_strMessage);
if (ConverterManager.ConvertEmptyTextIntoString(p_strWebLink, "") != "")
{
dict.Add("link", p_strWebLink);
if (ConverterManager.ConvertEmptyTextIntoString(p_strPictLink, "") != "")
{
dict.Add("picture", p_strPictLink);
}
if (ConverterManager.ConvertEmptyTextIntoString(p_strLinkAlias, "") != "")
{
dict.Add("name", p_strLinkAlias);
}
if (ConverterManager.ConvertEmptyTextIntoString(p_strCaption, "") != "")
{
dict.Add("caption", p_strCaption);
}
if (ConverterManager.ConvertEmptyTextIntoString(p_strDescription, "") != "")
{
dict.Add("description", p_strDescription);
}
}
if (ConverterManager.ConvertEmptyTextIntoString(p_strIconLink, "") != "")
{
dict.Add("icon", p_strIconLink);
}
string idgods = "";
idgods = p_strIdgods;
BLGodsProfile objBLGodsProfile = new BLGodsProfile();
tbmgodsprofile objGods = objBLGodsProfile.GetAccessToken(idgods);
var fwc = new FacebookClient(objGods.accesstoken);
FacebookWebClient ff = new FacebookWebClient(objGods.accesstoken);
ff.Post("/" + objGods.iduserfb + "/feed", dict);
}
catch(Exception ex)
{
Console.WriteLine("This User : {0} Got Error Posting Facebook : {1}",p_strIdgods, ex.Message);
}
}
and here is the code to posting it to facebook
private static void PostShoutToFb1(string p_strMessage, string idgods)
{
BLFb objBLFb = new BLFb(System.Configuration.ConfigurationManager.AppSettings["FbApiKey"],
System.Configuration.ConfigurationManager.AppSettings["FbApiSecret"]);
TdoFacebookUser objFbUser = objBLFb.GetFacebookUser();
try
{
objBLFb.comment(p_strMessage,idgods);
}
catch(Exception ex)
{
LogException(ex, "GodsFeed");
}
}
trims