Search Wiki:
Resource Page Description
This sample demonstrates how to create and publish activity events whenever a user adds a document to a document library. It also demonstrates how to create a timer job that runs under an account that has User Profile Service Application administrative privileges in order to insert activity events into other users' activity feeds.

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 DocLibraryActivityFeed.zip file in it.
  2. Start Visual Studio 2010, and then open the DocLibraryActivityFeed.sln files that is in the folder that you created in step 1.
  3. In the Properties window, specify the site URL value of the absolute address of your development or test site (for example, http://mysite/). Ensure that you include the closing forward slash.
  4. In the DocLibraryActivityEventReceiver project, take the following steps:
    1. In Feature1.EventReceiver.cs, replace "<your site>" in the FeatureActivated and FeatureDeactivating methods with the address of your development test site.
    2. In EventReceiver1.cs, replace "<your site>" in the ItemAdded method with the address of your development test site.
  5. In the DocLibraryActivityFeedTimerJob project, take the following steps:
    1. In Feature1.EventReceiver.cs, replace <your site> in the FeatureActivated method with the address of your development test site.
    2. In Feature1.EventReceiver.cs, replace <your admin site> in the FeatureActivated method with the address of the Central Administration site of your development test site.
    3. In TimerJob.cs, replace <your site> in the Execute method with the address of your development test site.
    4. In TimerJob.cs, replace <admin account> in the Execute method with a User Profile Service administration account.
  6. On the Build menu, select Deploy Solution. After the build is complete, the feature event receivers, the document library event receiver, and the timer job are installed on your development or test site.

To run the sample


  1. After the solution is built and deployed, go to any document library on your site. Add a document to the document library.
  2. Go to your newsfeed to view the activity event that you have created.
Last edited Nov 9 2010 at 12:36 AM  by jamescro, version 5
Comments
c_marius wrote  Feb 9 at 8:21 PM  
Well done guys, I've adapted the same solution to use it as an automated way to signal when new Page is published on Publishing sites and encourrage authors to write more articles.

Updating...
Page view tracker