Microsoft
70-573 · Question #195
You have a helper method named CreateSiteColumn that contains the following code segment. Private Shared Sub CreateSiteColumn (ByVal web As SPWeb, ByVal columnName As String)…
The correct answer is B. web.Fields.Add(columnName, SPFieldType.Choice, True). See the full explanation below for the reasoning.
Question
You have a helper method named CreateSiteColumn that contains the following code segment. Private Shared Sub CreateSiteColumn (ByVal web As SPWeb, ByVal columnName As String) web.Lists(0).Views(0).ViewFields.Add(columnName) End Sub 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
- ADim field As SPField = New SPFieldChoice
- Bweb.Fields.Add(columnName, SPFieldType.Choice, True)
- Cweb.Lists(0).Fields.Add
- Dweb.Lists(0).Views(0).ViewFields.Add(columnName)
How the community answered
(52 responses)- A6% (3)
- B85% (44)
- C8% (4)
- D2% (1)
Community Discussion
No community discussion yet for this question.