简体   繁体   中英

Tagging people using Facebook API (Graph API) ASP.NET

I have some codes where the user can post picture with message using my Facebook account that has a Graph API and I'm using ASP.NET.

My question is, tagging some name that are not my friends in my ASP.NET using Graph API is possible? If not, is there any other way to tag someone or via using their email? So that when the user want to post it they can even tag their self or other person.

For my code:

//Code behind

     protected void Page_Load(object sender, EventArgs e)
            {
                FaceBookConnect.API_Key = "API KEY";
                FaceBookConnect.API_Secret = "API SECRET";
                if (!IsPostBack)
                {
                    string code = Request.QueryString["code"];
                    if (!string.IsNullOrEmpty(code))
                    {
                        FaceBookConnect.PostFile(code, "me/photos", (HttpPostedFile)Session["File"], Session["Message"].ToString());
                        Session["File"] = null;
                        Session["Message"] = null;
                    }
                }
            }

            protected void UploadPhoto(object sender, EventArgs e)
            {
                Session["File"] = FileUpload1.PostedFile;
                Session["Message"] = txtMessage.Text;
                FaceBookConnect.Authorize("user_photos,publish_actions", Request.Url.AbsoluteUri.Split('?')[0]);
            }

//DESIGN

<form id="form1" runat="server">
    <asp:FileUpload ID="FileUpload1" runat="server" />
    <br />
    <br />
    <asp:TextBox ID="txtMessage" runat="server" TextMode = "MultiLine"></asp:TextBox>
    <hr />
    <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick = "UploadPhoto" />
    </form>

No, you can only tag friends, and of course you can't tag people by email. You only get the email of a Facebook user by authorizing that specific user with the email permission.

How to tag friends is explained in the docs - check out the "tags" parameter: https://developers.facebook.com/docs/graph-api/reference/user/photos/#Creating

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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