Fix To: "We've hit a Snag" SharePoint 2013 Newsfeed Error

One of our customers reported that they are no longer able to post to the news feed of a community site. I would like to share how we managed to resolve this issue.

They were getting this error when they tried to post to the newsfeed.



The issue was only reproducible on one site collection. For the existing sites as well as any new subsites created there. We restored the site collection backup to our development environment to avoid any issues in production.

Analysis

We noticed that the HashTags column was missing from the Microfeeds list in the problematic subsite. When we manually tried to add the site column (Add from existing site columns option in the list settings), we were not able to find any HashTags column in the site column gallery. We reactivated the 'Site Feeds' feature on the subsite and then added it to the Microfeeds list, but it did not help.

Then we deactivated and activated the site feed feature on the root site in the site collection and adding the HashTags column to the Microfeeds list resolved the issue. But, it was not useful as it also erased all the newsfeed data from where we reactivated the features. Certainly this was not acceptable solution and we did not propose it to the customer.

We checked a freshly restored copy of the problematic site collection, we fond that the HashTags column was accidentally deleted from the root site somehow. But the news feed on root site was working as the HashTags column was deleted from the site columns gallery and it was present in the Microfeeds list.

Solution

After a thorough analysis, we found that deactivating and reactivating the feature on the root site was helping for the newly created subsite. This means somehow the subsites refer to the HashTags column in the root site while creating the Microfeeds list. So, we focused on designing a solution based on getting the root site HashTags column in order and then adding this column to the Microfeeds list of the problematic subsite.

Here is the solution outline:

  1. Check if the root site in the problematic site collection has the HashTags column in the “Site Columns” gallery, if yes, delete it.

  2. Get a reference to the HashTags column of the other healthy site at the root of a site collection (better option would be to create a new site collection and activate the site feed feature).

  3. Add the field to the root site using AddFieldAsXml method using the field obtained in step 2 above.

  4. Go to the Site settings of the problematic sub site. There should be two HashTags columns in the “Site Columns” gallery. Delete one of them.

  5. Go to the Microfeeds List settings and add the HashTags column from the site columns to the list.

  6. Repeat steps 4 and 5 for all the sites with issues in posting to newsfeed.

Following is the PowerShell script just in case it is inconvenient to understand the description above

For Adding a ‘healthy’ HashTags column,

  1. $workingsite = Get-SPWeb https://healthysiteurl #this is a ‘healthy’ site at the root of a site collection    
  2.     
  3. $fld=$workingsite.Fields["HashTags"]    
  4.     
  5. $fldschema=$fld.SchemaXml    
  6.     
  7. $newsite = Get-SPWeb https://problematicsiteurl #this is the site at the root of the problematic site collection    
  8.     
  9. $newfld=$newsite.Fields.AddFieldAsXml($fldschema)  
For deleting duplicate HashTags column from the problematic site (manual deletion through UI works fine as well)
  1. $w2=get-spweb Get-SPWeb https://problematicsubsiteurl #this is the url of the problematic sub site where news feed does not work   
  2.   
  3. $w2.fields.Delete("HashTags")   
  4.   
  5. $w2.Update()   
Conclusion

Accidental deletion of a site column was the reason behind this issue. This leads to the fact that end-user training and a good governance plan would help the customers to use SharePoint to its complete potential.