I have an event reciever that fires when ever an item attachment is added.

 public override void ItemAttachmentAdded(SPItemEventProperties properties)

enter image description here

The metadata should autocomplete depending on the items name.

Everything is working perfect exact for the comboboxes like the one displayed below (Sector).

I want to know how to change the selected value the combobox programatically.

Ex. i want to change the value to "FF - Fire Fighting".

1 Answer 1


Set Column's Default value to 'FF - Fire Fighting'(your data).

  • Go to List/Libray Settings
  • Edit Column
  • Set Default value what you want.

Set Default Value Programmatically:

using (SPSite siteCollection = new SPSite("http://dev.site.com"))
            using (SPWeb web = siteCollection.OpenWeb())
                SPList customDocumentLibrary = web.Lists["Program Documents"];
                MetadataDefaults columnDefaults = new MetadataDefaults(customDocumentLibrary);

                SPFolder testFolder = customDocumentLibrary.RootFolder.SubFolders["Programs"];

                columnDefaults.SetFieldDefault("/Program Documents/Programs/Academics", "Programs", "Academics");



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.