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://[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:

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

You can use the script of the Post: . 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.


Post a Comment