Posts

Showing posts from January, 2013

Create and Retrieve a Social Rating

The SocialRatingManager object enables you to create a social rating for any specified URL. Because entries in Microsoft SharePoint Server lists and document libraries can be represented by URLs, you can create and retrieve social ratings for those items, and for any other SharePoint Server page. This topic demonstrates how to use the SocialRatingManager to create and retrieve social ratings and how to enable social ratings on a SharePoint Server in a custom application. The samples in this topic assume that you have added the following references to your Microsoft Visual Studio 2010 project:

Microsoft.SharePoint

Microsoft.Office.Server

Microsoft.Office.Server.UserProfiles

System.Web

Creating Social Ratings

The overloaded SetRating method creates a single SocialRating object for the current user on a single specified URL. A social rating consists of a URL and an integer ranging from 0 through 5. It also can optionally consist of a string title for the rating and a FeedbackData object …

Add Rating to sharepoint list on site collecion using power shell

ShellScript:

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") 
 $site = New-Object Microsoft.SharePoint.SPSite("http://sitecollection URL") 
 $web=$site.OpenWeb() 
 if ($web -ne $Null) 
 { 
       $AverageRating=$web.Fields[[System.Guid]"5a14d1ab-1513-48c7-97b3-657a5ba6c742"] 
       $RatingCount=$web.Fields[[System.Guid]"b1996002-9167-45e5-a4df-b2c41c6723c7"] 
       $PagesList=$web.lists["Pages"] 
       if ($PagesList -ne $Null) 
       { 
             Write-Host " Processing List : " $PagesList.Title 
             $ct=$PagesList.ContentTypes["Page"] 
             If ($ct -ne $null) 
             { 
                   Write-Host " Adding Rating columns to content type : " $ct.name 
                   $AverageRatinglink = new-object Microsoft.SharePoint.SPFieldLink $AverageRating 
                   $RatingCountLink = new-object Microsoft.SharePoint.SPFieldLink $RatingCount…

Create Rating Visual Web Part Using Visual Studio 2010,

Create Rating Visual Web Part Using Visual Studio 2010,  also Apply Rating Settings using c#

  Back End Design
 Register Assembly

 <%@ Register Tagprefix="SharePointPortalControls" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>



Add Control.

<div>    Average Ratting :
   <SharePointPortalControls:AverageRatingFieldControl ID="PageRatingControl" runat="server"/>
</div>