Showing newest posts with label Sharepoint Tips And Tricks. Show older posts
Showing newest posts with label Sharepoint Tips And Tricks. Show older posts

Tuesday, March 2, 2010

Version difference in Site Settings and Central administration

Hi All,

One day somebody asked me, what is the version number of your SharePoint? And I did not have answer because I was not too sure where to look for. However it came in my mind that we can see version number on site settings page. Hence I opened my site settings page and gave answer to a person who asked me last evening.

So what is the big deal here in version number? Nothing new, you just have the version number of your SharePoint on site settings page.



Wait a minute. Have you ever observed version number as part of Farm Information in central administration. See below image for it.



In my machine, version number under site settings and version number under farm information are same. However, if you see a different version number in any of them, then there could be some reason for this. May be following reason is responsible for this version difference.

1) You may have applied some service packs related to MOSS / WSS 3.0 and you forgot to run SharePoint technology and configuration wizard. You must complete that wizard after applying service pack and that too successfully.

So bottom line is whenever you apply any service pack or when ever SharePoint asks you to run the wizard, just run it successfully and you should have same version number under both above mentioned screen.
Read More…

Thursday, February 25, 2010

Taking list item back up with attachments

Hi All,

Sometimes we require taking back up of list items along with attachments. Definitely there is an option to export to excel, however that doesn’t copy attachment with it and hence it is a drawback only if you want attachment with list item as well, else export to excel is really a cool functionality.

Coming back to the point, so what do we do to get the attachment as well? Well, the answer to this question lies in the same menu and that option is Open with Access.

So go ahead with your list items that you want to back up. Open the Actions menu and click on open with Access.




Specify a new location for your database and also chose whether you want to be connected with SharePoint list so that any changes can be reflected here and also vice versa, or just you want to have a copy of it which is export the data.



That’s it. You have just taken a back up of your list items with attachments.
Read More…

Monday, February 22, 2010

System.IO.FileNotFound exception in SharePoint 2010

Hi All,

Just came to know about very basic stuff in SharePoint 2010. Let’s say you are creating one simple console application in VS 2010 that just displays your site name.

using System;
using Microsoft.SharePoint;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
using (SPSite objSiteColl = new SPSite("http://myurl"))
{
Console.WriteLine("Title of the site is : {0}", objSiteColl.RootWeb.Title);
}

Console.ReadLine();
}
}
}



And you run the code, you get System.IO.FileNotFound exception saying that web application is not found, verify that you have typed the correct URL. So what do we do now? We go back and check the URL,hum…URL is perfect, nothing wrong about this. So small program and still not able to run it?

Well, answer lies in VS 2010 because by default build property is set to x86 and SharePoint does not work on x86 platform. As we all know that now MS wants everyone to move on 64 bit PCs. (Another money eating machine), so go to project properties, go to build tab and change the platform target to x64 and try now.

There you go; I think your error might have gone now. What say?
Read More…

Friday, February 19, 2010

SharePoint Solution (.wsp) smartsolutionupgrade STSADM

Hi All,
Yesterday,I came across one nice feature from "Trentacular SharePoint 2007 Features" CodePlex, here is a link http://trentacularfeatures.codeplex.com/

Actually, I have created custom site definition and it has some custom site pages, I have created SharePoint Solution package (.wsp) file to deploy it.
Now I have created 10 sites from this site definition after few days I need to change in few SharePoint features and custom site pages. Now I wanted to upgrade this changes on already existing 10 sites.
When I upgrade command using stsadm -o upgreadesolutions it upgrade the solution but to get effect of that upgraded solution to existing 10 sites i need to deactivate features of site pages and activate it. that thing i wanted to automate. I do not want to loop through each site and deactivate feature and activate it.

I got above nice solution that does smart upgrade it make inventory of features installed on your .wsp file and which site it is activated. It will upgrade solutions
deactivate features and activate it again and your task is done :)

Really really nice features we should use it for smartupgradation

Let us know your comments on it.

It has following features

smartexecjobdefs stsadm command

An stsadm command that kicks of one-time scheduled jobs and monitors for their completion before returning control
smartsolutionupgrade stsadm command
An stsadm command that performs Solution upgrades in a smart manner
Usage
stsadm -o smartsolutionupgrade [ -filename ] [ -filenamelist ]
Actions performed

