views:

225

answers:

2

I am building an Internal social networking website on SharePoint. Since its a networking intranet, I want it to be Open and non moderated. However, I also dont want people to use abusive / Foul or bad language words in the portal.

I tried Googling and wasnt really sucessfull in finding a solution.

Microsoft Forefront will do that for me, but it only does for Documents. But I also want to do that on Lists since Discussion forum on the SharePoint is in a list format.

+1  A: 

You will probably need to override any controls that display text to avoid this issue. As this would be a lot of work, perhaps an HTTP Module would be a better solution.

I've worked on a module that used regular expressions to make SharePoint's output XHTML compliant. Similarly, you could use regular expressions to strip out offensive words when a page is rendered. It wouldn't stop people typing them but as no-one would be able to see them this wouldn't matter. You could use a basic SharePoint custom list to store the offensive words you don't want displayed.

Alex Angas
Am sorry Alex for reverting so late since I was on a month long vacation. I was also thinking of doing the same however I have a lot many List forms on the intranet. Is is possbile that we can do this on a Central level so that all future List forms automatically control this? If you can also tell which is the control that we should ideally use, that would be great! Thanks in Advance.
hemalshah
@hemalshah: HTTP Modules work at a much lower level. You would be working with the HTML output of the page once SharePoint has already generated it and handed it off to IIS to send down the wire to the user. Your module would intercept and change the HTML with an approach such as regular expressions so that bad words are removed.
Alex Angas
+1  A: 

You may create site solution/list definition for your site using Visual studio Sharepoint Site Solution Genarator. Create a custom list and name it as you wish. I would name it "AbusiveWordList" in the following code example.

After creating site solution/list definition, Add below code in Item Adding function, which will iterate through all column in the list and will check from the custom list that is created named "AbusiveWordList". This list contains abusive words.

The chkbody function which will reference list item from custom list named "AbusiveWordList" and check if the bodytext contains item from AbusiveWordList.If yes, then it will throw an error.

*base.ItemAdding(properties);

foreach (DictionaryEntry dictionaryEntry in properties.AfterProperties) { string bodytext = "";

bodytext = bodytext + dictionaryEntry.Value;

finalwordcount = finalwordcount + chkbody(bodytext, properties); }

if (finalwordcount > 0) { properties.ErrorMessage = "Abusive / Foul / Illicit information found.Kindly refer to the terms and conditions.";

properties.Cancel = true;

}

Troops

related questions