2009/03/20

How to Uninstall Microsoft SQL Server 2005 Embedded Edition (SSEE Instance)


you need to uninstall Microsoft SQL Server 2005 Embedded Edition (SSEE Instance) while uninstalling windows sharepoint services.

Simply execute the following command in a windows console :
(on 32-bit platforms)
msiexec /x {CEB5780F-1A70-44A9-850F-DE6C4F6AA8FB} callerid=ocsetup.exe

(on 64-bit platforms)
msiexec /x {BDD79957-5801-4A2D-B09E-852E7FA64D01} callerid=ocsetup.exe

2009/03/10

Add previlages to user to do some actions in WSS 3.0 / MOSS 2007


We can use this method for dealing with users that has low previlages over specific List.

SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPListItem NewUser = NewUsersList.Items.Add();
NewUser["Username"] = _userNameTextBox.Text.Trim();
NewUser["Password"] = _passwordTextBox.Text.Trim();
NewUser["First Name"] = _firstNameTextBox.Text.Trim();
NewUser["Last Name"] = _lastNameTextBox.Text.Trim();
NewUser["Phone"] = _phoneTextBox.Text.Trim();
Site.AllowUnsafeUpdates = true;
NewUser.Update();
}
);

WSS 3.0 Allow Unsafe Updates


you can use the following property in custom WebPart:

Web.AllowUnsafeUpdates = true;

{ Your Code here }

Web.AllowUnsafeUpdates = false;

this property can be used with anonymous or user with low permissions.

2009/03/03

Map of Reusable SharePoint JavaScript

JSRequest



version: WSS 3.0
source file: init.js (ln 1621)
mapped by: Itay Shakury
purpose: provides method to parse query string, filename, and pathname from URL
example:



JSRequest.EnsureSetup();
var qs = JSRequest.QueryString[value];
var fn = JSRequest.FileName;
var pt = JSRequest.PathName;


PreSaveAction()



version: WSS 3.0
source file: n/a (ref: form.js ln 5909)
mapped by: Edin Kapic
purpose: provides hook for creating custom function interrupting submit action
example:



function PreSaveAction(){
var input = getTagFromIdentifierAndTitle("textarea","","Test");
if(input && input.value == "") {
alert("You must complete Test");
return false; // Cancel the item save process
}
return true; // OK to proceed with the save item
}


_spBodyOnLoadFunctionNames



version: WSS 3.0
source file: n/a
mapped by: Sanjay Arora
purpose: Allows you to register additional JavaScript methods that should run in the PageLoad event
example:


_spBodyOnLoadFunctionNames.Push('MyCustomFunctionName');


GetFirstChildElement(e)



version: WSS 3.0
source file: core.js
mapped by: Christophe
purpose: get the first "real" child of a DOM element. This function is useful for Firefox, which interprets a line break as a child element.


GetLastChildElement(e)



version: WSS 3.0
source file: core.js
mapped by: Christophe
purpose: get the last "real" child of a DOM element. This function is useful for Firefox, which interprets a line break as a child element.


GetCBSelectedValues(frm)



version: WSS 3.0
source file: core.js (ln 972)
mapped by: Paul Grenier
purpose: Accepts a form object, loops through all check box elements and returns the values of the checked boxes or false if none are checked.
example:
html


<input id="spUserSelCb_1131" type="checkbox" title="Paul Grenier" onclick="UserSelectionOnClick(this,'1');" value="131" name="spUserSelectionCheckBox_1"/>


JavaScript



var elm = document.getElementsByTagName("form")[0];
GetCBSelectedValues(elm)

Object returned: strList = "131,144,143,7,254,22..."


GetSelectedValue (frmElem)



version: WSS 3.0
source file: init.js (ln 1516)
mapped by: Paul Grenier
purpose: takes a form element with a selectedIndex and returns the selected value or an empty string.


GetSelectedText(frmElem)



version: WSS 3.0
source file: init.js (ln 1523)
mapped by: Paul Grenier
purpose: takes a form element with a selectedIndex and returns the selected text or an empty string.


escapeProperly(str)



version: WSS 3.0
source file: init.js (ln 168)
mapped by: Paul Grenier
purpose: takes any string and returns a URL-encoded string.
example:
escapeProperly("this is a test")


"this%20is%20a%20test"


unescapeProperly(str)



version: WSS 3.0
source file: init.js (ln 855)
mapped by: Paul Grenier
purpose: takes any URL-encoded string and returns a string.
example:
unescapeProperly("this%20is%20a%20test")


"this is a test"



refrance : http://sharepointdevwiki.com/display/public/SharePoint+JavaScript+Functions+Overview

2009/03/02

Hide fields in NewForm.aspx without customization


You can use the following techniqe to hide flags that you add in custom list or document library without customization you can add the following code after the ContentPlaceHolder tage


<asp:Content ContentPlaceHolderId=”PlaceHolderMain” runat=”server”>


The script as the following:


<script language="javascript" type="text/javascript">

// set the function that will load in the page call.


_spBodyOnLoadFunctionNames.push("hideFields");


//the function that will search for control


function findacontrol(FieldName) {

var arr = document.getElementsByTagName("!");
// get all comments
for (var i=0;i < arr.length; i++ )
{
// now match the field name
if (arr[i].innerHTML.indexOf(FieldName) > 0)
{ return arr[i]; }
}
}



// this function wil hide the controls by field Name



function hideFields()
{
var control = findacontrol("Hired");
control.parentNode.parentNode.style.display="none";
control = findacontrol("inServe");
control.parentNode.parentNode.style.display="none";
control = findacontrol("Title");
control.parentNode.parentNode.style.display="none";
}


</script>


you can change the Green text with your controls name that you need to hide