1. Accepts as input either a single Solution filename or a filename of a text file containing a list of Solutions to be upgraded
2. Extracts and parses the Solution manifest file from each existing Solution to be upgraded in order to determine the Features that will be affected by the upgrade
3. Inventories the deployment states of the existing Solutions
4. Inventories the activation states of the affected Features at all scopes within the SharePoint Farm
5. Deactivates all affected Features
6. Retracts each of the existing Solutions and deletes them from the Solution store
7. Adds the updated Solution to the Solution store
8. Deploys each of the upgraded Solutions according to their previous deployment state
9. Activates all affected Features according to their previous activation state


Regards,
SharePointKings Team
Read More…

CHM file issue in SharePoint

Hi All,

One week ago at home when I was reading some nice CHM file, I thought of putting it on my SharePoint site. I uploaded my chm file in one document library.

Wooh….when I opened it from document library I could not see the content on right frame. I again uploaded the same file; again it gave me the same result. When I open it on my machine and view it, it works really fine. However when I click on CHM file and open it, I can’t view any information on right frame. I wonder what the problem is.

Then I bing the information and I find out that it is the known issue to MS. Even you put CHM file o network share and try to open directly from network share location, then the same problem persists. You will not be able to see the content on right frame.

So bottom line is, whenever you click CHM file from document library, Save it on your local machine and then open it instead of opening the file directly. If you want it from network share, copy it from network share to your local machine and then view it.

Following are some blogs that has details regarding this.

http://www.ureader.com/message/1346380.aspx

http://social.msdn.microsoft.com/Forums/en-US/sharepointecm/thread/547d5ac8-5c32-4fb2-a3e3-86acb88e778b

http://support.microsoft.com/kb/902225

Hope this helps.
Read More…

Thursday, February 18, 2010

How to reply on discussion thread programmatically – Part 2

Hi All,

I am back with more details on discussion thread reply programmatically. In part 1, we simply went through how we can create discussion list and create simple reply.

This post will tell you more details regarding it.

Let us start with replying individual thread reply. First you need to loop through the subjects or best it to query discussion list with the help of SPQuery on subject field, so that you get the SPListItem object in your hand to play with.

using (SPSite objSite = new SPSite("{site URL}"))
{
SPWeb objWeb = objSite.OpenWeb("Web Name");

objWeb.AllowUnsafeUpdates = true;

SPList objList = objWeb.Lists["{discussion list name}"];

//remember objList.Folders will return you all discussion subjects. objList .ItemCount will return you all discussion along with their replies, objList .Items.count will return only replies. So now we will loop through all subjects,for demo I have also three discussion threads in my list. In real scenario, query the list and get SPListItem object.
foreach (SPListItem lstsubject in objList.Folders )
{

strSubject = lstsubject.Name;

if(strSubject.Contains(“test subject to reply”))
{
SPListItem parentitem = objList.GetItemById(lstsubject.ID); //Get //the SPListItem for that discussion subject thread.

//Create reply to that subject.

SPListItem reply = SPUtility.CreateNewDiscussionReply(parentitem);

reply["Body"] = "Yippi…This is my reply programmatically";
reply.Update();
}
}
objWeb.AllowUnsafeUpdates = false;
}


Hope this will help you a bit. In my part 3, I will explain bit more about how to go ahead and reply individual thread inside perticular subject.
Read More…

Monday, February 15, 2010

Create New document link in ListView Web part

Hi All,

We all know that in document library we have an option where in we can click on New menu item and click on document and we are presented with nice blank document to type in. Same way we can have our templates defined and can be made available in the new menu.

However ever wondered when you place list view web part of that document library on any page, you get an option of “Add new document” but when you click on that link, it takes you to a page where you can upload the document that you’ve created. See below screenshot.



Now this is not what we want according to Create New document means. We should be presented with blank document, which New menu does.

So we need to do some magic here and creates some more link under list view web part. We should ultimately give a link by which use is presented with blank document, not the upload page option.

So here is a trick to do this.

Go to modify this web part and in Toolbar Type select No toolbar. This will turn off the Add New document link.

