Export (0) Print
Expand All
3 out of 4 rated this helpful - Rate this topic

What's new for developers in social and collaboration features in SharePoint 2013

SharePoint 2013

Learn about new and changed social and collaboration features for My Site and Community Site development scenarios in SharePoint 2013.

Last modified: March 24, 2014

Applies to: SharePoint Foundation 2013 | SharePoint Server 2013

Social and collaboration features in SharePoint 2013 make it easy for users to communicate and to stay engaged and informed. The improved social feed on personal sites and team sites helps users to keep up-to-date with the people and content that they care about. The new Community Site feature provides a rich community experience that lets users easily find and share information and find people who have similar interests.

For an in-depth overview of the new social and collaboration features in SharePoint 2013, see What's new in social computing in SharePoint 2013 on TechNet. For more information about programming with social and collaboration features, see Social and collaboration features in SharePoint 2013.

The My Site Social API, which includes user profiles and social data, contains many new and changed features. New functionality for My Sites and team sites provides an interactive, conversational experience within feeds that makes it easier for users to stay connected to the people and content that matter to them.

The Newsfeed page on SharePoint Server 2013 displays several of these improvements, including a text box that enables users to quickly publish microblog posts and an interactive, conversational feed of posts and updates from the people and content that the user is following.

New Social namespace provides APIs for social feeds and following people and content

The Social namespace contains the primary API for working with feeds and microblog posts and for following people and content. For more information, see Microsoft.SharePoint.Client.Social for the .NET client object model, SP.Social for the JavaScript object model, and Microsoft.Office.Server.Social for the server object model.

New client APIs for social feeds, following people and content, and user properties in SharePoint 2013

SharePoint 2013 includes new client APIs that you can use to work with social feeds, follow people and content, and retrieve user properties in online, on-premises, and mobile development. When possible, you should use client APIs for SharePoint 2013 development instead of using the server object model or web services. Client APIs include managed client object models, a JavaScript object model, and a Representational State Transfer (REST) service. If you are developing an app for SharePoint, you must use a client API.

Not all server-side functionality in the Microsoft.Office.Server.UserProfiles assembly is available from client APIs. For example, there's no client-side access to the API in the Microsoft.Office.Server.Audience namespace, the Microsoft.Office.Server.ReputationModel namespace, or the Microsoft.Office.Server.SocialData namespace. To see which APIs are available, see the Microsoft.SharePoint.Client.Social namespace and the Microsoft.SharePoint.Client.UserProfiles namespace.

For information about how to access the My Site Social client APIs, see Get started developing with social features in SharePoint 2013. For more information about the API sets in SharePoint 2013 and when to use them, see Choose the right API set in SharePoint 2013.

Use the ProfileLoader.CreatePersonalSiteEnqueueBulk method to provision personal sites for multiple users (My Site Host administrators on SharePoint Online only)

My Site Host administrators can use the ProfileLoader.CreatePersonalSiteEnqueueBulk method to programmatically provision personal sites for multiple users on SharePoint Online.

The following code example uses the .NET client object model in a console application. Before you run the example, add references to Microsoft.SharePoint.Client.dll, Microsoft.SharePoint.Client.Runtime.dll and Microsoft.SharePoint.Client.UserProfiles.dll, and change the placeholder values for the userName, passwordStr, and serverUrl variables. The serverUrl variable must be the URL of the SharePoint Online Administration Center.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.UserProfiles;

namespace CreatePersonalSiteBulkConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            string userName = "administrator@contoso.onmicrosoft.com";
            string passwordStr = "password";
            string serverUrl = "https://contoso-admin.sharepoint.com/";

            using (var clientContext = new ClientContext(serverUrl))
            {
                SecureString password = new SecureString();
                Array.ForEach(passwordStr.ToCharArray(), c => password.AppendChar(c));

                var credentials = new SharePointOnlineCredentials(userName, password);

                clientContext.Credentials = credentials;

                var web = clientContext.Web;
                clientContext.Load(web);
                clientContext.ExecuteQuery();
                ProfileLoader loader = ProfileLoader.GetProfileLoader(clientContext);

                if (loader == null)
                {
                    throw new InvalidOperationException("Failed to get ProfileLoader");
                }

                string[] userEmails = { "usera@contoso.onmicrosoft.com", "userb@contoso.onmicrosoft.com" };
                loader.CreatePersonalSiteEnqueueBulk(userEmails);
                loader.Context.ExecuteQuery();
            }
        }
    }
}

NoteNote

To get the required client DLLs, download the SharePoint Online Client Components SDK.

New objects for users and user properties in SharePoint 2013

SharePoint Server 2013 includes new objects that represent users and user properties:

  • The SocialActor object represents users (and other entities) for feed and following activities.

  • The PersonProperties object contains general user properties and user profile properties.

Note Note

Server object model versions are the SPSocialActor object and the PersonProperties object.

