Skip to main content

Twitting using Yedda Twitter .Net/C# API

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Yedda;

using System.Xml;

namespace TwitterTest

{

class Program

{

static void Main(string[] args)

{

Twitter twit = new Twitter();

String str = twit.Update("yourUserName", "YourPassword", "A twit from my Yedda Twitter API", Twitter.OutputFormatType.XML);

Console.Read();

}

}

}

Yedda Twitter C# API Update method:

I was getting the following error message while twitting using the Yedda Twitter API: The remote server returned an error: (417) Expectation Failed. (ASP.NET 2.0 / C#)

The highlighted line shown in the code snippet below solved the problem.

protected string ExecutePostCommand(string url, string userName, string password, string data) {

try

{

WebRequest request = WebRequest.Create(url);

System.Net.ServicePointManager.Expect100Continue = false;

……

……

Reference:

Yedda Twitter C# Library (or more of an API wrapper) v0.1

// Written by Eran Sandler (eran AT yedda.com)

http://devblog.yedda.com/index.php/twitter-c-library/

Comments

  1. thanks shrinand!
    how did you come up with this solution?

    ReplyDelete
  2. any sample for encrypt twitter password in console application ? thx

    ReplyDelete

Post a Comment

Popular posts from this blog

WPF How to Dispose ViewModel when the associated UserControl (Not Window) closes?

Note: If your WPF UserControl is hosted in MFC Window, you may want to clean-up the ViewModel that is DataContext of your UserControl.
Since Unloaded event is not called reliably for the UserControl when the hosting MFC Window closes, there is a need for another solution.
XAML: <UserControl x:Class="Views.MyUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"><Grid></Grid></UserControl>Code Behind:using System; using ViewModels; namespace Views {     publicpartialclassMyUserControl     {         public MyUserControl()         {             DataContext = newMyUserControlViewModel();             InitializeComponent(); …

C# How to Serialize/Deserialize BitVector32

I have a class with a property of type BitVector32, when I Serialize it, I noticed the property was not getting serialized because the BitVector32 is not [Serializable].

After thinking about how can I serialize this property and looking into the implementation of BitVector32 it became clear that I need to approach this from a different angle.
BitVector32 class has a property called Data where the information is stored, this property is of type Int and Int is obviously [Serializable].
Here is my approach:
[Serializable]     publicclassTreeItem     {         // Serializable requires an empty constructor public TreeItem()         {         }         publicint Id { get; set; }         publicint ObjectType { get; set; }         [XmlIgnore]         publicBitVector32Properties { get; set; }         [XmlElement("Properties")]         publicInt32 Data         {             get { return Properties.Data; }             set { Properties = newBitVector32(value); }         }     }

Here is…

WPF: VisualTreeHelper Find Parent of Specific Type

While working with WPF Visual Tree, one of the common tasks is to find the Parent(Ancestor) or Child of any specific element (DependencyObject).
The following piece of code traverses the visual tree recursively and finds the type of parent you are looking for related to the element you pass in.
For example: If the Visual Tree hierarchy is like this: GridStackPanelListBox
You can call the function like this to find the Grid: FindAncestor((DependencyObject)ListBox);


publicstatic T FindAncestor(DependencyObject dependencyObject)             where T : DependencyObject         {             var parent = VisualTreeHelper.GetParent(dependencyObject);             if (parent == null) returnnull;             var parentT = parent as T;             return parentT ?? FindAncestor(parent);         }