You create a TimeTracking feature and install the feature on a Microsoft Windows SharePoint Services site.
You write the following code segment. (Line numbers are included for reference only.)
01 Public Class TimeTrackerEventReceiver Inherits SPFeatureReceiver
02
03 Public Sub NotifyUser(ByVal user As SPUser, ByVal featureName As String)
04
05 co de omitted
06 End Sub
07 …
08
You need to ensure that the site administrator is notified only when the TimeTracking feature is activated.
Which code segment should you insert at line 07?
A.
Public Sub New()
Dim properties As SPFeatureReceiverProperties = _
New SPFeatureReceiverProperties()
If properties.Definition.Farm.CurrentUserIsAdministrator() Then
Dim web As SPWeb = CType(properties.Feature.Parent, SPWeb)
NotifyUser(web.CurrentUser, properties.Feature.Definition.Name)
End If
End Sub
B.
Public Sub New()
Dim web As SPWeb = SPControl.GetContextWeb(New HttpContext(Nothing))
NotifyUser(web.SiteAdministrators(0), “TimeTracker”)
End Sub
C.
Public Overloads Overrides Sub FeatureActivated(ByVal _
properties As SPFeatureReceiverProperties)
Dim web As SPWeb = CType(properties.Feature.Parent, SPWeb)
NotifyUser(web.SiteAdministrators(0), _
properties.Feature.Definition.Name)
End Sub
D.
Public Overloads Overrides Sub FeatureInstalled(ByVal _
properties As SPFeatureReceiverProperties)
If properties.Definition.ActivateOnDefault Then
Dim web As SPWeb = CType(properties.Feature.Parent, SPWeb)
NotifyUser(web.SiteAdministrators(0), p roperties.Definition.Name)
End If
End Sub