PrepAway - Latest Free Exam Questions & Answers

Which code segments should you add at lines 07 and 08?

You have the following event receiver. (Line numbers are included for reference only.)

01 public override void FieldDeleting(SPListEventProperties properties)
02 {
03 base.FieldDeleting(properties);
04
05 if (properties.FieldName == “Status”)
06 {
07
08
09 }
10 }

You need to cancel the operation and redirect the user to a custom error page if the name of the deleted field is Status.

Which code segments should you add at lines 07 and 08?

PrepAway - Latest Free Exam Questions & Answers

A.
04 properties.ReceiverData = “/_layouts/customErrorPage.aspx”;
05 properties.Cancel = true;

B.
04 properties.RedirectUrl = “/_layouts/customErrorPage.aspx”;
05 properties.Cancel = true;

C.
04 properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
05 properties.ReceiverData = “/_layouts/customErrorPage.aspx”;

D.
04 properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
05 properties.RedirectUrl = “/_layouts/customErrorPage.aspx”;

Explanation:
MNEMONIC RULE: “CancelWithRedirectUrl, RedirectUrl”

Redirect to URL in SharePoint Foundation 2010
http://msdn.microsoft.com/en-us/library/ff408258.aspx

Event Receiver and Custom Error Page
http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/02/15/event-receiver-and-custom-error-page.aspx


Leave a Reply