Monday 21 December 2015

Resolving SharePoint 2013 Page Save Conflict Error

I was working on a custom web part that used to update the page library custom column in edit mode. After the changes are updated by web part using client side JSOM, the save conflict error used to be thrown by the page.

This is not a multi-user scenario, but a use case when page property is updated by custom web part in edit mode by JSOM and then if page is saved/checked-in, you get Page Save conflict error.

Reason: When ever page is loaded in edit mode, the version (owshiddenversion) of it is saved in the page hidden field, thus when page is saved, the current version of the page item is checked with saved version. And if there is any mis-match, conflict error is thrown by SharePoint and pop-up is launched.

Solution: Update page item property is updated, reload the page list item and update the hidden field "SPPageStateContext_PreviousAuthoringVersion" with latest "owshiddenversion"



This will ensure that when ever page is saved, it is updated with latest version and page conflict error is not raised. 

Monday 15 June 2015

SharePoint 2013 - Show only Top 5 Feed in Newsfeed webpart


By Default SharePoint 2013 Newsfeed webpart shows 10 posts and there is no way to customize the number of posts out of the box.

So here is the cool trick to show only 4 posts instead of 10 using Jquery - Javascript.

<script type="text/javascript">
$(document).ready(function () {
   var limit=4;
   $("#ms-feedthreadsdiv").attr("numHiddenThreads", "6")
   $("#ms-feedthreadsdiv .ms-microfeed-thread").each(function(i){
   if(i>=limit){
          $(this).addClass("ms-hide");
       }
   });
});
</script>

By Setting numHideenThreads attribute value = 6 for the div help you avoid overwriting the "View Posts" link functionality to load rest of the posts.
If you don't set this attribute value, then on click of "View Posts" link, it will just load rest of the posts other than original 10 posts.

Reference: https://social.msdn.microsoft.com/Forums/sharepoint/en-US/0b37455a-904e-47b2-9705-e06d8a7029bd/limiting-the-height-of-site-feed-webpart-in-sharepoint-2013?forum=sharepointdevelopment  

Sunday 22 February 2015

Started with my Business Intelligence Training BLOG

I am proud to be part of BICG, where you get to work with the best people of the Industry who have same passion and that is technology.

I have been associated with BICG ever since I started freelancing and it has been a great journey. Working on latest technology in BI and SharePoint space give me new high.

To watch my latest training blogs visit here.
http://bicg.com.au/index.php/author/anupamabicontractorsgroup-com/