This sample lets you enable Social features like Rating/Likes on the List/Library. The dependency is on Publishing Feature. At the time of writing there is no method avaiable on Client SDK for .NET to set the Rating Functionality. The implementation is a result of reverse engineering of Server Side Object Model.
- Office 365 Multi Tenant (MT)
- Office 365 Dedicated (D)
Publishing Feature
Solution | Author(s) |
---|---|
Core.ListRatingSettings | Akhilesh Nirapure (RapidCircle) |
Version | Date | Comments |
---|---|---|
1.0 | March 29th 2015 | Initial release |
THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
// provide the clientcontext of target web
var ratingEnabler = new RatingsEnabler(clientContext);
// 1. Library name as per locale
// 2. Experience Ratings/Likes
ratingEnabler.Enable("**ListNameHere**", VotingExperience.Ratings);
Steps Performed:
- Validate if current web is publishing web, else skip processing.
- Find List/library
- Add property to RootFolder of List/Library: key: Ratings_VotingExperience value: Likes/Ratings
- Add Ratings & Likes fields to List/Library
- Add selected experience field to default view, e.g. Ratings as shown in above code.
Note: The RatingsEnabler (constructor) takes dependency on Logger which for the sake of sample uses ConsoleLogger. You can implement your own logger as far as it is implementing ILogger interface.