However for now, select Full Toobar and go to source view of the page and search for “createNewDocumentWithProgID”. For me it was something like this. All you have to search for is from createNewDocumentWithProgID to false.

createNewDocumentWithProgID('https:\u002f\u002fxxxxxxxxxxxx\u002fteams\u002fpds1\u002fpss\u002fxxxxxxxx\u002fShared Documents\u002fForms\u002ftemplate.doc', 'https:\u002f\u002fintranet.eclipsnet.com\u002fteams\u002fpds1\u002fpss\u002fxxxxxxt\u002fShared Documents', 'SharePoint.OpenDocuments', false)

Now turn off the toolbar (Select No toolbar) and add content editor web part below the document library list view web part. Click on open toolpane, click on Crome Type as None. Click on Source editor and then add the following content.

<IMG alt="" src=" /_layouts/images/rect.gif">&nbsp;<A onclick="XYZ”;return false;" href="#">Create a New document</A>

Replace XYZ with the searched text for createNewDocumentWithProgID till false and there you go. Check for yourself. This is a great fun.
Read More…

Friday, February 12, 2010

Interesting clue about SharePoint Field Internal Name

Hi All,

Just came across to an interesting clued about SharePoint field internal name. We all know that SharePoint replaces space character in field with _x0020_ character and it is because XML element cannot have space in it I guess.

So simplest way to deal with this is to use two static methods.

1) System.XML.XmlConvert.EncodeName() to encode
2) System.XML.XmlConvert.DecodeName() to decode

Hope this will help somebody someday.
Read More…

Customize SharePoint error page

Hi All,

Ever wondered about SharePoint error page? Well, I do wonder, why? Because I see two different error pages depending upon operations that I perform.

Sometimes you may require customizing the error page to give some messages as well. To do so, all you need to go is to inetpub folder.

There are two error pages.
1) Error.aspx – This is under LAYOUTS folder.
2) ERROR.htm – This is under LAYOUTS\1033.

Why are there two different error pages? You can get an answer to this question if you have observed two methods of deletion in SharePoint.

1) Click on a list item, you’ll see DispForm.aspx and there you can see an option to delete the item in toolbar. –Takes you to the error.aspx in case of any error.

2) You can select the dropdown menu from item and delete the item from there. – Takes you to an ERROR.htm in case of any error.

This is what I wanted to express in this post and you need to modify these two error pages if you wish to change anything in error page because we never know how user deletes an item.

Hope you like this trip.
Read More…

Thursday, February 11, 2010

How to copy outlook calendar appointments to SharePoint calendar

Hi All,

We all know there is a way we can synchronize SharePoint calendar with outlook and then work from outlook or from SharePoint and changes get synchronized automatically.

However, if you already have outlook calendar and want to sync the calendar with SharePoint calendar, then follow this approach.

Following is the approach for outlook 2007.

1) Create one calendar in SharePoint site and connect it with outlook.
2) Open your source outlook calendar, click on that calendar.
3) Open view menu – >Current View-> All appointments.
4) Hit Ctrl+A button to select all appointments.
5) Simple drag all appointments to the respective destination calendar in outlook. (Destination calendar will be the one that we synchronized in step2)

Just make sure that person who is synchronizing the calendar should have appropriate permission to write in the calendar.

That’s it. Your job is done.
Read More…

How to copy large SharePoint List data

Hi All,

I came across to a situation where in if you have a data in list which exceeds 500 MB then you cannot save it as a template. This is the limitation of list template. So question here is how to copy that list along with the data. This post is the answer to this query.

First all you need to do is create one view with all columns of the list in it. Export the list in spreadsheet. Save the spread sheet. Now go ahead and Click on Create in site Settings menu under your site. Select Import Spreadsheet under custom list. Give the name of the list, Click on Browse and select that saved spread sheet.

It will pop up one dialogue asking you for entering range. Select appropriate range type and give range and then finally click on Import.

It will automatically creates a list and give column names as Column1, column2 etc. All we have to do is modify the column names and types of field to our choice.

That’s it. Your job is done.
Read More…

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
Read More…

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.
Read More…

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.
Read More…

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.
Read More…

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.
Read More…

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.
Read More…

