nerdexam
Microsoft

70-573 · Question #103

You have a helper method named CreateSiteColumn that contains the following code segment. static void CreateSiteColumn ( SPWeb web, string columnName ) { } You need to add a new site column of type…

The correct answer is B. web.Fields.Add(columnName, SPFieldType.Choice, true). MNEMONIC RULE: "web.Fields.Add" SPFieldCollection.Add Method (String, SPFieldType, Boolean)

Developing SharePoint Solutions

Question

You have a helper method named CreateSiteColumn that contains the following code segment. static void CreateSiteColumn ( SPWeb web, string columnName ) { } You need to add a new site column of type Choice to a SharePoint site by using the helper method. Which code segment should you include in the helper method?

Options

  • ASPField field = new SPFieldChoice(System.web.Lists[0].Fields,
  • Bweb.Fields.Add(columnName, SPFieldType.Choice, true);
  • Cweb.Lists[0].Fields.Add(columnName, SPFieldType.Choice, True);
  • Dweb.Lists[0].Views[0].ViewFields.Add(columnName);

How the community answered

(37 responses)
  • A
    5% (2)
  • B
    81% (30)
  • C
    3% (1)
  • D
    11% (4)

Explanation

MNEMONIC RULE: "web.Fields.Add" SPFieldCollection.Add Method (String, SPFieldType, Boolean)

Topics

#site columns#SPField#SPFieldType.Choice#web.Fields.Add

Community Discussion

No community discussion yet for this question.

Full 70-573 Practice