Wednesday, 15 January 2014

Word wrapping SharePoint 2010 list column headers using CSS


 Add  a Content Editor Web Part (CEWP)

    1.Go to your list. Select Site Actions < Edit Page
    2.Click “Add a web part”
    3.Select Content editor webpart and click add new content.
    4.select html--< Edit Html source and add following css:

<style type="text/css"<
.ms-vh, .ms-vh2-nograd, .ms-vh2, .ms-vb
{
white-space: normal;
text-align:center;
vertical-align:text-bottom;
}
</style<

Tuesday, 14 January 2014

Dynamic Add Image inside Radio Buttons Using JQuery

<!DOCTYPE html<
<html<
<head<
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"<
</script<
<script<
$(document).ready(function(){


$("#button").click(function(){
var curAns="Radio 1";
var curVal=$('.optionAnswer:checked').val();

if(curAns == curVal)
{
$('.optionAnswer:checked').parent().append('<img width=25 height=25 src="" alt="correct"/<');
}
else
{
$('.optionAnswer:checked').parent().append('<img width=25 height=25 src="" alt="worng"/<');
$('.optionAnswer').each(function(index){
if($(this).val()== curAns)
$(this).parent().append('<img width=25 height=25 src="" alt="correct"/<');
});

}
});
});
</script<
</head<
<body<
  <div id="optionAns")<
   <span< <input type="radio" name="optionGroup" value="Radio 1" class="optionAnswer"<Radio 1</input<</span<</br<
   <span< <input type="radio" name="optionGroup" value="Radio 2" class="optionAnswer"<Radio 2</input<</span<</br<
   <span< <input type="radio" name="optionGroup" value="Radio 3" class="optionAnswer"<Radio 3</input<</span<</br<
</div<
<input type="button" id="button" name="button" value="submit" /<
 
</body<

</html<

Thursday, 9 January 2014

Get current user name detail in sharepoint 2010 with spservices

Field Name Field Internal Name WSS MOSS
Account Name
Name Title
Work e-mail EMail
About me Notes
Picture Picture
Department Department
Job Title JobTitle
SIP Address SipAddress
First name FirstName  
Last Name LastName  
Work phone WorkPhone  
Office Office  
User name UserName  
Web site WebSite  
Responsibilities SPResponsibility  

Wednesday, 1 January 2014

Below list shows ListTemplateId for all SharePoint list and libraries.

ListTemplateId
Description
100
Generic list
101
Document library
102
Survey
103
Links List
104
Announcement list
105
Contact List
106
Event List
107
Task List
108
Discussion Board
109
Picture Library
110
Data Source
111
Site Template Gallery
112
User Information List
113
Web Part Gallery
114
List Template Gallery
115
Xml Form Library
116
Master page Gallery
117
No-Code Workflows
118
Custom Workflow Process
119
Wiki Page Library
120
Custom Grid for list
130
Data Connection Library
140
Workflow History
150
Gantt Tasks list
200
Meeting Series list
201
Meeting Agenda list
202
Meeting Attendees list
204
Meeting Decisions list
207
Meeting Objectives list
210
Meeting text box
211
Meeting Things To Bring list
212
Meeting Workspace Pages list
300
Portal Sites list
301
Blog Posts list
302
Blog Comments list
303
Blog Categories list
1100
Issue tracking
1200
Administrator tasks list
2002
Personal document library
2003
Private document library

Thursday, 19 December 2013

Backup and Restore SharePoint 2010 Site Collection with PowerShell 

A PowerShell command prompt will appear and you need to format the following to fit the backup for your site.

Backup-SPSite -Identity SiteCollectionURLHere -Path BackupFilePathHere [-Force] [-NoSiteLock] [-UseSqlSnapshot] [-Verbose]
  • Force – Include this if you want to override a backup with the same name
  • NoSiteLock – Will prevent the site from going to Read Only mode while the backup is being taken.  A small warning, if someone changes content on the site while the backup is being created and according to Microsoft “might lead to possible data corruption”
  • UseSQLSnapshot – A database snapshot will be taken before the backup begins and the backup will be done off the snapshot. The advantage is that changes can be made to the site while the backup process is running without fear of corruption.  The snapshot will be deleted automatically when the backup is completed.  You don’t need to specify the -NoSiteLock parameter when using this method
For Example:
Backup-SPSite -Identity http://servername/sites/BISite -Path D:\SharePointBackups\BISite\07-13-2011.bak

Restore-SPSite -Identity SiteCollectionURLHere -Path BackupFilePathHere [-DatabaseServer DatabaseServerNameHere] [-DatabaseName ContentDatabaseNameHere] [-HostHeader HostHeaderHere] [-Force] [-GradualDelete] [-Verbose]

  • DatabaseServer – Specify the server for the content database
  • DatabaseName – Specify the name of the content database
  • HostHeader – URL of the Web application that will hold the host-named site collection
  • Force – Overwrite the site collection if it exists
  • GradualDelete – Recommended for site collections over 1 Gig in size, existing data is marked as deleted and gradually removed over time by a job rather than all at once to reduce the performance hit of deleting large amounts of data

Thursday, 3 October 2013

SPServices GetUserProfileByName Jquery With Parameters AccountName

SPServices GetUserProfileByName JQuery

Requirement:- Hide the user according to there permission level means if the user have permission in particular group A then one field "SPS-DistinguishedName" have entry like "OU=ServiceAccounts".
                          I tried to call the function getUserProfileByName with a specified username/AccountName using jquery with SPServices for hide the user form details.
<script src="/teams/tsc/rintu/CSS/jquery.min.js"></script>
<script src="/teams/tsc/rintu/InfoPath/Shared%20Documents/jquery.SPServices-0.7.2.js"></script>

<script type="text/javaScript">
$(document).ready(function()
{
$('.ms-spbTree').each(function(){

$(this).find('li').each(function(){
var obj=$(this).attr('id');
var details=getTheUserInfo(obj);
if(details.indexOf("OU=ServiceAccounts")>-1)
{
$(this).hide();
}

});
});
});

function getTheUserInfo(acct){
var ph;
$().SPServices({
operation: 'GetUserProfileByName',
async: false,
accountName: acct,
completefunc: function(xData, Status) {
ph=$(xData.responseXML).find("PropertyData").find("Name[text=SPS-DistinguishedName]").parent().find("Values").text();
}
});
return ph;
}
</script>

Friday, 13 September 2013

Change login name in SharePoint

Change default welcome control in SharePoint master page

Default welcome login control ( domain\your name)  change to "Welcome, first name last name" in SharePoint master page.

Add the below code in the master page:-