Compartilhar via


Code Sample: Multicasting Activity Events Console Application

Applies to: SharePoint Server 2010

This sample demonstrates how to use the new Activity Feed object model in Microsoft SharePoint Server 2010 to create and multicast activity events. It creates a custom activity feed gatherer and custom ActivityTemplate, ActivityType, and ActivityEvent objects, and then shows how to publish and multicast events from a custom activity fee gatherer. Console output verifies that each step in the application is finished. See How to: Create a New Activity Type for a walk-through of the code in this sample that creates new ActivityType objects. See the Multicasting Events into User Newsfeeds section of How to: Create and Insert Events on a User's Newsfeed for a walk-through of the code in this sample that multicasts activity events.

Install this code sample on your own computer by downloading the Microsoft SharePoint 2010 Software Development Kit (SDK) or by downloading the sample from Code Gallery. If you download the SharePoint 2010 SDK, the sample is installed in the following location on your file system: C:\Program Files\Microsoft SDKs\SharePoint 2010\Samples\Social Data and User Profiles.

Building and Running the Sample

The following steps demonstrate how to test this project on your development or test site.

To build the sample

  1. Create a folder named Microsoft.SDK.Server.Samples, and then unzip the CustomActivityGatherer.zip file in it.

  2. Start Microsoft Visual Studio 2010, and then open the ActivityFeedSample.sln file that is in the folder that you created in step 1.

  3. Change the values of the sampleSite string and the communityUrl string in CustomActivityGatherer.cs to the appropriate URLs for your development or test site.

  4. If they are not already present, add references to the following assemblies to the project:

    • Microsoft.SharePoint.dll

    • Microsoft.Office.Server.dll

    • Microsoft.Office.Server.UserProfiles.dll

  5. Add the resource files in the ULS-Resources-Dir directory (customgatherer.en-US.resx and customgatherer.resx) to your \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources directory.

To run the sample

  1. Press F5 to build the project and start the debugging process.

  2. After the console output indicates that the custom gatherer is finished doing its work, press any key to stop debugging.

See Also

Concepts

Using Activity Feeds with the Object Model

Other Resources

Code Gallery