WHAT’S IN THIS CHAPTER?
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code downloads for this chapter are found at www.wrox.com/remtitle.cgi?isbn=1118495829 on the Download Code tab. The code is in the chapter 08 download and individually named according to names throughout the chapter.
Many psychological and educational theories attempt to explain how a person’s environment impacts his ability to learn and understand. A person’s social connections form an environment that has become a focus in educational institutions and learning organizations. For example, the developmental theory of social constructivism suggests that a person’s culture and context in social settings allow groups to construct knowledge jointly for the benefit of the group. This concept was further expounded in the IBM Systems Journal article titled “Communities of Practice and Organizational Performance” where the authors identify a community as “a group whose members regularly engage in sharing and learning, based on their common interests,” or a community of practice. The authors conclude that:
. . . communities play a significant role in the development of social capital, which in turn influences organizational outcomes. These findings provide us with guidance to using communities as a vehicle for improving performance. However, the real challenge is to identify the management actions that will build the social capital necessary to achieve these goals.
(Lesser and Storck, 2001)
Organizations that seek to foster the growth of communities or teams of like-minded individuals working together toward common goals often turn to software applications to assist with the cultivation of organizational relationships. These applications fall into the broad category of social software and are usually identifiable by the techniques they use to share information between users.
This chapter examines the technical capabilities of SharePoint 2013 and how you can use them to produce the social capital mentioned by Lesser and Storck. SharePoint 2013 offers the following application areas that are of special interest in the social software category:
This chapter ends with a quick look at a suggested governance model, which organizations may choose to adopt as a set of guide rails designed to prevent their SharePoint installation from going off the tracks and turning into something other than what the organization intends.
The following overview outlines the numerous enhancements to SharePoint that speak specifically to the social software space.
SharePoint 2013 has been enhanced with a new user experience to enable users to quickly find information and more easily interact with data. The look and feel of SharePoint 2013 sites has been refreshed and enhanced with HTML5 to enable capabilities such as drag and drop of documents from the desktop into the browser. SharePoint Search, discussed in Chapter 9, “Building Search-Based Applications in SharePoint 2013,” has been integrated with the FAST search engine technology such that FAST is now a core part of the product, complete with its enhanced user experience. Users can more easily leverage their My Site to keep track of their interests and happenings around the organization.
SharePoint 2013 allows you to create web pages that work in today’s most popular web browsers and mobile browsers. The browsers that are supported include:
The new user experience has been designed to target a broad set of standards-based browser capabilities while providing an excellent experience. Figure 8-1 demonstrates this new user experience on a mobile device with high-fidelity browsing on one side of the image and the easy-to-use navigation menu available for mobile devices on the other side of the image.
Editing SharePoint content is similar to editing Office document content, thanks to the rich text editor. This rich text editor enables dragging and dropping of page content, familiar keyboard shortcuts such as Ctrl+Z multistep undo, and CSS-compliant styling selections such as Address and BlockQuote. Furthermore, the page-editing experience uses the ubiquitous SharePoint Ribbon and in-line content-editing capabilities to make manipulating SharePoint content even more familiar.
Although the words social networking usually strike terror into the hearts of corporate executives, SharePoint again takes the Internet concepts popularized by Myspace and Facebook and pulls the best features into an enterprise-class application. Inside of SharePoint, the following features help stitch a collection of users into a rich social fabric.
SharePoint 2013 introduces a new approach to sharing sites and documents with others. Content can now be easily shared via the Share button on the Ribbon, which pops up a simple sharing dialog box, as shown in Figure 8-3. Users of Office 365 can even share content with external partners without requiring any preexisting portal user identity because of Office 365 integration with the Windows Live identity management platform.
Returning from previous versions of SharePoint, blogs and wikis are easily visible social features of SharePoint 2013.
Tags and social feedback not only make enterprise content easier to manage, but they also enhance user participation and interaction by enabling users to discover content and what other users think of that content. SharePoint 2013 takes that socialization of content to greater heights with features including the newsfeed and the content-following capability.
A special mention of the enterprise taxonomy or meta data feature set is required at this point. Microsoft SharePoint Server 2013 includes a feature that enables a company to centrally define its classification taxonomy. An information architect or librarian can select a set of categories into which all content in the enterprise falls. These categories can then be applied to an element of content in the portal. The enterprise taxonomy differs from social tagging in that the enterprise taxonomy is a formally designed and approved view of the organization and can be consistently applied to all of the content in the portal. Social tagging, as discussed in the earlier “Social Categorization and Feedback” section, creates an informal folksonomy, which helps users find the content they’re interested in faster but does not replace the formal corporate information architecture. The enterprise taxonomy capabilities are discussed in the “ECM Features” section of Chapter 12.
Corporate intranets have historically been an asset controlled by the IT and Corporate Communication departments. The purpose of a corporate intranet has traditionally been to disseminate information from the top down. The Human Resources department has an area in which users can download approved HR documents and forms. The Marketing department has an area in which it can post approved logos and letterheads. The IT department may even offer an electronic form that submits trouble tickets to the company help desk. When SharePoint entered the company landscape, it offered users the ability to easily contribute their own content to the intranet. Most frequently, this has been in the form of project team sites where a community of people work together to produce and share document-based work products. Occasionally user contributions have been in the form of a knowledge-based or wiki-based dynamic document. SharePoint discussion lists keep threaded conversations out of e-mail and available on the portal for everyone to consume. SharePoint 2013 continues the trend of previous versions of focusing on users with an updated team sites concept that has become even easier to update and maintain than before, as well as the new community site template discussed in the “Communities” section. One of the smallest and yet most significant changes to the default team site template in SharePoint 2013 is the default inclusion of the easily removable Get Started with Your Site web part that helps new users understand the realm of possibilities available to them. SharePoint 2010 team sites used to start with a blank page that would frequently leave novice site owners confused as to where they should start.
A wiki is a collection of web pages that makes it easy for people to edit and cross-link information to organically grow and refine content based on contributions of multiple people. One of the best aspects of SharePoint wikis is the feature affectionately known as Wikis Everywhere. Now, every SharePoint team site is a wiki site by default! Editing the content on a page becomes as simple as clicking the Edit tab and typing in the page that contains the rich text page editor previously described. Creating a new page is as simple as using the familiar double bracket enclosure [[ ]] to create a link to the page that doesn’t yet exist. SharePoint creates a stub page or placeholder to the new page, creating the page after the link is clicked for the first time.
Wiki pages are not restricted to sites based on the team site template. Any site can add a specialized wiki page library that stores wiki publishing pages. To present users with the easiest possible page creation experience, consider the following recommendations for wiki page library management:
SharePoint 2013 provides familiar blog functionality such as authoring posts, reader comments, and content categorization, but it has further enhanced the experience by adding theme and post ID capabilities. Refer to Figure 8-4 to see a blog that has the theme changed and post layout updated.
The blog site template in SharePoint 2013 features a refreshing UI template that would be acceptable on any public internet site without modification. Navigation elements have been enhanced to allow sorting content by category and date. The content features an Ajax-based page experience when toggling the comment view on and off. The blog is described by an About This Blog content area. Owner-specified related links are also available for readers of the blog. Finally, the Share & Track Ribbon tab offers readers the familiar notification, sharing, and social capabilities.
Adding posts to and editing posts on a SharePoint 2013 blog takes advantage of the rich text editor seen on team site pages. The author can use the SharePoint Ribbon complete with Live Preview functionality and streamlined image-insert capabilities to write and edit content online. Should the online editing experience not meet the user’s needs, the ability to launch an external blogging program such as Microsoft Word is available as a link in the owner tools section.
Public-facing blogs are a familiar phenomenon, but some of the uses for internal blogs may be less apparent. Internal blogs are written by company employees for company employees and are often a valuable tool for promoting organizational awareness. Examples of internal blogs include:
Blogs are written either from a bottom-up perspective or a top-down perspective. Bottom-up posts are written from the perspective of the line workers and low-to-mid-level managers. These blogs are written to express ideas or experiences they have had. Top-down blogs are a way to deliver executive messages, such as strategic direction, corporate status, and announcements. Blogs act as a record of lessons learned, experiences, events, successes, and failures. The numerous benefits of internal blogs include knowledge sharing and team building:
Recalling the words of Lesser and Storck, a community of practice is a group whose members regularly engage in sharing and learning, based on their common interests. Inside of an organization, the groups can be team focused, department focused, and even activity- or work-product focused. A key point to think about when building communities is that they shouldn’t become a distraction for people during their common work activities. An ideal corporate community is one that enhances the work experience and makes it easier to quickly accomplish tasks.
One of the major pillars of a community is collaboration. Collaboration can be something as straightforward as a discussion board or be as complex as tagging content or assignment of meta data. Meta data is anything that describes the actual data, such as the author, the last edited date, the organizational department that owns the content, and the customer to whom the content is pertinent. By encouraging community members to add content to their various communities, they can stay current on a given topic and can be more in touch with how that content is viewed and used throughout their community. Wikis, blogs, and discussion forums are great ways for members to collaborate and get feedback from other participants in the community.
Collaboration can be successful only with good communication; this is what ties the community together. Communication requires that the technology enables members to interact and also expects the members to clearly convey their ideas with the tools provided to them. With SharePoint 2013 there is a wide selection of tools such as microblogs and discussion forums with Best Reply voting that can be used to communicate the ideas of community members to their peers and the world. The “Community Site Template,” “Discussions,” and “Newsfeed in Depth” sections of this chapter introduce each of these tools and how they can be independently and jointly leveraged to create a thriving online community.
An online corporate community should be a secure and safe place for teams of people to work together. It should provide the tools that enable the team to collaborate and communicate effectively with each other, regardless of each team member’s physical location. Building an online community may have proven to be difficult in the past, but with Microsoft SharePoint 2013, it has become a much easier task. With SharePoint 2013, community creators are given the opportunity to set up their community however they see fit, organically grown from a variety of the community site template. When created, the community can have open or private group membership, as well as the ability to control access to information within the membership of that community through extremely flexible and granular security configurations.
Creating a new community is as simple as creating a new SharePoint 2013 site. You can use the community site template or add the community features to an already-created site.
The first step of building a successful community is defining the topic of interest for the community. A vibrant community is one that has contributions from many people on a regular basis. Choosing a topic that many people will be interested in will usually get a lot more repeated and regular interaction, enriching the overall content. If the topic is predetermined, a good plan is to have a content owner or subject matter expert drive some of the early conversations. By adding dedicated owners and perhaps seeding the site with a few conversation starters, the community will likely grow and remain active for a longer time. However, communities and the associated SharePoint sites do not last forever, especially in the fast-paced corporate environment of today. When a community becomes stale, it should be decommissioned and removed to prevent the overall online corporate ecosystem from bogging down with old and out-of-date material. For example, it is now easy for a SharePoint 2013 site owner to set the closure and deletion settings to mark a site as read-only and leave it for archive purposes until such time as it is no longer needed and can be deleted.
The second task is to determine if the community is open or private. An open community is one that allows any member to join and usually displays the community in a directory listing. For example, most communities that focus on common interests such as company events will be an open community. There is also the option of having a private community with a closed membership. A closed membership might be appropriate to a community focused on nonpublic matters such as the concerns of the company’s financial decision makers. The decision between an open or private community depends on the need of the community and the type of content that should be available to that community.
To help grow the community, the right tools are needed to engage users of all types. These tools can include both off-line and online capabilities such as a web browser or using the Microsoft Office Suite. Such a wide range of available tools enables all members to personalize their unique style of interaction with the communities they belong to. Many members find that instead of using one tool for maintaining their community contributions, they actually use many tools. For instance, members might usually use Microsoft Outlook as their reader for conversations and documents when traveling or on the go and they cannot access the computer that they use regularly. Then, they may turn to an Internet browser such as Microsoft Internet Explorer to view, edit, and respond to the community when they get back online for a full set of capabilities.
The community site template incorporates all of the features together into a single site template. This template has all of the lists and libraries needed for enhanced discussions and blogs, as well as member involvement with badges, replies, and member reputation. This template brings together many features that add the custom actions, lists, and web parts to use all of the community enhancements. You can see in Figure 8-7 that when created, the site will have social features, the membership list, and the administrative links.
As you can see, the community site template is a normal site template just like a team site. The community components do not interact with a central service application such as My Sites. Therefore, there is no specific API for the community features, but rather you can access all of the elements in the site just as you would with any other code for sites. The community site template is not available in SharePoint Foundation 2013. This means that you can still use components such as discussion boards, but you will not have the added automated community features. Listing 8-1 shows some of the values stored in the property settings of the web for each community. The code also determines if the site is community-based on the selected templates.
LISTING 8-1: Community Site Template Properties
SPWeb web = site.RootWeb; //Check if this is a community site if (web.WebTemplate == "COMMUNITY") { //Get the Community Established Date DateTime CreatedDate; if (web.AllProperties.ContainsKey("vti_CommunityEstablishedDate")) { CreatedDate = (DateTime)web.AllProperties["vti_CommunityEstablishedDate"]; } else { CreatedDate = web.Created; } string RepliesCount = web.AllProperties["Community_RepliesCount"].ToString(); string TopicsCount = web.AllProperties["Community_TopicsCount"].ToString(); string MembersCount = web.AllProperties["Community_MembersCount"].ToString(); //Display Values of the Community Console.WriteLine("Community Created On {0}", CreatedDate); Console.WriteLine("Number of Replies Count {0}", RepliesCount ); Console.WriteLine("Number of Topics Count {0}", TopicsCount); Console.WriteLine("Number of Members Count {0}", MembersCount); } else { Console.WriteLine("This is not a community template, this is the {0} template", web.WebTemplate); }
The discussion boards are one of the major lists to get improvements with this version of SharePoint. The discussion boards list has been one of the primary list templates since the beginning of SharePoint. Over the years the way discussion boards have been used has changed based on the impact of how data is communicated. The new features include a cleaner user interface for creating a reply to a post, being able to mark a discussion as a question, and being able to use metrics from discussions to determine a person’s reputation.
To assist with moderation of the content, SharePoint 2013 provides a link to a Manage Discussions web page and a web part that shows a summary of the number of discussions and replies. If you use the community template, you can notice that the default list has a different title than the URL, so be careful to know which one you need if you use the API. Listing 8-2 shows the interaction with the Community Discussion.
LISTING 8-2: Community Discussion
SPWeb web = site.RootWeb; string discussionURL = web.Url + "/Lists/Community Discussion"; SPList communityDiscussion = web.GetList(discussionURL) ; //Create a new discussion topic string discussionTitle = "New Discussion Created" + DateTime.Now; SPListItem discussion = SPUtility.CreateNewDiscussion(communityDiscussion.Items, discussionTitle); discussion[SPBuiltInFieldId.Body] = "Creating discussion in API"; discussion.Update(); web.Update(); //Display all of the discussions and posts SPListItemCollection discussionTopics = communityDiscussion.GetItems(new SPQuery()); foreach (SPListItem discussionTopic in discussionTopics) { Console.WriteLine("Discussion: " + discussionTopic.DisplayName); object BestAnswerID = discussionTopic[SPBuiltInFieldId.BestAnswerId]; if (BestAnswerID != null) { Console.WriteLine("Discussion has Best Answer ID =" + BestAnswerID); } SPQuery query = new SPQuery(); query.Folder = discussionTopic.Folder; SPListItemCollection posts = communityDiscussion.GetItems(query); foreach (SPListItem post in posts) { Console.WriteLine(post[SPBuiltInFieldId.Body]); } }
SharePoint 2013’s reputation system is a site-level calculation of the achievements that a person has earned on a given community. The settings are completely configurable and designed to allow for different types of calculations. The ability to select if the items in the lists can be rated provides for community interaction and contribution. This is especially important in a system that uses the question-and-answer features of the discussion posts. The SharePoint team did not stop at being able to rate the content; actually, they added the ability for users to select between rating and liking content. This complete rating system provides the foundation so that you can build complex community applications. To modify these settings you can click the link on the homepage of the community or navigate to the Site Settings menu that also provides the administrative links. Figure 8-8 shows the Community Reputation Settings page.
In the reputation settings, user ratings are only a small portion of the overall way that a person creates achievements. There are four items that allow a user to create points if the achievement point system is enabled. These are Creating a new post, Replying to a post, Member’s post or reply gets liked or receives a rating of 4 or 5 stars, and Member’s reply gets marked as “Best Reply.” You can provide your own unique values to how much weight these areas count for. After you determine the point values that each item will receive when created, you can use five different point levels to display where a user currently is ranked. This ranking appears on each member’s profile of the site, which is also configurable. You can either display the point level as a set of images from 1 to 5, or you can use text to display what the level means. For instance, in your site you might configure level 5 to be listed as an Expert and Level 1 to be a Contributor.
The reputation system automatically recalculates your reputation based on the selected values previously detailed, but SharePoint 2013 also provides a new way to give users a badge on their profile. The badges are defined in a list on the site called /Lists/Badges, which provides a Lookup field to the Community Members list of whom the badge is given. After you define the values of the badges, you can then select members and assign them badges — hence the name “gifted badges” because you are gifting the badges to them.
When you give a badge to a user, the badge shows up on the user’s profile card. The badge displays in place of the reputation settings. This means that if you give someone a badge, her profile will show only the badge and not the level received on the site. If you remove the badge from the user, she can then show her point level again. When building your site, consider which one of these you would like to display, or you could create a new query to the Community Membership list to display both. Remember the values are stored in a SharePoint list that you can access through the SharePoint standard API. Some of the fields might not show up if they are hidden, but you can still access them in the API.
As previously mentioned, one of the metrics for building reputation is based on the number of replies a user enters that are marked as the best reply for a discussion. The way to indicate a reply is the best is done by the moderator and owner of the discussions. Only one reply can be marked as the best reply, but this post gets moved to the top of the discussion list and highlighted with the discussion that started the thread.
The best-reply field that is called BestAnswerID in the Discussion board schema.xml is the ID of the corresponding post. This field is marked as read-only, which means you must update the field using the user interface or directly from the API. Keep in mind that if you change the value, that only one person will get a reputation score based on the currently selected best reply, but the previous person will not lose reputation points.
To help determine which questions have been answered, there is an option to mark a discussion as a question. After it has been marked as a question, a flag is set for the views to show the discussion if it is not answered. There is an Answered questions view and an Unanswered questions view. This Q-and-A feature takes advantage of the best-replies option, and a discussion is considered answered if a moderator has marked a post as a best reply.
The members of a community are what help it to succeed. Administrators help manage the community and keep it on track. For these reasons there is a new membership page and administration experience for the members of the community. The membership page describes the community members. Because these members are users of the SharePoint farm, the membership page will provide a subset of the user profile details plus list any externally invited users. It is important to know that because the community features and template are not allowed to be used on externally facing websites, the membership page is available to authenticated users only.
On the membership page you can find that you can sort the members by top contributors, new members, or A–Z and Z–A. When the members are shown in the membership list, you can see their details about them, such as their picture, name, reputation, and standard metrics about their reputation. You can also see information about yourself on the page. In your information you can find your reputation score, how many points are needed to get to the next level, and the ability to leave the community if you no longer want to participate.
SharePoint 2007 and SharePoint 2010 both used the My Site feature to create a single central location for users to manage their profile details, store personal and publically available content, and in 2010, microblog and communicate via the Note Board. SharePoint Server 2013 expands this existing feature set with an emphasis on simplifying the user experience through a clean and uncluttered UI and a unified navigation. 2013 My Sites also offer a centralized list of assigned tasks across sites and even applications, thanks to the new Work Management service application, which can integrate SharePoint, Project Server, and Exchange tasks. New features, including the Newsfeed, allow enterprises to host internal Twitter-style conversations, which leverage a familiar hashtag vocabulary to keep employees in touch and up to date with each other.
User profiles in SharePoint contain the details about individuals in the organization. Properties like first and last name, title, e-mail address, and department are but a few of the fields that are stored in a user’s profile available by default. User profiles are also easily extended to store customized information.
There are three methods to populate the profile database in SharePoint:
Organizations that have committed to technologies such as Active Directory will have an easier time populating their profile database because of native integrations, but other user directories and databases are valid options. After a user profile is created, a basic profile page for that user will be created. This page is a placeholder that contains core information. Apps and web parts that reference the user’s profile, such as the results of a people search, point to this placeholder page until the My Site has been provisioned for the user.
Microsoft makes several APIs available for accessing and manipulating user profile data including several client object models and REST services. Microsoft recommends leveraging your choice of CSOM to reduce the amount of code installed on a server. When leveraging the .NET client object model, the primary object is the PersonProperties object inside of the Microsoft.SharePoint.Client.UserProfiles namespace.
To create a simple application that reads a specific user’s profile properties using the best practices CSOM API, follow these simple steps:
Microsoft.SharePoint.Client Microsoft.SharePoint.ClientRuntime Microsoft.SharePoint.Client.UserProfiles
// Update constants with real values. const string serverUrl = "http://tailspintoys.com/"; const string targetUser = "tailspinmattr"; ClientContext clientContext = new ClientContext(serverUrl); // Get the PeopleManager PeopleManager peopleManager = new PeopleManager(clientContext); // Get the user's properties PersonProperties personProperties = peopleManager.GetPropertiesFor(targetUser); // Load and run the request for AccountName and UserProfileProperties clientContext.Load(personProperties, p => p.AccountName, p => p.UserProfileProperties); clientContext.ExecuteQuery(); foreach (var property in personProperties.UserProfileProperties) { Console.WriteLine(string.Format("{0}: {1}", property.Key.ToString(), property.Value.ToString())); } Console.ReadKey(false);
Notice in the object relationships for the PersonProperties parent and child objects in the code snippet that PeopleManager.PersonProperties.UserProfileProperties<iEnumerable> grants access to each available property name and value for a user’s profile.
To learn more about user profiles in SharePoint 2013 including common programming tasks such as how to create and change user profile properties, review the MSDN article “Work with user profiles in SharePoint 2013” at http://msdn.microsoft.com/en-us/library/office/jj163800(v=office.15).aspx.
SharePoint 2013 automatically provisions every user’s My Site with an access-restricted document library called My Documents. By default, items in this document library are access restricted, but a folder inside the library called Shared with Everyone offers everyone read access. This experience, clearer in intent than 2010’s pair of distinct libraries named Personal and Shared, is also the home location for SkyDrive Pro. SkyDrive Pro is SharePoint 2013’s new content synchronization experience that enables easy off-line access to content via Windows Explorer integration in the same manner as Dropbox and SkyDrive. Unlike those public services, however, SkyDrive Pro is secured and backed up by corporate IT (or Microsoft for Office 365). To access SkyDrive Pro via the browser, simply click the SkyDrive link in the top navigation. To synchronize content to a new computer, click the SYNC button in the right corner on the Ribbon, as shown in Figure 8-9. Clicking the SYNC button installs a small program to continuously keep content synchronized between that PC and the My Site SharePoint document library. Mobile applications are also available to quickly access SkyDrive Pro content on the go.
Following content in SharePoint 2013 is the user-initiated act of indicating interest in a specific document, person, site, or tag. By following portal content or users, normally accomplished via a Ribbon button, the user’s newsfeed can receive updates about that content or user. When a user creates a site, interest in that site is inferred by SharePoint, and that user is automatically marked as following that site. The same is not true of tags or documents; when users apply a tag or upload a document, they are not automatically assumed to be interested in either the tag or document.
SharePoint 2013’s most visible enhancement in upgrading SharePoint’s social awareness is in the new newsfeed architecture. The newsfeed is made up of two social-feed components:
To meet the reliability and performance requirements of these two social feeds, SharePoint leverages a distributed cache service built on top of the Windows Server AppFabric Distributed Caching architecture. This distributed caching service not only speeds the performance of social feeds, but also assists in the caching of authentication tokens. By default the distributed cache service is active on all web and application servers in a farm, but administrators have the ability to consciously dedicate specific machines in a farm to the caching service. The total maximum size of the cache is the sum of the memory allocated to the Distributed Cache service on each of the servers running the service. Figure 8-10 shows how the architecture of newsfeed and the Distributed Cache service work together to provide SharePoint 2013’s social awareness. The Distributed Cache service is a fundamental component not only of the social feeds but also to 10 other caching services, such as the Search Query Web Part and the Security Trimming Cache.
Microblogs are positioned to be the internal Twitter of an organization, designed to allow for short status updates. SharePoint 2013’s microblogs are designed for public peer-to-peer interactions via the @mention syntax. The centralized access to the microblog via a My Site newsfeed allows for easy generation of interest in public dialogue. To assist users in applying context to a conversation, Microsoft adopted the #hashtag syntax popularized by Twitter. Hashtags work like any other meta data tag, complete with tag profile pages and inclusion in a user’s My Site page’s Trending Tags.
Users can post updates to their microblog via their My Site and via a number of mobile applications, as shown in Figure 8-11. After a user has posted a message, it can no longer be edited but it can be deleted. The maximum length of an individual post is 512 characters, and an individual post can receive a maximum of 100 replies. In addition to text, @mentions, and #hashtags, a user can enter URLs, pictures, and videos. HTML syntax is not supported.
SharePoint considers an activity to be potentially any action, either user generated or system generated. Out of the box, SharePoint 2013 recognizes four broad categories of activities including:
These activities are stored in the Distributed Cache and content databases (refer to Figure 8-10). When an activity has been recorded, it becomes eligible for display on any of the available feeds in SharePoint, including the following My Site feed views:
In addition to the feed views available on a user’s My Site, a site feed is also available on a team site. A site feed functions like a user’s My Site newsfeed except that it can be secured to a restricted group of users. Site feeds are accessible through search, but security trimming is enforced such that a user without access to the site containing the feed will not receive feed activities in their search results.
For more information on the SharePoint 2013 microblogs, feeds, and Distributed Cache service, refer to the TechNet article, “Overview of microblog features, feeds, and the Distributed Cache service in SharePoint Server 2013,” available online at http://technet.microsoft.com/en-us/library/jj219700(office.15).aspx.
Writing code for SharePoint 2013’s My Sites and Newsfeeds leverages the SharePoint Social API. Microsoft has made significant investments since the 2010 version to open functionality and lower the development bar. To that end, Microsoft offers no fewer than six distinct options for working with the My Site social features defined in Table 8-1.
With the Social API, developers can write code to read and write to a user’s social feed, follow people or content on behalf of the user, or retrieve various user profile properties. Follow these instructions to create a sample application that manipulates a user’s social feed.
Microsoft.SharePoint.Client Microsoft.SharePoint.ClientRuntime Microsoft.SharePoint.Client.UserProfiles
using Microsoft.SharePoint.Client; using Microsoft.SharePoint.Client.Social;
// Update constants with real values. const string serverUrl = "http://tailspintoys.com/"; ClientContext clientContext = new ClientContext(serverUrl); // Write the post's text. SocialPostCreationData feedMessage = new SocialPostCreationData(); feedMessage.ContentText = "This is an automated post from sample code"; // Get the SocialFeedManager. SocialFeedManager feedManager = new SocialFeedManager(clientContext); // Publish the post. The first param is null because this is not a reply feedManager.CreatePost(null, feedMessage); // Update the user's newsfeed clientContext.ExecuteQuery();
This is an extremely simplified example designed to introduce you to the SocialFeedManager object. This object is responsible for accessing a user’s feed for read/write purposes. For more information on developing applications that leverage the SharePoint 2013 Social API, refer to the MSDN article titled “Work with social feeds in SharePoint 2013,” available online at http://msdn.microsoft.com/en-us/library/jj163237.aspx.
Microsoft has dramatically overhauled the accessibility and utility of SharePoint’s social capabilities with the release of SharePoint 2013. SharePoint 2013 is now a first-class competitor in the social enterprise application space with new features such as microblogs and badging. This chapter covered the existing and new capabilities, including consumption-centric features such as the new multidevice user experiences and newsfeeds, as well as the content-contribution–centric features such as enhanced content editing and social feedback. This chapter introduced you to key concepts and architectures, as well as the new Social API. Armed with this knowledge, you created several prototype applications such as one to manipulate discussion forums and one to access a user’s profile details.
The next chapter focuses on discovery and content awareness through the new SharePoint 2013 search engine, now based on the FAST technology.