Sunday, September 6, 2009

Creating and working with Survey in SharePoint - Part 5

Hi All,

In this article we will discuss about how to hide the save button. You may wonder why we should hide the save button. We will hide the save button to avoid one big issue of the survey.

If you have not gone through the survey articles, I would recommend you to read them all first before you read further.

Creating and working with Survey in SharePoint - Part 1

Creating and working with Survey in SharePoint - Part 2

Creating and working with Survey in SharePoint - Part 3

Creating and working with Survey in SharePoint - Part 4

When you have any question that has branching, SharePoint automatically places the next question on the second page and gives you an option to save your response so that later you can edit it. If you have the long survey that has many branching questions, then SharePoint does this splitting of page between the questions. Here we have one big problem. When responder saves the response, you will see that number of response increases. If you have five responders and all five of them have saved the respond, not completed the respond, then first thing you will notice is you can see total number of responses as five, but when you will actually go to the survey and find out then you won’t see even a single response. So where are all those responses?

Well, answer to this question is really simple. Even though you have full rights on survey or even you are a site administrator or site collection administrator, nobody can see those responses except a person who has saved the response. Only he can see his saved response. So bottom line is check columns named “Completed” in “All Responses” view, you will find only those responses whose status is yes. If a person has saved response, he will see status as “no” in “Completed” column.

Now why we are talking about hiding the save button is because there can be a reason where in you want responders to respond the survey in specific days. If they don’t then you want to send mail to them one more time to indicate that look, you need to fill this. Now to know this that how many people have not responded to survey yet, is don’t allow to save the response so that you can have exact number of responses.

Ok, so let us go ahead and add the content editor web part in every page of your questions, so that save button doesn’t appear on each and every page of survey. So now responder has no choice but to fill in the survey at one go.

In content editor web part, place the following code.

<script language="JavaScript">
var ClassName;
ClassName = 'ms-toolbar';

var elements = new Array();

var elements = document.getElementsByTagName('td');

for(var e=0;e<elements.length;e++)
{
if(elements[e].className == ClassName)
{

elements[e].innerHTML = elements[e].innerHTML.replace('value=Save','value=Save style=visibility:hidden ');



}

}

</script>


Your job is done. Now see the effect of above code.



That's it.
Read More…

Saturday, September 5, 2009

Creating and working with Survey in SharePoint - Part 4

Hi All,

Here I am going to discuss something interesting especially on overview.aspx of survey list. If you have not gone through the survey articles, I would recommend you to read them all first before you read further.

Creating and working with Survey in SharePoint - Part 1

Creating and working with Survey in SharePoint - Part 2

Creating and working with Survey in SharePoint - Part 3

and

Creating and working with Survey in SharePoint - Part 5


One question came in my mind. Why any responder of survey should care about knowing when survey was created and how many number of responses has come so far. If we have set the permission in advance settings of survey that user can only see their response, and then also responder can see how many responses have come so far.

If we do not want to allow any responder to see when survey was created and how many responses has come so far, then do one very easy thing. Just add one more content editor web part on the overview.aspx page of survey and copy and paste the below code and there you go, you have each and every option just like you have in normal survey web part on overview.aspx. The only difference is that here you cannot see number of responses and date created. Make sure that you hide the default web part on that page by modifying that web part and setting hidden to true under layout option. So simple…isn’t it.

Just make sure that you replace the {siteurl} for HREF in below code. Just place your site url there and you should be good to go.


<table class="ms-menutoolbar" cellpadding="2" cellspacing="0" border="0" id="ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl" width="100%" >
<tr> <td class="ms-toolbar" nowrap="true">
<div class="ms-buttoninactivehover" onmouseover="this.className='ms-buttonactivehover'" onmouseout="this.className='ms-buttoninactivehover'"><a id="ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RptControls_ctl00_diidIONewItem" accesskey="N" title="Respond to this Survey" onclick="javascript:NewItem('\u002fsites\u002fTest\u002fLists\u002fSharePoint\u002520site\u002520survey\u002fNewForm.aspx');return false;" href="javascript:__doPostBack('ctl00$m$g_c84f415c_dba8_4240_b34d_263e596c7eed$ctl00$ctl00$toolBarTbl$RptControls$ctl00$diidIONewItem','');"><img align='absmiddle' alt="Respond to this Survey" src="/_layouts/images/NewItem.gif" style='border-width:0px;'>&nbsp;Respond to this Survey</a></div>
</td>
<td class=ms-separator><img src='/_layouts/images/blank.gif' alt=''></td>
<td class="ms-toolbar" nowrap="true">


