Is there any way I can add a custom function to WSS 3.0 that can be used in calculated fields?
For example, I want to add a function that URL Encodes strings, so that the users 开发者_JAVA技巧can create columns with the URLs based on the other fields something like this:
"http://www.test.com?fname="&URLENCODE([FirstName])&"&lname="&URLENCODE([LastName])
No, you can only use the pre-defined functions for calculated fields. (See a list of functions here)
There a some things you can do, depending on how much work you are willing to put on this.
First, you could a script to encode parts of your URL. Here is a thorough example. It is not very generic, but it will work very well for a column.
Second option is to fill the column yourself by catching the SPItemEventReceiver functions for the lists where the column you are creating is used. You would have to catch the ItemAdded event and then encode the URL in server-side code. See other events here.
So yeah, not as easy as it could be, but possible.
精彩评论