Which method should you use?

You are creating a Microsoft Windows SharePoint Services application.

You create a Windows SharePoint Services feature named MyFeature. You implement the feature within a Microsoft .NET namespace named MyFeature. You create a class named SiteMonitor that inherits from the SPWebEventReceiver class. The SiteMonitor class overrides two methods, named SiteDeleting and WebDeleting. Both methods cancel the deletion process.

You need to prevent all users, including site administrators, from deleting the MySite Web site.

Which method should you use?

You are creating a Microsoft Windows SharePoint Services application.

You create a Windows SharePoint Services feature named MyFeature. You implement the feature within a Microsoft .NET namespace named MyFeature. You create a class named SiteMonitor that inherits from the SPWebEventReceiver class. The SiteMonitor class overrides two methods, named SiteDeleting and WebDeleting. Both methods cancel the deletion process.

You need to prevent all users, including site administrators, from deleting the MySite Web site.

Which method should you use?

A.
Public Sub AddReceiver(ByVal myWeb As SPWeb)
myWeb.EventReceivers.Add(SPEventReceiverType.WebDeleting, _
“MyFeature”, “MyFeature.SiteMonitor”)
End Sub

B.
Public Sub AddReceiver(ByVal myWeb As SPWeb)
For Each user As SPUser In myWeb.AllUsers
user.IsSiteAdmin = False
Next
End Sub

C.
Public Sub AddReceiver(ByVal myWeb As SPWeb)
For Each user As SPUser In myWeb.SiteUsers
user.IsSiteAdmin = False
Next
End Sub

D.
Public Sub AddReceiver(ByVal myWeb As SPWeb , _
ByVal properties As SPFeatureReceiverProperties)
Dim receiverAssembly As SPFeatureProperty = CType(properties._
Feature.Properties(“ReceiverAssembly”), SPFeatureProperty)
Dim receiverClass As SPFeaturePr operty = CType(properties._
Feature.Properties(“ReceiverClass”), SPFeatureProperty)
receiverAssembly.Value = “MyFeature”
receiverClass.Value = “SiteMonitor”
End Sub



Leave a Reply 0

Your email address will not be published. Required fields are marked *