<span style="display:none"><menu type='ServerMenu' id="zz13_RptControls" largeIconMode="true"><ie:menuitem id="zz14_ExportToSpreadsheet" type="option" iconSrc="/_layouts/images/MenuSpreadsheet.gif" onMenuClick="javascript:EnsureSSImporter();javaScript:ExportList('\u002fsites\u002fTest\u002f_vti_bin\u002fowssvr.dll?CS=65001\u0026Using=_layouts\u002fquery.iqy\u0026List=\u00257BA1B0E302\u00252D497E\u00252D45B9\u00252D9994\u00252D9F0E0171A380\u00257D\u0026View=\u00257BC84F415C\u00252DDBA8\u00252D4240\u00252DB34D\u00252D263E596C7EED\u00257D\u0026RootFolder=\u00252Fsites\u00252FTest\u00252FLists\u00252FSharePoint\u002520site\u002520survey\u0026CacheControl=1')" text="Export to Spreadsheet" description="Analyze items with a spreadsheet application." menuGroupId="800"></ie:menuitem><ie:menuitem id="ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RptControls_ctl01_ctl00_ctl03" type="separator"></ie:menuitem><ie:menuitem id="zz15_ViewRSS" type="option" iconSrc="/_layouts/images/MenuRSS.gif" onMenuClick="window.location = '/sites/Test/_layouts/listfeed.aspx?List=%7BA1B0E302%2D497E%2D45B9%2D9994%2D9F0E0171A380%7D';" text="View RSS Feed" description="Syndicate items with an RSS reader." menuGroupId="800"></ie:menuitem><ie:menuitem id="zz16_SubscribeButton" type="option" iconSrc="/_layouts/images/MenuAlert.gif" onMenuClick="window.location = '/sites/Test/_layouts/SubNew.aspx?List=%7BA1B0E302%2D497E%2D45B9%2D9994%2D9F0E0171A380%7D&amp;Source=http%3A%2F%2Fsharepointkings%3A7777%2Fsites%2FTest%2FLists%2FSharePoint%2520site%2520survey%2Foverview%2Easpx';" text="Alert Me" description="Receive e-mail notifications when items change." menuGroupId="800"></ie:menuitem></menu></span><span title="Open Menu"><div id="zz17_ListActionsMenu_t" class="ms-menubuttoninactivehover" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoverActive="ms-menubuttonactivehover" hoverInactive="ms-menubuttoninactivehover" onclick=" MMU_Open(byid('zz13_RptControls'), MMU_GetMenuFromClientId('zz17_ListActionsMenu'),event,false, null, 0);" foa="MMU_GetMenuFromClientId('zz17_ListActionsMenu')" oncontextmenu="this.click(); return false;" nowrap="nowrap"><a id="zz17_ListActionsMenu" accesskey="C" href="#" onclick="javascript:return false;" style="cursor:hand;white-space:nowrap;" onfocus="MMU_EcbLinkOnFocusBlur(byid('zz13_RptControls'), this, true);" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz13_RptControls'), MMU_GetMenuFromClientId('zz17_ListActionsMenu'), event);" onclick=" MMU_Open(byid('zz13_RptControls'), MMU_GetMenuFromClientId('zz17_ListActionsMenu'),event,false, null, 0);" oncontextmenu="this.click(); return false;" menuTokenValues="MENUCLIENTID=zz17_ListActionsMenu,TEMPLATECLIENTID=zz13_RptControls" serverclientid="zz17_ListActionsMenu">Actions<img src="/_layouts/images/blank.gif" border="0" alt="Use SHIFT+ENTER to open the menu (new window)."/></a><img align="absbottom" src="/_layouts/images/menudark.gif" alt="" /></div></span>
</td>
<td class=ms-separator><img src='/_layouts/images/blank.gif' alt=''></td>
<td class="ms-toolbar" nowrap="true">


