Friday 30 November 2012

Free Microsoft SharePoint 2010 Templates

Saturday 22 September 2012

SharePoint Custom List form with horizontal RadioButtons

In sharepoint list form we don't get options to show radiobuttons horizontally and they take to much space of form if there are too many of them.

We can make those radio buttons vertically using some javascript. I searched on google and I found below post.
http://www.mickyjay.co.uk/blog/?p=668

We need to open the form in designer and add below javascript in it.

<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("reconfigRadios");
function reconfigRadios()
{
var inputs = document.getElementsByTagName("INPUT");
var radios = new Array();
for (var i=0; i < inputs.length; i++)
{
    if (inputs[i].type == "radio")
    radios.push(inputs[i]);
}var html = new String();
var openTable = "<TABLE cellSpacing='0' cellPadding='0'
width='100%' border='0'><TR>";
var closeTable = "</TR></TABLE>";for (var i=0; i < radios.length-1; i++)
{if (i == 0)
html = openTable;
var obj = radios[i];
while (true)
{
    if (obj.tagName == "TD")
    break;
    else
    obj = obj.parentElement;
}
html = html + "<TD>" + obj.innerHTML + "</TD>";
if (radios[i].name != radios[i+1].name)
{
   html = html + closeTable;
   var obj2 = obj;
   while (true)
   {
      if (obj2.tagName == "SPAN")
      break;
      else
      obj2 = obj2.parentElement;
   }
   obj2.innerHTML = html;
   html = openTable;
}
if (i == radios.length-2)
{
   obj = radios[i+1];
   while (true)
   {
      if (obj.tagName == "TD")
      break;
      else
      obj = obj.parentElement;
   }
   html = html + "<TD>" + obj.innerHTML + "</TD>";
   html = html + closeTable;
   var obj2 = obj;
   while (true)
   {
      if (obj2.tagName == "SPAN")
      break;
      else
      obj2 = obj2.parentElement;
   }
   obj2.innerHTML = html;
}}}</script>




Friday 1 June 2012

Programmatically sending mail in SharePoint using SPUtility class

To send mails using SharePoint API, we can use SPUtility class sendMail method. For reference http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.sendemail.aspx
To use this method we will require:

using Microsoft.SharePoint.Utilities;
using System.Collections.Specialized;

You can assign to, cc, bcc, from, subject by creating stringdictionary, like
StringDictionary headers = new StringDictionary();
headers.add("to",strTo);
headers.add("cc",strCC);
headers.add("bcc",strbcc);
headers.add("from",strFrom);
headers.add("subject",strSubject);
headers.add("content-type","text/html");


string emailBody = “Hi<br><br>Sending mails using SPUtility.”;

SPUtility.SendEmail(web, headers, emailBody);

Where web is SPWeb object that represents site from which you want to send mail.

Friday 10 February 2012

Input mask on textbox in SharePoint list form

Yesterday on LinkedIn I saw one discussion where one of group member asked a query about how to create Input mask on text box in SharePoint List form.

While searching on internet I found this post. In this post Author opened the new form in SharePoint designer, added custom new form and then added jQuery code on page.

But what if I do not have SharePoint designer.

So instead opening page in SharePoint designer, I added CEWP on NewForm.aspx

And then I did some changes in original code, Instead of custom style I used Title of the field. And I inserted below code in Source editor of the CEWP.

<script language="javascript" src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript" ></script>
<script language="javascript" src="http://jquery-joshbush.googlecode.com/files/jquery.maskedinput-1.2.2.min.js" type="text/javascript" ></script>
<script language="javascript" type="text/javascript">

jQuery(function($){
   $("input[title='Phone']").mask("(999) 999-9999? Ext.99999");
});

</script>

And it worked for me. Have a look at below screenshot.








Reference:
http://www.a2zdotnet.com/View.aspx?Id=194 (Original post)
http://digitalbush.com/projects/masked-input-plugin/





Thursday 2 February 2012

Filter document library view by file type

Sometimes we get requirement such that document library should display files with certain file type.
For an example, I want to create view which will display only word documents.

