Oh guess what, Social comments are known as Notes not comments, because well SharePoint.
I had a requirement to get a list of all the comments on a specific news story. (Publishing Story) I was looking for ways to accomplish this and I know that comments are stored not in the content database, but in the User Profile Social Database. (At first I was like why in the world? And of course this will introduce other problems, but I can kinda see why now, so just roll with it. Although one of those problems could be, how can you retrieve user comments on a farm where you’re only restored the content database, but not the UPS databases? )
Anywho, I was trying to accomplish this with PowerShell, but wasn’t getting much traction. I saw there were some Social Comment controls out there, but I didn’t want to create a new page layout. There’s some methods to create this programmatically with CSOM, but being an admin who occasionally ventures into the developer world I was really struggling with how to get all those square shapes into those round puzzle holes. So I did something you should never do. I queried the database directly. (I know I know, and I’m also not insane.) I had a copy of the database moved to a test farm and queried the database that way. 🙂 Haha, did you really think I’d go poking around in a live production SharePoint SQL database? Smh… I may have been born in the night, but it wasn’t last night. I figured out the tables that the comments were stored in and was able to extract a list then I noticed there was a userid associated with every comment as well as a URLID. I did some cross referencing of tables and ended up with a horrible horrible mess. Apparently the userid in one of the tables is actually not the same as an employee id etc…
So after delivering incorrect information and having it returned to me. I started looking at going back to the CSOM developer method, and I ran across this silly little article that mentioned there was an Out of the Box method to get all the comments for a news story from Central Administration. sigh… 2 days wasted…. But the CA method works.
To View the Social Comments through the CA.
- Open Central Administration.
- Click Manage Server Applications in the Application Management Section.
- Click the User Profile Service Application
- Click on Manager Social Tags and Notes.
- Oh guess what, Social comments are known as Notes not comments, because well SharePoint.
- By selecting Notes from the Type dropdown and by filling the values you could be able to see all the social comments based on your needs.
So here’s that article I found. (Thanks Vijai Anand Ramalingam!) Hopefully it will save you some time if you get this same requirement. http://www.c-sharpcorner.com/uploadfile/anavijai/programmatically-get-all-the-social-comments-in-sharepoint-2010/