Monthly Archives: December 2010

You are browsing the site archives by month.

Customizing Ribbon in SharePoint

When entering text into the Rich HTML Editor with SharePoint 2010, you get a rich ‘ribbon’ experience, with a whole swag of stuff you can do – aptly titled “Format Text”.

image

This works for the Content Editor WebPart – and HTML content fields, such as Site Column – or Content Type column – like on a Publishing Page for example.

The editor includes a bunch of ‘tab groups’ (font, paragraph, etc) – with individual actions in each – like Bold, Italic, Underline, and so forth.

SharePoint 2010 Terminology

SharePoint Products and Technologies terms SharePoint Products and Technologies Object Model terms SharePoint Team Services terms
Windows IIS Web site SPVirtualServer Windows IIS virtual server
Site collection SPSite Site
Top-level site SPWeb Root Web site
Child site SPWeb Child Web site
Site (including top-level sites and child sites SPWeb Subweb site (including root Web sites and child Web sites
Child site collection SPWebCollection Subweb collection
Site group SPRole Role
Cross-site group SPGroup n/a
Cross-site group collection SPGroupCollection n/a

Web Part Expand and Collapse on plus minus click

<script type="text/javascript">
// Add the Web Part Titles here to have them opened by default
var wpsToSkip = ['Tasks','sandbox'];

function wpExpander() {
 var theTDs = document.getElementsByTagName("TD");
 for (var t=0;t<theTDs.length;t++) {
  var id = theTDs[t].id;
  if (id.match("WebPartTitleWPQ")) {
   id = id.substr(id.indexOf("WPQ"));
   var title = (theTDs[t].innerText || theTDs[t].textContent).replace(/[\n\r]/,'');
   var strImg = "<img style='margin:6px 5px 0px 2px;cursor:hand;float:left;' ";
   if (wpsToSkip.join().match(title)) {
    strImg += "onClick='showHide(\""+id+"\",this)' src='/_layouts/images/minus.gif'>";
   } else {
    strImg += "onClick='showHide(\""+id+"\",this)' src='/_layouts/images/plus.gif'>";
    document.getElementById("WebPart"+id).style.display = "none";
   }
   theTDs[t].innerHTML = strImg + theTDs[t].innerHTML;
  }
 }
}

function showHide(i,o) {
 var wp = document.getElementById("WebPart"+i);
 wp.style.display = (wp.style.display=="") ? "none" : "";
 o.src = (o.src.match(/plus.gif/)) ? "/_layouts/images/minus.gif" : "/_layouts/images/plus.gif";
}

_spBodyOnLoadFunctionNames.push("wpExpander()");
</script>

Web Part Expand and Collapse on title click

<script type=”text/javascript”>
var wpsToSkip = ['Tasks','sandbox'];
function wpExpander() {
var theTDs = document.getElementsByTagName(“TD”);
for (var t=0;t<theTDs.length;t++) {
var id = theTDs[t].id;
if (id.match(“WebPartTitleWPQ”)) {
id = id.substr(id.indexOf(“WPQ”));
var title = (theTDs[t].innerText || theTDs[t].textContent).replace(/[\n\r]/,”);
var strLnk = “<a href=’#’ “;
if (wpsToSkip.join().match(title)) {
strLnk += “onClick=’showHide(\”"+id+”\”,this)’>”;
} else {
strLnk += “onClick=’showHide(\”"+id+”\”,this)’>”;
document.getElementById(“WebPart”+id).style.display = “none”;
}
theTDs[t].innerHTML = strLnk + theTDs[t].innerHTML;
}
}
}
function showHide(i,o) {
var wp = document.getElementById(“WebPart”+i);
wp.style.display = (wp.style.display==”") ? “none” : “”;
}
_spBodyOnLoadFunctionNames.push(“wpExpander()”);
</script>

STSADM Quick Reference Sharepoint 2010

Adding solution.
view plainprint?
stsadm –o addsolution –name SolutionPackage.wsp
Same operation in powershell:
view plainprint?
Add-SPSolution c:\code\SolutionPackage.wsp
Only one difference, If you would like use relative path, you must add “./” before solution name.

Deploying solution.
view plainprint?
stsadm –o deploysolution –name SolutionPackage.wsp –url http://servername –allowgacdeployment –immediate
stsadm -o execadmsvcjobs
We must also follow this operation with a call to stsadm with the execadmsvcjobs operation.
view plainprint?
Install-SPSolution SolutionPackage.wsp –WebApplication http://servername –GACDeployment
Executing this command does the deployment operation. You don’t have to fire off something to execute a job later like you did with STSADM. You can deploy solution to specified web application (as shown above) or to all web applications using –AllWebApplications parameter.