protected void btPost_Click(object sender, EventArgs e)
        {
            string selectedId = ddlAccounts.SelectedValue;

            Facebook.AccountService accountService = new Facebook.AccountService(_fbAccessToken);
            List<Facebook.Account> accounts = accountService.GetAccounts();
            Facebook.Account account = accounts.Where(t => t.Id == selectedId).FirstOrDefault();
            if (account == null) throw new Exception("Account not found.");

            PostFeed feed = new PostFeed();
            feed.Message = tbMessage.Text;
            feed.Description = "dasda this is a desc";
            feed.Name = "Henkie";
            feed.Picture = "http://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/Chrysippos_BM_1846.jpg/200px-Chrysippos_BM_1846.jpg";
            feed.Link = "http://www.yummo.nl";
            feed.Caption = "caption dsadad";

            Facebook.PostService postService = new PostService(account);
            postService.Post(feed);
        }
Пример #2
0
        /// <summary>
        /// Post a message to the Facebook wall
        /// </summary>
        /// <param name="account">Wall account to post to</param>
        /// <param name="message">Message title to post</param>
        /// <param name="description">Message description to post</param>
        /// <param name="caption">Message caption to post</param>
        public void Facebook(
            Facebook.Account account, 
            string message, 
            string description,
            string caption)
        {
            PostFeed feed = new PostFeed();
            feed.Message = message; // "I just released a new track!";
            feed.Description = description;
            feed.Link = "http://www.trackprotect.com";
            feed.Caption = caption; // "This track is protected by Trackprotect.com";

            Facebook.PostService postService = new PostService(account);
            postService.Post(feed);
        }