ActivityFeed service exposes PublishUpdate method which allows you to add new update.

Update PublishUpdate(UpdateContent content, 
    string publisherId, 
    string source, 
    IEnumerable<Topic> topics, 
    bool isPublic, 
    IEnumerable<UserGroup> userGroups)
Parameters description:
  • content - custom content of update; for Status Update it is Post
  • publisherId - id of user who is the author of update; for Status Update it is currently logged user id
  • source - source of update; for Status Update it is "web"
  • topics - list of topics related with update; for Status Update it's topic created from current user and topics from NewTopics property
  • isPublic - if true, then update is marked as public, and update will be visible for all users, otherwise it will be limited by userGroups; for Status Update updates are public
  • userGroups - list of roles and logins that limits access, for non-public updates, to users who are assigned to at least one of the users group; for Status Update list is empty
Note: Custom content of update required custom update template.

When post new status update, Updates Module executes PublishUpdate method.

activityFeedService.PublishUpdate(new Post(dto.Text), identityProvider.Identity.Name,
  dto.Source, newTopics, true, Enumerable.Empty<UserGroup>());
There are two extension methods that allow you to publish public updates without setting permissions.

public static Update PublishPublicUpdate(this IActivityFeedService service, UpdateContent content, string publisherId, string source, params Topic[] topics)

        public static Update PublishPublicUpdate(this IActivityFeedService service, UpdateContent content, string publisherId, string source, IEnumerable<Topic> topics)

Last edited Jul 13, 2012 at 8:14 AM by grzwie, version 23

Comments

No comments yet.