Wednesday, August 20, 2014

In post I discussed about how to use REST API calls. As I said APIs are very helpful to implement special requirements. Displaying a user feed can be a special case.

As a CEO of company you always wants to send your messages to all of the employees and wants all of them received the message quickly. To do this you post your messages on the Yammer. Many of the people don’t want to switch between the web sites of your intranet and yammer site. So you want that company’s intranet portal should show my messages on the home page.

Now think as developer CEO contacts to you with same requirement that he wants to show his messages on the home page of intranet portal. To achieve this you can use the below REST API endpoint.

To get user messages following endpoint is useful:

HTTPS://api.yammer.com/messages/from_user/[User Id].json

Or you can use only ‘messages/from_user/[User Id].json’ if you use yam.platform.request for call.

Script to fetch the User Messages:

yam.platform.request(
                      {
                          url: "messages/from_user/[User Id].json "
                      , method: "GET"
                      , data: { 'limit': limit}
                      , success: function (responseData) {
                          BindHtml(responseData,false);
                      }
                      , error: function (msg) { alert("Error..." + msg); }
                      }
                    )

You can use the script of the Post: http://www.sharepointyammertech.com/2014/08/yammer-sharepoint-how-to-implement.html . Copy the complete script and just replace the REST endpoint/URL with the ‘messages/from_user/[User Id].json’. And use the script you can get the user posted messages.


Happy SharePoint coding.

0 comments:

Post a Comment