asp.net - How to Send a Message to a Facebook Group With a Shared User -
there many duplicates doing this, want able share post without user logging in facebook user rather have him use website's dedicated facebook user, manage groups sharing to.
also, if possible, have login process of dedicated user automated in background - user choose share , that's it.
i'm using c# facebook sdk can't figure out how it.
code sample requires client logged in, works user, not dedicated one:
if (request["code"] == null) { response.redirect(string.format( "https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&scope={2}", app_id, redirecturi, scope)); } else { list<publishedjobsupplier> lst = new list<publishedjobsupplier>(); using (cardsmanagementserviceclient cms = cardsmanagementserviceclient.getservice(transactioncode)) { lst = cms.supplierslistgetbypublishedjob(transactioncode, jobid); } string groupname = lst[lst.count - 1].suppliername; dictionary<string, string> tokens = new dictionary<string, string>(); string url = string.format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}", app_id, redirecturi, scope, request["code"].tostring(), app_secret); httpwebrequest request = webrequest.create(url) httpwebrequest; using (httpwebresponse response = request.getresponse() httpwebresponse) { streamreader reader = new streamreader(response.getresponsestream()); string vals = reader.readtoend(); foreach (string token in vals.split('&')) { //meh.aspx?token1=steve&token2=jake&... separates tokens. tokens.add(token.substring(0, token.indexof("=")), token.substring(token.indexof("=") + 1, token.length - token.indexof("=") - 1)); } } string access_token = tokens["access_token"]; var client = new facebookclient(access_token); dynamic somat = client.get("/me/groups"); //somat.data array (int = 0; < somat.data.count; i++) { if (somat.data[i].name == groupname) { client.post("/" + somat.data[i].id + "/feed", new { message = string.format("i posting hrms jobid: {0} " + groupname, hiddenjobid.value) }); } } }
i'd appreciate guidelines/tips on matter, if possible.
Comments
Post a Comment