<span style="display:none"><menu type='ServerMenu' id="zz18_RptControls" largeIconMode="true"><ie:menuitem id="zz19_AddQuestions" type="option" onMenuClick="window.location = '/sites/Test/_layouts/qstNew.aspx?List=%7BA1B0E302%2D497E%2D45B9%2D9994%2D9F0E0171A380%7D&amp;Source=http%3A%2F%2Fsharepointkings%3A7777%2Fsites%2FTest%2FLists%2FSharePoint%2520site%2520survey%2Foverview%2Easpx';" text="Add Questions" description="Add an additional question to this survey." menuGroupId="100"></ie:menuitem><ie:menuitem id="zz20_ListSettings" type="option" iconSrc="/_layouts/images/MenuListSettings.gif" onMenuClick="window.location = '/sites/Test/_layouts/survedit.aspx?List=%7BA1B0E302%2D497E%2D45B9%2D9994%2D9F0E0171A380%7D';" text="Survey Settings" description="Manage questions and settings for this survey." menuGroupId="200"></ie:menuitem></menu></span><span title="Open Menu"><div id="zz21_ListSettingsMenu_t" class="ms-menubuttoninactivehover" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoverActive="ms-menubuttonactivehover" hoverInactive="ms-menubuttoninactivehover" onclick=" MMU_Open(byid('zz18_RptControls'), MMU_GetMenuFromClientId('zz21_ListSettingsMenu'),event,false, null, 0);" foa="MMU_GetMenuFromClientId('zz21_ListSettingsMenu')" oncontextmenu="this.click(); return false;" nowrap="nowrap"><a id="zz21_ListSettingsMenu" accesskey="I" href="#" onclick="javascript:return false;" style="cursor:hand;white-space:nowrap;" onfocus="MMU_EcbLinkOnFocusBlur(byid('zz18_RptControls'), this, true);" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz18_RptControls'), MMU_GetMenuFromClientId('zz21_ListSettingsMenu'), event);" onclick=" MMU_Open(byid('zz18_RptControls'), MMU_GetMenuFromClientId('zz21_ListSettingsMenu'),event,false, null, 0);" oncontextmenu="this.click(); return false;" menuTokenValues="MENUCLIENTID=zz21_ListSettingsMenu,TEMPLATECLIENTID=zz18_RptControls" serverclientid="zz21_ListSettingsMenu">Settings<img src="/_layouts/images/blank.gif" border="0" alt="Use SHIFT+ENTER to open the menu (new window)."/></a><img align="absbottom" src="/_layouts/images/menudark.gif" alt="" /></div></span>
</td>

<td width="99%" class="ms-toolbar" nowrap><IMG SRC="/_layouts/images/blank.gif" width=1 height=18 alt=""></td>


<td class="ms-toolbar" nowrap="true">

<table border=0 cellpadding=0 cellspacing=0 style='margin-right: 4px'>
<tr>
<td nowrap class="ms-toolbar" id="topPagingCellWPQ2">
<td>
</tr>
</table>

</td>
<td class=ms-separator> </td>
<td class="ms-toolbar" nowrap="true">

