当前位置: 首页>>代码示例>>C#>>正文


C# FacebookClient.useFileUploadSupport方法代码示例

本文整理汇总了C#中Facebook.FacebookClient.useFileUploadSupport方法的典型用法代码示例。如果您正苦于以下问题:C# FacebookClient.useFileUploadSupport方法的具体用法?C# FacebookClient.useFileUploadSupport怎么用?C# FacebookClient.useFileUploadSupport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Facebook.FacebookClient的用法示例。


在下文中一共展示了FacebookClient.useFileUploadSupport方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load


//.........这里部分代码省略.........
                {
                    //user is json object
                    if (kvp.Key == "user")
                    {
                        foreach (KeyValuePair<string, object> fields in client.getSignedRequest()["user"] as Dictionary<string, object>)
                        {
                            //age in user is also a json object
                            if(fields.Key == "age")
                            {
                                foreach (KeyValuePair<string, object> field in fields.Value as Dictionary<string, object>)
                                {
                                    Response.Write("php sdk equivalent $facebook->getSignedRequest();" + field.Key + " - " + field.Value + "<br/>");
                                }
                            }
                            else
                            {
                                Response.Write("php sdk equivalent $facebook->getSignedRequest();" + fields.Key + " - " + fields.Value + "<br/>");
                            }
                        }
                    }
                    //page is json object
                    if (kvp.Key == "page")
                    {
                        foreach (KeyValuePair<string, object> fields in client.getSignedRequest()["page"] as Dictionary<string, object>)
                        {
                            Response.Write("php sdk equivalent $facebook->getSignedRequest();" + fields.Key + " - " + fields.Value + "<br/>");
                        }
                    }
                    else
                    {
                        Response.Write("php sdk equivalent $facebook->getSignedRequest();" + kvp.Key + " - " + kvp.Value + "<br/>");
                    }

                }

                //retrieves the signed user facebook id as ulong
                Response.Write("php sdk equivalent $facebook->getUser();" + client.getUser() + "';</script>" + "<br/>");

                //retrieves the fileUpload value from config
                Response.Write("php sdk equivalent $facebook->useFileUploadSupport();" + client.useFileUploadSupport() + "<br/>");

                //you can retrieve fql queries using fql method.
                //this query retrieves current user and his /her friends uid, name, pic_square fields
                Response.Write(client.fql("SELECT uid, name, pic_square FROM user WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me())") + "<br/>");

                //you can also make batch fql queries and reference them. in this example we first retrieve the user list attends to a particual event in "query1"
                //and then retrieve their name, url, pic fields in "query2" referencing the results in "query1"
                var batchFqlQueries = new Dictionary<string, string>();
                batchFqlQueries.Add("query1", "SELECT uid, rsvp_status FROM event_member WHERE eid=221426641328833");
                batchFqlQueries.Add("query2", "SELECT name, url, pic FROM profile WHERE id IN (SELECT uid FROM #query1)"); //referencing #query1
                Response.Write(client.fql(batchFqlQueries) + "<br/>");

                //you can make simple graph api calls like in php sdk
                Response.Write(client.api("/me/friends", "GET", null)); // or equivalently Response.Write(client.api("/me/friends", FacebookApiMethodType.GET, null));

                //same call in more object oriented way
                var graphApiCall = new FacebookGraphApiRequest();
                graphApiCall.Method = FacebookApiMethodType.GET;
                graphApiCall.Path = "/me";
                graphApiCall.Params = null;
                Response.Write(client.api(graphApiCall));

                //this is an example of batch graph api request. retrieve the current user public info from /me and posts a wall post to this user's wall in one call
                List<FacebookGraphApiRequest> list = new List<FacebookGraphApiRequest>();

                //first request
                var request = new FacebookGraphApiRequest();
                request.Method = FacebookApiMethodType.GET; //or just type "GET" string like request.Method = "GET"
                request.Path = "/me";
                request.Params = new NameValueCollection(); // Graph api GET calls do not need parameters.

                list.Add(request);

                //second request is wall post.
                request.Method = FacebookApiMethodType.POST; //or just type "POST" sting like request.Method = "POST"
                request.Path = "/me/feed";
                //we enter the wall post parameter fields link and message
                // you can refer to http://developers.facebook.com/docs/reference/api/publishing/ Other Objects section
                request.Params = new NameValueCollection();
                request.Params.Add("link", "www.arcademonk.com");
                request.Params.Add("message", "C# SDK Batch Request Messsage");

                list.Add(request);

                //retrieves the result from these two requests
                Response.Write(client.api(list));

                //you can catch all api errors using FacebookApiException class
                try
                {
                    //this user is invalid
                    client.api("/arcademonk.notvalid", "GET", null);
                }
                catch (FacebookApiException exception)
                {
                    Response.Write(exception.Type + exception.Error);
                }

            }
        }
开发者ID:barans,项目名称:FacebookCsharpSdk,代码行数:101,代码来源:Default.aspx.cs


注:本文中的Facebook.FacebookClient.useFileUploadSupport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。