SharePoint Server 2013 also includes a new client-side UserProfile object that provides methods you can use to create a personal site for the current user. However, it does not contain the user properties that the server-side UserProfile object contains. To access user properties from client-side code, use the PeopleManager.GetMyProperties method or PeopleManager.GetPropertiesFor method (user profile properties are stored in the PersonProperties.UserProfileProperties property) or use the PeopleManager.GetUserProfilePropertiesFor method or PeopleManager.GetUserProfilePropertyFor method.

New client-side people picker control

The client-side People Picker control is an HTML and JavaScript control that provides cross-browser support for selecting people, groups, and claims. You can configure the picker with the same settings as the server-side version of the control, including control-specific properties (like allowing multiple users or users and groups) and web application-level configuration settings (like Active Directory Domain Services parameters or targeting particular forests). For more information, see How to: Use the client-side People Picker control in apps for SharePoint.

Deprecated and removed My Site Social API and features

The following My Site Social API and features are deprecated in SharePoint Server 2013:

  • The API in the Microsoft.Office.Server.ActivityFeed namespace is deprecated. The Social namespace provides the API for programmatically working with social feeds in SharePoint 2013. For backward compatibility, ActivityEvent items from SharePoint 2010 are displayed in SharePoint 2013 feeds as events that cannot be replied to. (Legacy event migration must be enabled in Central Administration.)

  • The My Site RSS feed (ActivityFeed.aspx) is replaced with new APIs in the REST service, the client object model, and the JavaScript object model. To migrate custom SharePoint 2010 code that uses this API (preferably a client API), replace all requests to ActivityFeed.aspx with calls to the new API and handle feed data that is returned in JavaScript Object Notation (JSON) format.

  • The Recent Activities Web Part is replaced with a new Newsfeed Web Part that supports multithreaded conversations and dynamic feed retrieval.

    Note Note

    We don’t support customizations of the Newsfeed Web Part or other feed Web Parts (such as the Site Feed Web Part on team sites). If you do customize these Web Parts, for example by using JavaScript overrides, be aware that your customizations may break in updates to SharePoint.

  • The Social Comments Web Part is deprecated.

  • The following activity events no longer automatically inform the feed: profile update, upcoming birthday, upcoming workplace anniversary, new membership, and change of manager. However, you can create custom event receivers for these activities. No new social events have been added.

  • The following fields in the Privacy enumeration are deprecated: Contacts, Organization, and Manager. SharePoint 2013 offers only Private (Only Me) and Public (Everyone) privacy settings. Existing privacy settings are retained until they are changed by the user. To migrate custom SharePoint 2010 code that uses this API, replace all references to the deprecated privacy fields.

  • The Following People API that is accessed from the SocialFollowingManager replaces the Colleagues functionality from SharePoint Server 2010. The Colleagues page is replaced with the People I'm following page. The Groups feature that enabled users to organize colleagues into groups is no longer available.

  • Organization profiles are obsolete in SharePoint 2013, and the following types are deprecated: OrganizationProfile, OrganizationProfileManager, OrganizationMembershipType, OrganizationNotFoundException, OrganizationProfileChange, OrganizationProfileChangeQuery, OrganizationProfileMembershipChange, and OrganizationProfileValueCollection.

  • The My Links feature is deprecated in SharePoint 2013.

The new Community Site feature includes a new site template and improved discussion experience. Features such as reputation, categories, featured discussions, a question-post type, and best replies let community members easily find popular discussions, relevant information, and people with similar interests. Members build reputation as they participate in communities.

The Community Site feature does not expose a specific API for development. To extend Community Site features, you use SharePoint site and list APIs directly. For example, you can use SharePoint APIs to customize the site and list templates, create custom activities from communities for the social feed, integrate reputation information into search results, customize the reputation model, or create workflows to moderate discussions.

The following list contains information for developing with Community Site features:

  • Community Sites use the Community site template (Id = 62). The site template is not available for public websites. The template type of the discussion board list is DiscussionBoard (value = 108).

  • Activating the Community Site feature activates the CommunityEventReceiver event receiver.

  • To customize the client-side rendered list view, you must use JavaScript overrides to replace the view. List views cannot be extended through the SharePoint 2013 API. For more information, see How to: Customize a list view in apps for SharePoint using client-side rendering.

  • Community Sites use asynchronous events to update objects. If asynchronous events run in the background, you may encounter Save conflicts when you attempt to update lists or list items, and your handle to the object may become stale.

    As a workaround, handle exceptions that are returned by Update calls, refresh the instance before you retry the call, and loop for multiple retries, as shown in the following code example.

    int retries = 1;
    while (retries <= 10)
    {
        try
        {
            spListItem.IconOverlay = urlString;
            spListItem.Update();
            break;
        }
        catch (SPException saveConflict)
        {
            spListItem = web.Lists.GetItemById(spListItem.ID);
            retries++;
            if (retries > 10) throw;
            System.Threading.Thread.Sleep(1000);
        }
    }
    
    
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.