Social Data Service
I’m in Mountainview, California this week participating in a small social networking event called Socialfest, an event where Microsoft is meeting with a number of small start-ups to work collaboratively with them on social networking applications. It’s a pretty cool event; we’re in a large room with all of the start-ups working in their areas with the end goal of the event being the start-ups building a social networking application on SharePoint by the end of the week. You can find some additional information about the event here: https://www.microsoftstartupzone.com/SharepointSocialFest/Pages/default.aspx.
One of the things that this event prompted was a deeper look into the different social APIs/features that SharePoint and Office 2010 have to offer. For example, there is a new Outlook Social Connector in Outlook 2010 that you can use to connect into Facebook, LinkedIn, SharePoint, or even your own custom connector (https://msdn.microsoft.com/en-us/library/ee829696(office.14).aspx). There are also a number of social-centric APIs/Services that you can use within SharePoint. For example, if you add ratings to wiki pages you can programmatically extract those ratings and create a dynamic aggregation of those ratings. To follow is a simple illustration of leveraging the socialdataservice.asmx Web service (out of the box Web service available in SharePoint). You can find the service using the following URL: /_vti_bin/socialdataservice.asmx">https://<servername>/_vti_bin/socialdataservice.asmx. I’ve bolded what is more interesting, which is the proxy creation into the service, the call (which passes the URL of the page where you’re trying to get the rating from), and the object that stores the return data (SocialRatingDetail).
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SocialDataServiceApp.SocialDataServiceWS;
namespace SocialDataServiceApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string ratingURL = " https://fabrikamhockey/sites/mywiki/Pages/home.aspx";
textBox1.Text = ratingURL;
SocialDataServiceWS.SocialDataService mySocialDataService = new SocialDataServiceWS.SocialDataService();
mySocialDataService.Credentials = System.Net.CredentialCache.DefaultCredentials;
mySocialDataService.Url = " https://localhost:49039/_vti_bin/socialdataservice.asmx";
SocialRatingDetail details = mySocialDataService.GetRatingOnUrl(ratingURL);
textBox2.Text = details.Rating.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
}
}
}