Tuesday, August 31, 2010

Monday, August 30, 2010

To get a ID(GUID) of a SharePoint List

•Delete everying before and including “List=”.
•Change “%7B” to “{”
•Change all “%2D” to “-“
•Chnage “%7D” to “}”

Friday, August 27, 2010

Print friendly SharePoint Content Page

lt;link rel="stylesheet" href="rajprint.css" type="text/css" media="print" /gt;

rajprint.css
/* print styles*/

A:link, A:visited {background: white; color: black; text-decoration:none;
font-weight:normal;}
/* to hide the print button*/
#noprintSpan{
display:none
}
/* to remove the blue border*/
.ms-bodyareaframe {
border:none 0px;

}
/* CORE.CSS override */
.ms-leftareacell,.ms-globallinks,.ms-siteaction,.ms-areaseparatorleft,
.ms-rightareacell,.ms-areaseparatorright, .ms-areaseparatorcorner,
.ms-titlearealeft,.ms-titlearearight,.ms-searchform,.ms-banner,
.ms-buttonheightwidth,.ms-buttonheightwidth2
{
display:block;
visibility:visible;
}

/* hide header * quick navigation*/
.ms-globalbreadcrumb { display:none; visibility: hidden; }
.ms-globalTitleArea { display:none; visibility: hidden; }
/* #nav-wrapper { display:none; visibility: hidden; } */
.ms-titlearealeft { display:none; visibility: hidden; }
.ms-navframe { display:none; visibility: hidden; }
.ms-nav { display:none; visibility: hidden; }
.ms-banner{ display:none; visibility: hidden; }
.ms-titlearea{ display:none; visibility: hidden; }



/* move content to the left */
.ms-bodyareacell, #above-main { margin: 0 0 0 0 }

/* fonts normalization
.ms-formbody { font-size: xx-small} */

/* remove the actions buttons */
.ms-toolbar { display:none; visibility: hidden; }
.ms-siteaction{ display:none; visibility: hidden; }

/* expanding edit form controls on the width of the screen */

#onetIDListForm { width: 100%; }
.ms-formlabel { width:20% }
.ms-formbody { width: 80%; }
.ms-long { width: 100%; }
.ms-rtelong { width: 100%; height: 400px; }
.ms-rtetoolbarmenu { width: 100%; text-align: left; }
TEXTAREA.ms-long { width: 100%; }
.ms-formbody SPAN SPAN DIV { width: 100%; }

Wednesday, August 25, 2010

Tuesday, August 10, 2010

SharePoint Development in Visual Studio

Visual Studio 2010 provides an alternative to creating SharePoint applications through SharePoint Designer. Visual Studio promotes rapid SharePoint development by providing such features as advanced debugging tools, IntelliSense, statement completion, and project templates. Visual Studio also takes advantage of advanced .NET Framework-based tools and languages. SharePoint projects can be developed by using either Visual Basic or Visual C#.

Read more

Friday, August 6, 2010

Reusable SharePoint JavaScript

Reusable SharePoint JavaScript
JSRequest
version: WSS 3.0 /source file: init.js (ln 1621)
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)
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
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
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
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)
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
lt; input id="spUserSelCb_1131" title="Raj" onclick="UserSelectionOnClick(this,'1');" type="checkbox" value="131" name="spUserSelectionCheckBox_1" gt;
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)
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)
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)
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)
purpose: takes any
URL-encoded string and returns a string.
example:
unescapeProperly("this%20is%20a%20test")
"this is a test"
createNewDocumentWithProgID(strTemplate, strSaveLocation, strProgID, bXMLForm)
version: WSS 3.0 source file: Core.js (ln 1123)
purpose: Generates a new document in a document library using the supplyed document template
example:
createNewDocumentWithProgID('http:\u002f\u002fwssdev\u002fDocument Library\u002fForms\u002ftemplate.dotx', 'http:\u002f\u002fwssdev\u002fDocument Library', 'SharePoint.OpenDocuments', false)
This will open Word with a new document using the template located at http:\\fwssdev\Document Library\Forms\template.dotx and word will save to the Document Library located at http:\\fwssdev\Document Library

Friday, July 23, 2010

SharePoint 2010 Web part Development

Introduction to SharePoint 2010 Web part Development: Build and Deploy

1. Open VS.NET 2010 and create new project select SharePoint 2010

2.Start by using the Empty SharePoint Project template. Create an empty project[FW 3.5 or 4]. On the next dialogue, pick farm solution or sandboxed solutions. Provide the URL of the location to deploy. Ex:http://servername/sites/sitecollectionname
This will give a SharePoint project example : RajWebPart
3.Right click on the project and add new item and select Web part template type and enter project name as WebPart2010.

4.Add a new label and text.

5.Compile and deploy. The brilliant IDE will take of creating .webpart files and adding safe controls entry to the web.config file.



You can note a Feature files is automatically created and this web part is added as a Feature item. Set the Feature scope as Site. A package file is also given out of the box.


 
 
 
 
6.Checking the web part gallery, you can see WebPart2010.webpart file just created also preview it. Let’s add it to a page and see how it looks.
To Debug set a breakpoint and choose debug from the build menu like we add to any other type of project.
Enjoy!