Twitter From ASP.NET – Direct Messages
As you continue building up your Twitter application, you’ll eventually want some way of retrieving direct messages sent to you.
In a lot of ways this will be very similar to retrieving the messages from your friends, but there is the optional parameters object that we can pass that will allow us to retrieve a subset of the messages.
The code for retrieving and displaying the direct messages sent to you is remarkably similar to the code we wrote earlier that retrieved the messages sent by our friends. You’ll need to create a class called “Direct” and add a method to it named “Messages” with the following code:
public static TwitterStatusCollection Messages() { String password = HttpContext.Current .Session["Password"].ToString(); String name = HttpContext.Current .User.Identity.Name; return (new Twitter(name, password)) .DirectMessages.DirectMessages(); }
Then you’ll need to bind to it in your display code using a repeater that binds to an ObjectDataSource with the ObjectDataSource configured like this
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="Messages" TypeName="Directs"> </asp:ObjectDataSource>
Using the parameters parameter, you can retrieve messages since a specific ID, messages prior to an ID, a specific number of messages, or a specific page (see previous entries about Twitter programming in the list below) The maximum number of direct messages you can retrieve at any one time is 200.
Other Related Items:
All a Twitter Blue SET OF SIX CANVASES Image Wrap 32 x 32 inches; Winborg, Megan and MendyOopsy Daisy's children's stretched canvas wall art reproductions are created in Oopsy daisy's San Diego studios where they print in the best digital m... Read More >
Lee Hiller Designs Twitter - I Love My Twoffee - Light Switch Covers - single toggle switchI Love My Twoffee Light Switch Cover is new and handcrafted utilizing unique process resulting in a stunning high gloss ceramic-like finish. SET OF MATCHING SCREWS IS INCLUDED giving it a perfect finishing touch. Made of durable metal material.
Leg Warmers by KD dance, Double As Fingerless Arm Warmers, 16 Inch Stretch Knit, Colorfast to Retain Color & Stretch Wash After Wash, Ruffled, Ribbed, Soft, Warm & Fashionable - In 20+ Colors - Made In New YorkProfessional dancers demand high quality which is why KD dance leg warmers are built to last and snap back to new like condition wash after wash. In f... Read More >










[...] Twitter From ASP.NET – Direct Messages (Dave) [...]
[...] Twitter From ASP.NET – Direct Messages (Dave) [...]