Custom document library --- Extended document library field

xiaoxiao2021-03-06  84

Some additional information for tracking documents is required in actual business needs: document properties, document numbers, document serial numbers. All three information are composed of a certain rule, and the properties of the document library can be extended to meet the needs. The basic idea is to obtain the SPFIELDCOLLECTION object of the document library list. Use an extension attribute column using the object's Add method. The following is the presentation code segment, add three custom fields to the current site: SPWEB CurrentWeb = SPControl .GetContextWeb (Context); SPFieldCollection DocLibFields = CurrentWeb.Lists [ "shared documents"] .Fields; DocLibFields.Add ( "document properties", SPFieldType.Text, true); DocLibFields.Add ( "document number", SPFieldType.Text, True); Doclibfields.Add ("Document Serial No.", SPFIELDTYPE.TEXT, TRUE); // Put the newly added field to the default view of the newly added field in the default view of the document library [Share Document "] .defaultView; SpViewFieldCollection Viewfields = view.viewfields; viewfields.add ("document properties"); viewfields.add ("document number); viewfields.add (" document serial number); view.Update (); need attention during this process, Segment procedures involve modifications to the WSS database, pay attention to the addition of the security verification mechanism in the page, the second is that the INTERNALNAME of the custom field is not specified, can only be referenced by the display name in the program, sometimes there is some inconvenient But if the name is displayed in English, there is no problem. Until I completed this code, I found the addition bar page of the library in the SPS, but the definition bar features that comes with the files could not meet my actual business needs, otherwise I have to vomit.

转载请注明原文地址:https://www.9cbs.com/read-121636.html

New Post(0)