Traversing Connections through the Facebook C# API - c#

I am attempting to write an application that harvests information from a logged-in Facebook user. We are using the Facebook C# API (some documentation here). Getting the basic user information is easy enough, but the Graph API supports a lot of connections that link their objects to other arrays of things, which are all important for the application I'm writing. I am unable to find an example on how to traverse these connections on the codeplex site. Can anyone provide an example? Normally I would use the site itself but the discussion page outright requests that question askers use Stack!

Here is a sample code on how to use the feeds connection.
var fb = new FacebookClient("access_token");
dynamic result = fb.Get("/me/feeds");

You don't specify much about your application. If this is more of an IT thing than a true "Facebook Application", you could automate using PowerShell with Facebook PS Module.

Related

Automatically share new updates on my website to social networks?

Is there any way to update my social networks automatically from my own website admin panel?
Let's say I add a new article and I want to save it to my database and share it to my Facebook page and Twitter. Is there any code to do this? Has anyone made it before?
Please see the following CodeProject article for full instructions:
C# Application Integration with Facebook & Twitter with oAuth
Facebook:
var fb = new FacebookClient(this.AccessToken);
string wallPost = "Your programmatic wall post using Facebook C# SDK";
dynamic result = fb.Post("me/feed", new { message = wallPost });
Twitter:
string tweetMessage = "Your programmatic Tweet using TweetSharp library"
TwitterStatus twitterStatus = twitterService.SendTweet(tweetMessage);
References:
Facebook Developer Documentation
Facebook SDK
Twitter Developer Documentation
TweetSharp Library
I understand it's customary in StackOverflow answers to include a summary of the contents of a link or the highlights that specifically answer the question. And with a link-only answer, people must dig through another resource to locate an answer they might not be sure about and most importantly, if the link were to ever break, my answer is useless for anyone who visits this page in the future. However MSDN, Code Project, GitHub are generally acceptable links so I'm am not copying the entire article.
Check developer guides for twitter and facebook on how to integrate them. There are also c# sdks for both platforms available on NuGet: TweetSharp and facebook
Like already was said above have a look at the SDK's on the developers website(s)
or
Have a look at Twitterfeed.com, this website will allow you to provide a RSS feed with the latest (news,updates) and submits them automatically to Twitter, Facebook, linkedin etc
Simply generate an rss feed with your latest changes, provide it to twitterfeed.com and they do the rest

Is it possible to use google analytics in server?

I have a URLShortener application and I want to use Google Analytics for shorted urls. But I use Response.Redirect() method and I can't use local script of google analytics.
I want to know is it possible to have something like google analytics script in server and run it?
There is the Microsoft Silverlight Analytics Framework which also supports Google Analytics.
I would assume that they do this in C# code, which should be adaptable to be used inside server-side code, too.
Yes, it is possible to use google analytics in server. You need to have a Google Analytics account, as explained here.
After setting up your account they will give you a unique tracking code along with a javascript code which you have to put in your website or master page which you want to track. This javascript code will do all magic for you and you can watch this information from your GA account.
You can even integrate this chart with your website, using the Google chart facility through
Google Analytics Easy Dashboard Javascript Library (more information here).
From this tutorial you can setup your website to catch GA data into your site and display in your own webpage through Google charts.
Sure, it's technically possible. All GA does is set some variables and makes an HTTP request to the GA server, which can be done with JS or by grabbing a gif from the server.
The main issue is that you won't get a lot of the data that you would expect like browser, location, OS version, etc. because the client making the request would be your own server.
It would probably be best to add some event tracking data to the redirected location and track that with GA event tracking, that way you could get a more accurate dataset.
If you do want to continue down the path of most resistance though, this is a pretty good write up of how you'd go about it. http://automateeverything.tumblr.com/post/20500736298/google-analytics-without-javascript-or-cookies It's not C# specific, but you should be able to abstract it.

Background app to monitor Facebook

I'm building an aggregator for Twitter and Facebook. Via my website users should be able to grant the app access to their Facebook and Twitter profile.
Then, my C# app will, at regular intervals, check the networks (or stream from) for new posts/likes/tweets related to that user and store the result in a database. I will not use Facebook and Twitter as an identity provider for my website.
Now my question: what library should I use best to accomplish the connection with the social networks? Can I use dotnetopenauth for this? Or are there better solutions?
I should also be able to extend the library and add whatever social network later on.
It is probably a very basic question, but I get confused due to all the possible libraries and options. I tweaked a small and simple OAuth class to connect to Twitter, but this was only capably of OAuth 1.0...
Yes, DotNetOpenAuth can help you with this. But you might want to double check the Facebook terms of service, as I thought they forbade any persistence of the data you download from them.
It is indeed possible to do so with DotNetOpenAuth, I know this because I am working on something similar. Already have it working like a charm with Twitter, working on the Facebook link at the moment. Seems like Facebook is going to give me more trouble then I expected at first.

Creating a hook into my facebook app from another site

new to facebook dev and I have read the basics to get a site up and running using the canvas setup. Nice and simple, I have also got the integration with users working ok (i.e. the signed_request).
I was wondering how it works with "sending/posting" data from one site that is anonymous (my own external to facebook) to the facebook site.
The flow I'm after is a user is looking at some content my site A (my own external site) and then clicks the "share on facebook" button (or whatever), which sends the user (and the data they were looking at) to the site B (my facebook app) to which they authenticate and then (and this is the part I dont get) can see that content on their personalised homepage within site B.
So is there a way to POST some kind of data to the facebook site? Or do I need to do something else here?
Thanks a lot.
You use the facebook API located here:
http://github.com/facebook/csharp-sdk
The .zip download includes the api that you can compile, as well as a sample project that uses it.
Reference: http://developers.facebook.com/blog/post/395/
EDIT
Here is some more info regarding the facebook graph api. I think you'll find everything you need in here: http://developers.facebook.com/docs/reference/api/

Simple Facebook Connect Demo in ASP.NET

Does anyone have a simple and successful demo implementation of facebook connect in an asp.net application. I am developing an asp.net web application and want facebook connect to be the primary method for logging in.
I was having troubles as well, but found that this stackoverflow question got me on the right track as far as the server side stuff is concerned
However, First you have to get the facebook connect button working from here Facebook Wiki
Then detect if they are logged in or not and redirect them appropriately to a welcome page.
Detect login via Javascript
Most other actions can be done via serverside with the Facebook ToolKit. (eg get their information, friends, etc..)
The last thing I think I should mention is logging the user out, so take a look at this. Facebook Wiki: Logout
Hope this helps
As I see, all the above examples and links are really outdated. The new Facebook Graph API makes the whole process a lot easier, without the need for any other components:
http://area72.ro/general-it/how-to-login-via-facebook-in-asp-net.html
try to use the toolkit called Facebook Developer Toolkit
you have in Steve Blog a post about it, and you even download he's Starter Kit so you can view all the code :)
Hope it helps
I know you asked for ASP.NET resources. The Facebook Connect page provides some good information as well as the source to a sample implementation using PHP. Hopefully you can pull some good information from the PHP code.
http://developers.facebook.com/connect.php Check out the links on the right side.
The provided demo can be accessed here... http://www.somethingtoputhere.com/therunaround/

Categories