简体   繁体   English

如何将照片上传到群组?

[英]How to upload a photo to a group?

Here's how I'm attempting to upload a photo (and please tell me if I can improve this): 这是我尝试上传照片的方式(请告诉我是否可以改善此情况):

var feedPath = String.Format( "/{0}/photos/", feedId );
dynamic parameters = new ExpandoObject();

try {
  var fbUpl = new Facebook.FacebookMediaObject {
    FileName = photoUrl,
    ContentType = "image/jpg"
  };

  var bytes = System.IO.File.ReadAllBytes(HttpContext.Current.Server.MapPath(photoUrl));
  fbUpl.SetValue(bytes);
  parameters.message = msg;
  parameters.source = fbUpl;

  dynamic fbResult = fbApp.Post(feedPath, parameters);
}
catch (Exception exc) {...}

This will upload to the user's wall. 这将上传到用户的墙。 However, if I substitute the feedId with the group's id, it does not post to the group. 但是,如果我用该组的ID替换feedId,则它不会发布到该组。 How do we post photos to groups (on behalf of the currently authenticated user)? 我们如何将照片发布到组中(代表当前身份验证的用户)?

First you need to get a manage_group permission... 首先,您需要获得manage_group权限...

But there is a bug what I submitted last year : http://bugs.developers.facebook.net/show_bug.cgi?id=19157 但是我去年提交了一个错误: http : //bugs.developers.facebook.net/show_bug.cgi?id=19157

After Facebook fix that, you get a manage_group permission. 在Facebook修复该问题之后,您将获得manage_group权限。 Then only need to use the group_id as normal user_id to take actions. 然后,只需将group_id用作普通的user_id即可采取措施。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM