在Facebook C#Sdk,桌面应用程序上发布帖子

时间:2014-10-29 09:19:52

标签: c# winforms

我对使用C#sdk在facebook上发布帖子感到困惑

我想在我的页面上发布姓名,说明和照片:

  • 我是否需要“审核中的项目”(权限)中的“publish_actions”?因为这是我自己的页面。

  • 当我尝试添加publish_actions时,facebook要求提供隐私政策网址,我应该如何使用C#桌面应用程序,我在google上找不到有用的帮助。

设置:

我已将http: //localhost:80/添加到我的网站网址中:

 http://abbasnaqvi512.tumblr.com/ to Valid OAuth redirect URIs.
 Native or desktop app?=Yes
 Is your App Secret embedded?=No
 Client OAuth Login=yes
 Embedded browser OAuth Login=NO
 App Secret Proof for Server API calls=No
 Require 2-factor reauthorization=No

enter image description here

  private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    {
        try
        {
            if (e.Url.OriginalString.Contains("assets") && e.Url.OriginalString.Contains("code"))
            {
                 code = Regex.Matches(e.Url.OriginalString, "assets.tumblr.com.*?code%3D(?<data>.*?)&")[0].Groups["data"].Value;
                richTextBox1.Text += "\n\n" + code + "\n\n";
                if (String.IsNullOrEmpty(code) == false)
                {
                    webBrowser1.Stop();
                    webBrowser1.Dispose();
                    ShareOnFB();
                }
            }
        }
        catch (Exception)
        {
        }
    }



    private void ShareOnFB()
    {
        string pageId = "ABC";

        FacebookClient client = new FacebookClient(code);

        dynamic messagePost = new ExpandoObject();
        messagePost.access_token = code;
        messagePost.picture = "http://fc02.ostadreza-d6pkzrd.jpg";
        // messagePost.link = "http://www.examplearticle.com";
        messagePost.name = "NAME";
        messagePost.description = "DESCRIPTION";

        var result = client.Post(string.Format("/{0}/feed", pageId), messagePost);
        richTextBox1.Text += "\n\n"+result+"\n\n";
    }

当然它给了我错误

         "Malformed access token AQA44CIJCyoV7_Xlz3mtvdPErPBrmtF6ykz6teCc9QINrfePHxEOiQKIyl8wgxH1mvQxEtLE-xnVfdyfiE38eA2M1YU7RS22MNIKNUh5wMmd2zwPCLj30PiEaq6CKIfcq9yIvq_slblOWmE4LYcynyH_pJuZcPc3EqLCQoCUBtSO58X1WtiohRoRvq70QWHpZec-7jhzUQnW75nlk4wpEwcJ9yOcBlPbne72sV6yX_hqndI5RKVDjqRJzdOscOblbLCkC1xtI0rMD1bCJufvpAa-tMsIyG6ATqrk6TNqXXASlcvialbzh0WttS2x-j_J59LF7cBh22T18P8qOly5cOwF"

感谢您阅读我的问题,请帮助我,

更新:我通过添加tumblr隐私权政策网址,笔记和我的应用程序的屏幕截图,在审核中添加了publish_actions,正在审核中

0 个答案:

没有答案