<table border=0 cellpadding=0 cellspacing=0 style='margin-right: 4px'>
<tr>
<td nowrap class="ms-listheaderlabel">View:&nbsp;</td>
<td id="ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RightRptControls_ctl01_ctl00_onetViewSelector" nowrap="nowrap" class="ms-viewselector" onmouseover="this.className='ms-viewselectorhover'" onmouseout="this.className='ms-viewselector'">
<span style="display:none"><menu type='ServerMenu' id="zz22_ViewSelectorMenu" CompactMode="true"><ie:menuitem id="zz23_DefaultView" type="option" onMenuClick="window.location = '/sites/Test/Lists/SharePoint site survey/overview.aspx';" text="Overview" menuGroupId="100"></ie:menuitem><ie:menuitem id="zz24_View1" type="option" onMenuClick="window.location = '/sites/Test/Lists/SharePoint site survey/AllItems.aspx';" text="All Responses" menuGroupId="300"></ie:menuitem><ie:menuitem id="zz25_View2" type="option" onMenuClick="window.location = '/sites/Test/Lists/SharePoint site survey/summary.aspx';" text="Graphical Summary" menuGroupId="300"></ie:menuitem></menu></span><span title="Open Menu"><div id="zz26_ViewSelectorMenu_t" class="ms-viewselector" onmouseover="MMU_PopMenuIfShowing(this);MMU_EcbTableMouseOverOut(this, true)" hoverActive="ms-viewselectorhover" hoverInactive="ms-viewselector" onclick=" MMU_Open(byid('zz22_ViewSelectorMenu'), MMU_GetMenuFromClientId('zz26_ViewSelectorMenu'),event,true, 'ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RightRptControls_ctl01_ctl00_onetViewSelector', 0);" foa="MMU_GetMenuFromClientId('zz26_ViewSelectorMenu')" oncontextmenu="this.click(); return false;" nowrap="nowrap"><a id="zz26_ViewSelectorMenu" accesskey="W" href="#" onclick="javascript:return false;" style="cursor:hand;white-space:nowrap;" onfocus="MMU_EcbLinkOnFocusBlur(byid('zz22_ViewSelectorMenu'), this, true);" onkeydown="MMU_EcbLinkOnKeyDown(byid('zz22_ViewSelectorMenu'), MMU_GetMenuFromClientId('zz26_ViewSelectorMenu'), event);" onclick=" MMU_Open(byid('zz22_ViewSelectorMenu'), MMU_GetMenuFromClientId('zz26_ViewSelectorMenu'),event,true, 'ctl00_m_g_c84f415c_dba8_4240_b34d_263e596c7eed_ctl00_ctl00_toolBarTbl_RightRptControls_ctl01_ctl00_onetViewSelector', 0);" oncontextmenu="this.click(); return false;" menuTokenValues="MENUCLIENTID=zz26_ViewSelectorMenu,TEMPLATECLIENTID=zz22_ViewSelectorMenu" serverclientid="zz26_ViewSelectorMenu">Overview<img src="/_layouts/images/blank.gif" border="0" alt="Use SHIFT+ENTER to open the menu (new window)."/></a><img align="absbottom" src="/_layouts/images/blank.gif" alt="" /></div></span>
</td>

</tr>
</table>

</td>

</tr>
</table>


<TABLE class="ms-summarystandardbody" cellpadding=0 cellspacing=0 width=600px style="margin: 10px;" border=0 rules=rows> <TR> <TD class="ms-formlabel" width=190px ID="overview01">Survey Name:</TD> <TD class="ms-formbody" >Movie knowledge survey</TD> </TR> <TR> <TD class="ms-formlabel" valign="top" ID="overview02">Survey Description:</TD> <TD class="ms-formbody">This is the startbold Hindi endbold as well as the startitalic English movie enditalic Knowledge survey. linebreak

we would like to know how much people are startunderline aware about the Hindi and English movies endunderline</TD> </TR> <TR> <TD><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></TD> </TR> </TABLE>
<TABLE border=0 style="margin: 0px 8px 0px 8px;">
<tr><td><img src="/_layouts/images/blank.gif" width=1 height=4 alt=""></td></tr>
<tr>
<td nowrap>
<img src="/_layouts/images/rect.gif" alt=""><span class=ms-toolbar>&nbsp;</span>
<a class="ms-toolbar" ACCESSKEY=R ID=diidSurveyResults HREF="{siteurl}/Lists/SharePoint site survey/summary.aspx"><!-- _locID_text="overview05" _locComment="{StringCategory=TXT}"-->Show a graphical summary of responses</a>
<span class=ms-toolbar>&nbsp;</span>
</td>
</tr>
<tr>
<td nowrap>
<img src="/_layouts/images/rect.gif" alt=""><span class=ms-toolbar>&nbsp;</span>
<a class="ms-toolbar" ACCESSKEY=U ID=diidResultsByUser HREF="{siteurl}Lists/SharePoint site survey/AllItems.aspx"><!-- _locID_text="overview06" _locComment="{StringCategory=TXT}"-->Show all responses</a>
<span class=ms-toolbar>&nbsp;</span>
</td>
</tr>
</TABLE>


