MetadataDefaults.Update Method

Write changes to default values to the disk and adds or removes the appropriate event handlers.

Namespace:  Microsoft.Office.DocumentManagement
Assembly:  Microsoft.Office.DocumentManagement (in Microsoft.Office.DocumentManagement.dll)

Syntax

'Declaration
Public Sub Update
'Usage
Dim instance As MetadataDefaults

instance.Update()
public void Update()

Exceptions

Exception Condition
ArgumentException

The document library for which the current MetadataDefaults object is created for does not contain a Forms folder at the root of the library.

Remarks

Any method on the MetadataDefaults type does not take effect until the changes have been applied to the settings document. If the settings document contains any location-based defaults, an SPItemEventReceiver.ItemAdded event receiver is registered so that any new items added to this document library receive the specified location-based defaults. If the settings document contains no defaults, then the ItemAdded event receiver will be unregistered to reduce processing time when adding new items to this document library.

Examples

SPSite site = new SPSite("http://contoso"); SPWeb web = new site.OpenWeb("/"); MetadataDefaults defaults = MetadataDefaults("/Documents", web); defaults.SetFieldDefault("/Documents/AdventureWorks", "Title", "AdventureWorks Document"); defaults.Update();

See Also

Reference

MetadataDefaults Class

MetadataDefaults Members

Microsoft.Office.DocumentManagement Namespace

MetadataDefaults