In the list, you sometimes need to take the attributes of a user, such as the displayname, department, mobile, and homedirectory of the user. Using the "user or user group" field, this effect cannot be achieved, therefore, this simple custom field is used to fill in the User Login Name and attributes to be displayed when adding/modifying the list item, when displayed, it is displayed by querying the user's relevant attribute values in the ad based on the login name. This item is not yet officially used and is in the testing stage. It can be expanded on this basis, Code Below, it is for reference only.
There are a lot of tutorials on the Development of custom fields. For more information, see erucy's blog. Article . Add a few words below.
The display method defined in fldtypes_custom.xml is defined in <renderpattern name = "displaypattern"/>. For multi-field (inherited from spfieldmulticolumn), the definition XML of this field project is like this: 1 < Renderpattern Name = "Displaypattern" >
2 < Switch >
3 < Expr >
4 < Column />
5 </ Expr >
6 < Case Value = "" >
7 </ Case >
8 < Default >
9 < Column Subcolumnnumber = "0" Htmlencode = "True" />
10 < Html > <! [CDATA [ 'S ]> </ Html >
11 < Column Subcolumnnumber = "1" Htmlencode = "True" />
12 < Html > <! [CDATA [ Is ]> </ Html >
13 < Column Subcolumnnumber = "2" Htmlencode = "True" />
14 </ Default >
15 </ Switch >
16 </ Renderpattern >
He looks like this: PIPIO's department is Development Department. The attribute value of subcolumnnumber corresponds to the attribute in spfieldmulticolumnvalue (which corresponds to the aduserfieldvalue class in this project ).
Then there is a simple way to customize attributes. For example, if ad needs to be connected here, the required custom attributes are also defined in fldtypes_custom.xml. This attribute is: < Propertyschema >
< Fields >
< Field Name = "Domainpath" Displayname = "Domain :" Type = "Text" Required = "True" />
< Field Name = "Domainusername" Displayname = "Username :" Type = "Text" Required = "True" />
< Field Name = "Domainpassword" Displayname = "Password :" Type = "Text" Required = "True" />
</ Fields >
</ Propertyschema >
In the code, use base. field. getcustomproperty ("domainpath") is easy to obtain. Here, there may be a bug. Refer to [solve the problem of incorrect attribute display when custom field type is modified] and fix it by patching, it's almost all hit SP1 now, so this bug should not be there.
Download the code here