And see the effect of the above code.




That's it.
Read More…

Creating and working with Survey in SharePoint - Part 3

Hi All,

We are going to discuss more on survey in this article. If you have not gone through the previous articles, I would suggest you to go through those articles first and then proceed for reading.

If you haven't gone through the previous articles of this series, i would highly recommend to read following articles before proceeding.

Creating and working with Survey in SharePoint - Part 1

Creating and working with Survey in SharePoint - Part 2

and

Creating and working with Survey in SharePoint - Part 4

Creating and working with Survey in SharePoint - Part 5

Now, that we have survey list already created and if you see the description of the survey on the overview.aspx, there is a difference in the survey description in the webpart and survey description below survey name. Check this out.



The difference is the line break. If you observe, survey description in the web part is written as it is without any line break however survey description under the name of survey breaks two separates sentences into two different lines because when we created the survey we gave it like that.

So in this article we will discuss two important things that will help you not only for the survey but also for any other list and any other document library as well.

Here we will remove the survey description below the name of the survey because we can already see the description in the web part and also we will include the HTML in the description now. It is very much similar to what we have learnt in previous articles just a class name change and that will do our job. Let us see in detail.

Ok, Edit the overview page and place the content editor web part below to the original web part.



Ok, first let us go and change the description of survey. Go to settings, survey settings, title and description and change the description to the following.

This is the startbold Hindi endbold as well as the startitalic English movie enditalic Knowledge survey. linebreak


we would like to know how much people are startunderline aware about the Hindi and English movies endunderline.

Ok, now go back to the overview view of the survey and observe the survey description.



As you can see those words start appearing in the description, so we need to get rid of it and replace them with the actual HTML behavior and that is what we did in previous articles. So go ahead and modify the content editor web part and place the following code in that. Note one important line in the below code and that line is where we assign “ms-formbody’ class. Earlier we assigned “ms-formlabel” in previous articles to add HTML in questions.

<script language="JavaScript">
var ClassName;
ClassName = 'ms-formbody';

var elements = new Array();

var elements = document.getElementsByTagName('td');

for(var e=0;e<elements.length;e++)
{
if(elements[e].className == ClassName)
{
elements[e].innerHTML = elements[e].innerHTML.replace('linebreak','<br/>');

elements[e].innerHTML = elements[e].innerHTML.replace('startunderline','<u>');

elements[e].innerHTML = elements[e].innerHTML.replace('endunderline','</u>');

elements[e].innerHTML = elements[e].innerHTML.replace('startitalic','<i>');

elements[e].innerHTML = elements[e].innerHTML.replace('enditalic','</i>');

elements[e].innerHTML = elements[e].innerHTML.replace('startbold','<b>');

elements[e].innerHTML = elements[e].innerHTML.replace('endbold','</b>');

}

}

</script>



And there you go, see the effect of it.



Ok, look good now. But there is a problem here, still look at the survey description above the web part. It still shows the words (startbold, endbold etc). They have not been replaced yet.

How to replace them? Ok, here is the answer. Just add one more content editor web part below the previous content editor web part and copy the same HTML content above, just make two changes. Change the class name and getElemtByID from TD to Div as this description is in the div tag, not in the TD tag.

ClassName = 'ms-listdescription'
var elements = document.getElementsByTagName('div');


and there you go, see the magic.



Actually for this specific survey type of list, we don’t need this to be here as on the same page, we can see the survey description in the web part. So let us go and remove the description of survey below the name of the survey from overview.aspx.

Modify the last content editor web part and paste the following code inside it.

<script language="JavaScript">
var ClassName;
ClassName = 'ms-listdescription';

var elements = new Array();

var elements = document.getElementsByTagName('div');

for(var e=0;e<elements.length;e++)
{
if(elements[e].className == ClassName)
{

elements[e].innerHTML = '';
}

}

</script>


And see the effect of above code. Survey description is gone.



Remember one very important point. You need to place this last content editor web part in every view page. We placed it only in overview.aspx. Just try and change the view to “All responses” and “Graphical summary”. Survey description will appear there, so just make sure that you place the last content editor web part on each view page separately as well.
Read More…



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