1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C# - Facebook - Publish on page wall as Admin

Discussion in 'C, C++, C#' started by ldg2002, May 3, 2013.

  1. ldg2002

    ldg2002 Registered Member

    Joined:
    Jun 5, 2012
    Messages:
    66
    Likes Received:
    6
    Home Page:
    Hi! this is my little snipped of code, i'm trying to post on Facebook Fan Page with C# as admin. Everythings works but when I look at the post on the page, was released from my profile and not from the page. my profile is the admin of the page. I create the access token herehttps://developers.facebook.com/tools/explorer/ with "manage_pages, offline_access, publish_stream" properties.
    Thank you for the help


    Code:
    public bool PostImage(string pageAccessToken, string Status, string Imagepath)
    { try 
    { var mediaObject = new FacebookMediaObject 
    { ContentType = "image/jpeg", FileName = Path.GetFileName(Imagepath) }.SetValue(File.ReadAllBytes(Imagepath)); 
    var fb = new FacebookClient(pageAccessToken); 
    fb.Post("/xxxxxxxxxxxxxx/photos", new Dictionary<string, object> 
    { { "message", Status }, { "source", mediaObject } } ); return true; } 
    catch (Exception) { return false; }