November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
After spending some time with Reflector i found the object "NewsFeedStoryActor"
Final code, please correct me.
if (base.CurrentStory.Targets.Count > 0) { if (CurrentStory.Targets[0] is Club) { Club club = CurrentStory.Targets[0] as Club; var storyActor = NewsFeedHandler.GetStoryActor(CurrentStory.ID); if (storyActor.Attachments.Count > 0) { if (storyActor.Attachments[0] is Topic) { var topic = storyActor.Attachments[0] as Topic; if (topic != null) { //do stuff } } } } }
The reason why they hide it behind the actor property is probably because that the story could be aggregated and the each actor has its own set of attachments.
Your code seems right. We wrapped it up in this extension method, it might help you:
public static T GetAttachmentOfType<T>(this NewsFeedStory story)
where T : class, IFrameworkEntity
{
NewsFeedStoryActor actor = story.Actors.FirstOrDefault();
if (actor == null)
return default(T);
else
return actor.Attachments.SingleOrDefault(att => att.GetType() == typeof(T)) as T;
}
Hi!
When creating a NewsFeedStory I have a option to add story attachments as a collection of IEntity.
How do I query to get stories with related attachments? Have I misunderstanded the use of story attachments?
I want to add a story related to a club with a related attachment of a Topic
I want to get all stories related to the specific club with attachments:
I cant see that "stories" in this case contains anything like attachments?
Regards,
Anton Kallenberg