Reza on blogging [MVP]

THIS BLOG HAS MOVED TO: http://blogs.devhorizon.com/reza

Subscriptions

<January 2009>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

News



toronto.sharepoint.camp


Navigation

Post Categories

Other Bloggers

Personal Links

Thursday, May 24, 2007 - Posts

Unblocking Created By or Modified By at list item level

Using browser interface and out-of-the-box, you cannot unblock "Created By" or "Modified By" because, according to SDK, they are kind of predefined fields based on the current logged-in user. However, using object model there is a way to change these two fields or "Assigned To" field programmatically. Below, you can see a code snippet that assigns a cross-site group to "Assigned To”, a domain group to "Created By" and finally an individual user to "Modified By" field. I have used SPUser.AllUsers[string name] to get the context of my user or group. This method requires that the user passed as the parameter (individual user or group) to be either members of the site or who have browsed to the site as authenticated members of a domain group in the site. If not, this method cannot find the user and you should get an SPUser object representing a the user which has never connected himself to a site. I will cover this one in another post , but for now let's assume that our user (or group) exists in the site's membership somehow.

Think twice before you implement such a functionality at list item because if there is any functionalities based on these fields and current logged-in user , they will be messed up since you have overwritten current logged-in user with your choice of security context. In such a scenario, I personally prefer to create a custom field instead of playing around with these fields.


posted Thursday, May 24, 2007 4:31 PM by rezaa with 0 Comments

Powered by Community Server, by Telligent Systems