If you do there is a better way as described by Per Jakobsen here.
Using the AdditionalPageHead delegate control to inject javascript to the page through a feature not only gives you a supportable system but allows you to switch the default to checked or not checked by activating or deactivating the feature.
I tried a variation of this on a SharePoint 2007 installation and it worked fine, after an upgrade to 2010 it stopped working however. Having spent five minutes trying to debug the issue I decided it would be swifter to just change it to use jQuery's $(document).ready function rather than solve the specific problem. There seems to be others having weird things going on with _spBodyOnLoadFunctionNames.push in 2010, so this is probably a quicker fix (at least if you've already got jQuery available on the page). If you don't you could add a reference to it in the DefaultUploadOverwriteOff.ascx user control.
The change to Jakobsen's javascript is simple, just replace the function DefaultUploadOverwriteOff() with this:
$(document).ready(function() { if (document.title == "Upload Document") { $("input[id$='OverwriteSingle']").attr("checked",false); $("input[id$='OverwriteMultiple']").attr("checked",false); } });
and remove the last line: _spBodyOnLoadFunctionNames.push('DefaultUploadOverwriteOff');
This now works fine on both 2007 and 2010.
Hi Vegard,
ReplyDeleteThanks for your solution.
What if I just want to disable versioning for a single doc. library only (the uploaded file is a Record not to be changed with a new version)? But I need versioning in the same doc. library for all the Meta Data changes!
OOTB SharePoint 2010 is not really helpful to make above happen.
Thanks.
Peter
Hi Peter
DeleteDon't think you can have separate versions for metadata and document in 2010. You might get closer with 2013 as it stores deltas of file changes rather than a new copy when a change occurs.
Regards
Vegard
Any chance you could compile the 2010 WSP file? I don't have the appropriate tools to do so myself.
ReplyDeleteIn case you still need this as a compiled WSP file, I've got it (with some modifications). Send me your email address if you want it and I'll send it to you.
DeleteHi Deanna,
DeleteI viewed your blog but didn't see a PM, I would really appreciate the wsp file if you're willing to share.