【问题标题】:Share Image to my Facebook page using c#使用 c# 将图像分享到我的 Facebook 页面
【发布时间】:2013-08-27 14:25:23
【问题描述】:

我需要将图片分享到我的 Facebook 页面。我使用了以下代码:

string accessToken = ConfigurationManager.AppSettings["ACCESSTOKEN"].ToString();
string pageId = ConfigurationManager.AppSettings["PAGEID"].ToString();

string ImagePath = Server.MapPath("Images/img.jpg");

FacebookClient fb = new FacebookClient(accessToken);
fb.AppId = ConfigurationManager.AppSettings["APPID"].ToString();
fb.AppSecret = ConfigurationManager.AppSettings["APPSECRET"].ToString();

 var imgstream = File.OpenRead(ImagePath);
 dynamic res = fb.Post(pageId + "/photos", new
 {
  message = "Test Message",
  file = new FacebookMediaStream
  {
    ContentType = "image/jpg",
    FileName = Path.GetFileName(ImagePath)
   }.SetValue(imgstream)
   }); 

它工作并以我的名字显示在“[页面名称]上其他人的最新帖子”中。我是这个页面的管理员。对我来说它应该显示为管理员发布的。帮帮我!!

【问题讨论】:

    标签: c# asp.net facebook facebook-graph-api facebook-page


    【解决方案1】:

    解决方案 1:

    您可以使用流发布方法,这里是示例演示网址,使用此方法也可以共享视频、flash 和 mp3

    http://demo.vatlab.net/StreamPublish.aspx

    http://sudiptasanyal.blogspot.in/2011/09/share-image-with-facebook-in-aspnet.html

    解决方案 2:

    Graph API的使用,参考更多

    http://www.aspsnippets.com/Articles/Share-Image-Photo-Pictures-on-Facebook-in-ASPNet-using-Graph-API.aspx

    【讨论】:

    • 图片发布成功。我的问题是,它显示在 [页面名称] 上其他人的最近帖子中。如何以管理员身份发布图片?
    猜你喜欢
    • 1970-01-01
    • 2014-07-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-17
    相关资源
    最近更新 更多