Skip to content

Instantly share code, notes, and snippets.

@mattbrailsford
Created February 1, 2013 09:57
Show Gist options
  • Save mattbrailsford/4690436 to your computer and use it in GitHub Desktop.
Save mattbrailsford/4690436 to your computer and use it in GitHub Desktop.
@using System.Configuration
@using Twitterizer
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Umbraco.Web.Models.PartialViewMacroModel>
@{
var tokens = new OAuthTokens
{
ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"],
ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"],
AccessToken = ConfigurationManager.AppSettings["twitterAccessToken"],
AccessTokenSecret = ConfigurationManager.AppSettings["twitterAccessTokenSecret"]
};
var response = TwitterTimeline.UserTimeline(tokens, new UserTimelineOptions
{
ScreenName = Model.CurrentPage.GetPropertyValue<string>("twitterId", true, ""),
Count = 1
});
}
<div class="tweet">
@if(response.Result == RequestResult.Success)
{
var tweet = response.ResponseObject.First();
<span>@Html.Raw(tweet.LinkifiedText())</span>
<a href="http://twitter.com/@(tweet.User.ScreenName)/status/@(tweet.Id)">@tweet.CreatedDate.ToString()</a>
}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment