1. This website uses cookies to improve service and provide a tailored user experience. By using this site, you agree to this use. See our Cookie Policy.
    Dismiss Notice

C# - Facebook - Publish on page wall as Admin

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

  1. ldg2002

    ldg2002 Registered Member

    Jun 5, 2012
    Likes Received:
    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

    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; }