Here is how we need to create our view
  1. Go to Document library settings.
  2. Create view
  3. Name the view: Word documents
  4. Go to Filter and Select "Show items only when following is true"
  5. Choose Name > Contains > .doc (See below screenshot)
  6. Or When Column > Name > Contains > docx (See below screenshot)











When we will select this view it will display word documents.






SharePoint Server 2010: boundaries and limits

This article describes software boundaries and limits of Microsoft SharePoint Server 2010

http://technet.microsoft.com/en-us/library/cc262787.aspx

Software boundaries and limits for SharePoint 2010 & 2013

http://sprider.org/2012/12/14/software-boundaries-and-limits-for-sharepoint-2010-2013/


Monday 23 January 2012

Add Hit Counter on a page using SharePoint Designer 2007

To add hit counter on page
  1. Open the page using SharePoint Designer.
  2. From the Insert menu, select Web Component .
  3. Select the counter style you want from the right screen and click finish.
To reset the hit counter
  1. Double-click the hit counter.
  2. Click to select the Reset counter to check box, and then type a number in the box.
  3. Click OK.

Thursday 12 January 2012

Lockdown feature functionality for MOSS

What is the lockdown feature? The simple answer is that it keeps anonymous users from being able to see things they shouldn't, like list views, etc.

For more technical information see:
http://blogs.msdn.com/b/ecm/archive/2007/05/12/anonymous-users-forms-pages-and-the-lockdown-feature.aspx

Tuesday 10 January 2012

SharePoint 2010 Virtual Labs

The Microsoft Developer Network (MSDN) and TechNet have a whole bunch of virtual labs you can use right from your browser.

For more information on SharePoint 2010 virtual labs visit MSDN SharePoint Server Virtual Labs and TechNet Virtual Labs for SharePoint Products and Technologies.


Monday 9 January 2012

To display Item ID in display and edit forms of SharePoint list items

In some cases, we may need to show ID field in display or edit form of a SharePoint list item.

There are some simple steps given on "Path to SharePoint" to achieve this http://blog.pathtosharepoint.com/2009/01/18/item-id-in-display-and-edit-forms/

Cheers!!!


Monday 2 January 2012

Get parameters from QueryString using JavaScript in SharePoint?

To get the querystring values, through JavaScript on a SharePoint site we can easily utilize the JSRequest object of MOSS.

It has 3 fields: QueryString, FileName, and PathName.

QueryString - is an array of key\value pairs representing the current query string parameters.
FileName - is a string containing the current name of the current page.
PathName - is the server relative path of the current page.

How to use it:

 <script language="javascript">

//First we have to call the EnsureSetup method
JSRequest.EnsureSetup();

//Get a query string parameter called ItemId. i.e. - "page.aspx?ItemId=5" will return 5
itemId = JSRequest.QueryString["ItemId"];

//Get the current page name. i.e. - "default.aspx"
itemId = JSRequest.FileName;

//Get the current path name. i.e. - "/abc/doclib/default.aspx"
itemId = JSRequest.PathName;

</script>

I hope this information will be helpful.



How to create count related lookup column in SharePoint custom lists?

A lookup count column is a special type of computed field that computes the number of items in the target list that point to the current item.

Let’s say I have two lists Departments and Employee Data. Now in Department list I want to add new column which will calculate how many employees are there in that department.

Here’s how we need to setup our lists:

1) Create a Department list. And add your department values in a title column.


2) Create an Employee Data list. In “Employee Data” list I renamed ‘Title’ column to ‘Employee Name’. And then add column ‘Department’ which will be lookup column pointing to the title column in the Department list.



3) After adding some test values in “Employee Data” list the list will look like this



4) Now go to “Department” list, add a column of type "Lookup" referring to the “Employee Data” list and you'll notice that in the drop-down area where you define the lookup, you'll have a new option called "Count Related". This is here automatically because it recognizes that the “Department” list has a lookup pointing back to this one. Select that Count Related option.



5) Now your Department list will have a column counting how many employees are associated with that Department.



This doesn’t require any coding or JavaScript. A hidden SharePoint magic.



Related Posts Plugin for WordPress, Blogger...