Thursday, November 8, 2012

Facebook graph api

Sample application created using the following dll's

Get your blessing word 

You can create a facebook application simply using these dll's.
download these dll's from the following links.
NewtonSoft JSON

then you need to create a facebook app using the link fbapp and then navigate to create facebook app page and do the processings and the get the appID and appsecret.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newtonsoft.Json;
using FBHelper;
using FBHelper.Entity;
using System.IO;

namespace FacebookApp
    public partial class AppPage : System.Web.UI.Page
        FB fbApp = new FB();

        protected void Page_Load(object sender, EventArgs e)
            string imageUrl = Server.MapPath(@"/image/Hydrangeas.jpg");

            fbApp.AppID = "YOUR_APP_ID";
            fbApp.AppSecret = "YOUR_APP_SECRET";
            fbApp.RedirectURL = "http://localhost:51337/AppPage.aspx";
            string code = Request.QueryString["code"] as string;
            string error = Request.QueryString["error_description"] as string;

            if (string.IsNullOrEmpty(error))
                if (string.IsNullOrEmpty(code))
                    fbApp.Code = code;
                    string token = fbApp.AccessToken;
                    FBUser user = fbApp.GetMe();
                    List<FBUser> friends = fbApp.GetMyFriends();
                    List<Photo> pics = fbApp.GetMyPhotos();

                    string statusID = fbApp.UpdateStatus(user.ID, "hiiiii");
                    string album = fbApp.CreateAlbum(user.ID, "Sample", "new sample");
                    List<Album> alb = fbApp.GetAllAlbumDetails();
                    List<Likes> like = fbApp.GetAllLikesByMe();

                    fbApp.UploadPhoto("Sample Image", imageUrl);
                    fbApp.UploadPhotoToAnAlbum(album, "Hiiiiii", imageUrl);

No comments:

Post a Comment