Tuesday, 13 September 2011

SharePoint: How to change the default home page

Found below good post on Mike Smith's blog on how to change default home page of SharePoint site


Wednesday, 7 September 2011

Retrieving Rich Text Box value using JavaScript in SharePoint

Few days back I was working on one requirement to customize SharePoint list form(newform.aspx) using SharePoint designer 2007.

And I was unable to retrieve value from Rich Text box field "Analysis" in JavaScript.

I solved my issue using below JavaScript

<script type="text/javascript">

 var varAnalysis = getTagFromIdentifierAndTitle("textarea","TextField","Analysis*");
 var varAnalysisTextBoxID = RTE_GetEditorDocument(varAnalysis.id);
 var varAnalysisText = varAnalysisTextBoxID.body.innerText;

function getTagFromIdentifierAndTitle(tagName, identifier, title)
 var len = identifier.length;
 var tags = document.getElementsByTagName(tagName);
 for (var i=0; i < tags.length; i++)
  var tempString = tags[i].id;
  if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len))
   return tags[i];
 return null;

This code solved my problem.

How to get GUID of a SharePoint List or Document Library.

In Sharepoint , the easiest way to get GUID of List is:
  1. Go to Sharepoint List or Library Setting
  2. Click on Audience targeting settings 
  3. Copy the url from the browser
  4. You will get url something like this http://Sitename/subsites/_layouts/ListEnableTargeting.aspx?List={7a6d10fa-267c-468c-8d1e-1030323a5846}
  5. From the url we only need text which is after ?List=
  6. That text is GUID for the respective list

How to get Public Key Token using Visual Studio

Most of the times we need public key token of DLL to use it in web.config. We can get the public key token using Visual Studio.

To get that, we need to follow below steps:
1) In Visual Studio, Go to Tools and then click on External Tools

2) New window will open, then click on Add and enter the details as below:
  1. Title: Get Public Key Token
  2. Command: It depends on where you installed SDK. In my case it is C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe
  3. Arguments: -Tp "$(TargetPath)"
  4. Also check the checkbox "Use Output Window" and uncheck other checkboxes
3) Click on OK button. Now the "Get Public Key Token" will be available in Tools:


4) So now we are ready to use this. After giving strong name to your assembly, you can click on "Get Public Key Token". You will get Public Key Token in output window.

Related Posts Plugin for WordPress, Blogger...