Thursday, January 21, 2010

Microsoft Power Pivot for Excel 2010- Quiz

Microsoft Introducing Power Pivot for Excel 2010

Microsoft Power for Excel 2010, formerly known as project “Gemini”, is a data analysis add-in that delivers unmatched computational power directly within Microsoft Excel 2010.

Visit: HERE

But icing on the cake is HERE

Microsoft Business intelligence is launching a Excelerators Quiz And defiantly with Prize also

Prize Eligibility
This contest is open to people at least 18 years old that reside in United States.

Contest Starts: January 22, 2010 @ 09:00 am (EST)

Contest Ends: January 29, 2010 @ 09:00 am (EST)

Most important thing in quiz is that

After giving the quiz, please comment your score after this post so that we can vote for you so that it helps you to win this prize.

Hay guys one more thing that we want to disclose that we got this information from one of the social media marketing group. So please check any terms and condition if it is there and we are not giving any promise regarding any product or gift or prize or sponsor of the quiz.

Sunday, January 17, 2010

Wednesday, January 13, 2010

Understanding People picker selection set

Hi All,

Many times we require setting properties on people editor control for selection set.

Some wants to allow only users to be selected and others want group also to be selected.

Well, here are options that you can use as property with people editor control.

User- Only peoples

SPGroup – Groups of SharePoint site

DL – Distribution list

SecGroup – Security groups

If you want to allow user to select for example user as well as SPGroup, you can use comma between selection set. Examples are shown below.

User,SPGroup

User,SecGroup,DL

Thursday, January 7, 2010

How to embed video in SharePoint

Hi All,

Sometimes we require adding video content to our SharePoint site. There is a very simple way to achieve this functionality.

All we need is Content editor web part to be placed on the page. Source of video file can be from same web application or it can be external source as well or video sitting on some shared drive of your network which everybody has an access.

Go ahead and add content editor web part.

Add following line of code.

<Embed
src="{URL of video / Shared Path pointing to video file}"
width=350
height=350
align=center
autostart=false
loop=false
quality=high
allowFullScreen=true>
</Embed>

See the output below.



And that’s it. You are good to play your video file.

Thursday, December 31, 2009

Creating a Export to Excel link in SharePoint

Hi All,

I came across to an interesting query. When we open a document library or a list AllItems.aspx we have an option to export the data into spreadsheet. However there is no direct link given. We do not have any URL for the Export to Excel option that comes under actions menu.

However, when you want to place a link for Export to excel in your web part or your webpage, then here is a way to go for it.

{siteurl}/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List={GUID of list}&View={GUID of view}&CacheControl=1

As you can see all you need to do is replace the respective place holders.

{siteurl} is your site url.

{GUID of list} is the GUID of the list for which you want to export the data to spreadsheet.

{GUID of view} is the GUID of the view for which you want to export the data to spreadsheet.

Where will you get these GUIDs? Well, you will find it when you click on List Settings.



And then click on the view name for which you want the data



You can use the same formula at places where there is no option to export to spreadsheet. For example, if you see on people and group permission page, you will not find this. You the same formula and you will be able to export it to the spreadsheet.

That’s it. Your job is done.

Wednesday, December 16, 2009

Limiting the number of responses in survey

Hi All,

In this article, I am going to share one very important aspect of survey. Many times we require limiting number of responses from survey. However SharePoint does not provide us with the facility to limit the number of responses.

Ok, then how to achieve this? Here we go, follow these simple steps and you are good to go.

(1) Write one web part and write one code which checks for the total responses for specific survey. Add this web part on NewForm.aspx and overview.aspx, all responses and graphical summary of the survey. You get NewForm.aspx when you click on respond to the survey button.

(2) Write down simple code, check URL, if NewForm word exist, then just count the total number of item in survey and if it exceeds let’s say 30 responses, and then redirect back to Source parameter.

(3) If in URL overview, allitems or summary exist, just count the total number of item in survey and if it exceeds let’s say 30 responses then write a statement saying you are not allowed to respond because it has already reached to the maximum responses.

Your job is done.

Friday, December 4, 2009

Add Choice column to list programmatically

Hi All,

Some days back person asked me as a question that you have a post for how to add data in the choice column programmatically however you do not have any article on how to add choice column itself to the list programmatically.

So of course, taking the suggestion positively here is a way you can add choice column programmatically to the list or document library.

Considering lstCustomList is your list object and you have set AllowUnsafeUpdate() to true for the web object. We are adding two choices in the choice column.

First we will add choice column itself to the list and then we will add the choices in that column and update the field. The main point to taken in to consideration is that it is SPFieldChoice not the SPField.

