@inherits umbraco.MacroEngines.DynamicNodeContext @using Skybrud.Social.Interfaces @using Skybrud.Social.Facebook.Objects @using Skybrud.Social.Instagram.Objects @using Skybrud.Social.Umbraco.DataTypes.Facebook @using Skybrud.Social.Umbraco.DataTypes.Instagram @try{ // Use a common type so that we can sort the entries by their date List entries = new List(); // Gather posts from Facebook if (Model.HasValue("facebook")) { var oauth = FacebookOAuthDataValue.ParseXml(Model.facebook); if (oauth.HasData) { foreach (var post in oauth.GetService().GetPosts(oauth.Id).Data) { entries.Add(post); } } } // Gather images from Instagram if (Model.HasValue("instagram")) { var oauth = InstagramOAuthDataValue.ParseXml(Model.instagram); if (oauth.HasData) { foreach (var image in oauth.GetService().Endpoints.Users.GetMedia().Images) { entries.Add(image); } } } if (entries.Count == 0) {
OH NOES! No entries!!!
} else {
// List the entries by their date - showing the newest first @foreach (var entry in entries.OrderByDescending(x => x.SortDate)) { FacebookPostSummary post = entry as FacebookPostSummary; InstagramImage image = entry as InstagramImage; if (post != null) { } else if (image != null) {
} }
} } catch (Exception ex) { // Obviously it's bad to write out exception details on a live site //
@ex.Message
Ooops! Something went wrong.
} Community - our.umbraco.org
Our.umbraco.org is the community mothership for Umbraco, the open source asp.net cms. With a friendly forum for all your questions, a comprehensive documentation and a ton of packages from the community. This site is running Umbraco version 7.7.1