Resource Page DescriptionThis 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
- Create a folder named Microsoft.SDK.Server.Samples, and then unzip the DocLibraryActivityFeed.zip file in it.
- Start Visual Studio 2010, and then open the DocLibraryActivityFeed.sln files that is in the folder that you created in step 1.
- 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.
- In the DocLibraryActivityEventReceiver project, take the following steps:
- In Feature1.EventReceiver.cs, replace "<your site>" in the FeatureActivated and FeatureDeactivating methods with the address of your development test site.
- In EventReceiver1.cs, replace "<your site>" in the ItemAdded method with the address of your development test site.
- In the DocLibraryActivityFeedTimerJob project, take the following steps:
- In Feature1.EventReceiver.cs, replace <your site> in the FeatureActivated method with the address of your development test site.
- 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.
- In TimerJob.cs, replace <your site> in the Execute method with the address of your development test site.
- In TimerJob.cs, replace <admin account> in the Execute method with a User Profile Service administration account.
- 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
- After the solution is built and deployed, go to any document library on your site. Add a document to the document library.
- Go to your newsfeed to view the activity event that you have created.
|