Here is my scenario.
I would like to allow the only certain file types (doc,docx,pdf,ppt,pptx) into my document library. I wrote an ItemAdding event receiver for a document library as follows. But I am unable to prevent the uploading. Can someone guide me?
{
checking the file type here.
}
properties.Cancel = true;
//properties.Status = SPEventReceiverStatus.CancelWithError;
properties.ErrorMessage = "File extension not allowed here";
// properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
SPUtility.TransferToErrorPage("Invalid File Type");
What am I doing wrong here?