lstCustomList.Fields.Add("ABC", SPFieldType.Choice, false);
lstCustomList.Update();
SPFieldChoice objChoiceCol = (SPFieldChoice)lstCustomList.Fields["ABC"];
string[] strdata = new string[2];
strdata[0] = "Open";
strdata[1] = "Close";
objChoiceCol.Choices.Add(strdata[0]);
objChoiceCol.Choices.Add(strdata[1]);
objChoiceCol.Update();
lstCustomList.Update();


That is it. Your job is done.

Saturday, November 28, 2009

How SharePoint Works with Survey

Recently we are having requirement that how to access Survey List Programmatically in SharePoint.

First we think that there should be some object like SPSurvey just same as Document library list SPDocumentLibrary, but sadly that object is not there.

But rather than thinking long we can access Survey same as simple list as SPList only :)

Simple…

But what we found is somewhat new to everyone, at least for us.

SharePoint Survey is storing data in reverse manner as what we think.

Each question that we are entering for survey is created as column and all the answer stored as row value.

Let’s show you Example

Question of survey is : Do you like this?

Answer choice (in radio button or dropdown) are : Yes, No, Don’t know

So you will get SPList.Items.GetDatatable(); like below

So it’s a little confusing right.

But anyway that will help you whether you should take any task to work on Survey programmatically or not?

Tuesday, October 20, 2009

Coloring Events in SharePoint calendar

Hi All,

We all are familiar with coloring events in Outlook calendar. Question is can we have the same deal with SharePoint calendar and the answer is yes we can have. In this article, I am going to share few tips on how to achieve this functionality.

To achieve this, first create one field in Calendar list. For example, give it a name “Category”. Your each event is divided in some category. Give it as choice column and enter following categories for selection choice.



So, your each event is divided in these two categories. So now, go ahead and add two entries in calendar. One of Sports and other is of important meeting category.



Also create one more calculated column called “CatTitle”



And change the calendar view to this



And now we will add one content editor web part below calendar web part. So Edit the page and add one content editor web part and add the following line of code. This will color the different events.

<script>

var SEPARATOR = "|||";

var nodes, category;

nodes = document.getElementsByTagName("a");


for(var i = 0; i < nodes.length; i++)
{

if(nodes[i].innerText.indexOf(SEPARATOR) != -1)
{



UpdateCalendarEntryText(nodes[i]);


var foundNode = nodes[i];
var trap = 0;

while(foundNode.nodeName.toLowerCase() != "td")
{
foundNode = foundNode.parentNode;

trap++;
if(trap > 10)
{
break; // don't want to end up in a loop

}
}

var colour = GetCalendarColour(category);



if(colour != "")

foundNode.style.background = colour;
}
}

function UpdateCalendarEntryText(anchorNode)
{

var children = anchorNode.childNodes;
for(var i = 0; i < children.length; i++)
{

if(children[i].nodeType == 3 && children[i].nodeValue.indexOf(SEPARATOR) != -1)
{
var parts = children[i].nodeValue.split(SEPARATOR);

category = parts[0];
children[i].nodeValue = parts[1];
}

else
UpdateCalendarEntryText(children[i]);
}
}

function GetCalendarColour(desc)
{

var colour;

switch(desc.toLowerCase())
{

case "sports event":
colour = "#3399FF";
break;

case "important meeting":
colour = "#FF33FF";
break;


default:
colour = "";
}

return colour;

}

</script>




I would like to thank Mark Wilson for this wonderful trick.

That's it. your job is done.

Thursday, October 15, 2009

Hiding field in SharePoint through JavaScript

Hi All,

Many times we require to hide specific field in new form, disp form and edit form. This time we will do it with the help of javascript. We can do the same thing with the help of SharePoint API. However we will cover here that how to achieve the same with the help of JavaScript.

Let us go to calendar and click on new. You will now be on Newform.aspx. We can see here one field named “WorkSpace”. If we don’t want user to create any workspace here, then we can hide this field with the help of JavaScript code.



To hide a specific field, insert one content editor web part on the page and then just copy and paste the following code. Insert this web part below the new form web part.

<script type="text/javascript">
function HideField(title){
var header_h3=document.getElementsByTagName("h3") ;

for(var i = 0; i <header_h3.length; i++)
{
var el = header_h3[i];
var foundField ;
if(el.className=="ms-standardheader")
{
for(var j=0; j<el.childNodes.length; j++)
{
if(el.childNodes[j].innerHTML == title || el.childNodes[j].nodeValue == title)
{
var elRow = el.parentNode.parentNode ;
elRow.style.display = "none"; //and hide the row
foundField = true ;
break;
}
}
}
if(foundField)
break ;
}
}

HideField("Workspace");

</script>


After you’ve inserted this code, just look at the result shown below.



That’s it. Your job is done. You can apply the same code in disp and edit form as well.



Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com