March 27, 2012 Leave a comment

Recently I  came upon a requirement where the client  wanted the People Picker field to populate automatically with a user name depending on the some criteria and  not be able to change it.
I know I can disable the field but with the “Browse” icon a user can still change the People Picker value.
 So in order to hide the “Browse” field I went on a journey to figure out and finally found an easy way …
var divs1 = document.getElementsByTagName('a');    // Locate the "a" tag on the page
var z = 0;
for(var i =0; i < divs1.length; i++) //Loop through to find the browse icon
{
if(divs1[i].<a class="zem_slink" title="Internet Explorer" href="http://www.microsoft.com/windows/internet-explorer/" rel="homepage" target="_blank">innerHTML</a>.indexOf('addressbook.gif') > 0) // The name of the image is "addressbook.gif"
{
z++
if (z == 3)  // you have to manually count the total number of PeoplePicker on the page and target the one you want to disable
{
divs1[i].innerHTML = "</pre>
<img title="Browse" src="\&quot;/_layouts/images/addressbook.gif\&quot;" alt="Browse" />
<pre>"   // Append the innerHTML with display:none 
}
}
}

Calculate number of weekdays between two date fields

February 22, 2012 Leave a comment

Great post on calculating number of weekdays between two date fields

http://social.technet.microsoft.com/Forums/en-US/sharepointgeneral/thread/d71cb2b8-72f7-4b9f-a5c9-7c08a9ccf6c9/

Categories: SharePoint Tags:

Columns from SharePoint list are missing ( Created or Modified) in SharePoint 2010

January 31, 2012 Leave a comment

Both Created and Modified columns went missing in my site collection. I found the solution here :

http://sharepointtechie.blogspot.com/2010/04/created-and-modified-field-went-missing.html

Categories: SharePoint Tags:

Change the File Upload Size limit in SharePoint

December 8, 2011 Leave a comment

    1. Log in to SharePoint Server and navigate to Central Administration.
    2. On the Central Administration Page navigate to  Central Administration -> Application Management -> Manage Web Applications
    3. Highlight the web application
    4. Once there highlight the web application that you want to change and then click on General Settings
    5. On General Settings dialog, scroll to the bottom of the list and you will see the maximum upload size the default is 50MB
    6. Update that to the new size
    7. Click OK

Categories: SharePoint

Create a list in all the sites using Powershell

September 20, 2011 3 comments

Here is way to create a list based on a custom template using Powershell. The script will go through each site and create the list and add them to the Quick Launch


$GetSites = Get-SPWebApplication | Get-SPSite | Get-SPWeb -Limit ALL
foreach($getsite in $GetSites)
{
$listTemplate = $getsite.Site.GetCustomListTemplates($getsite)
$getsite.Lists.Add("MyList","My List",$listTemplate["MyTemplate"])
$list = $getsite.Lists["MyList"]
$list.OnQuickLaunch = $true
$list.Update()

}

Make sure that custom template is uploaded in the List Template Gallery. Check out this link  if you want to add a list template using powershell

Add List Template to all the site collections using Powershell

September 20, 2011 3 comments

Here is a way to upload a list template to all the site collections. Instead of going to all the site collections and upload the template manually .. use the script below to add them using Powershell

$GetSiteCollections = Get-SPWebApplication | Get-SPSite -Limit ALL
## Add the List Template to the all the Site Collections
foreach($GetSiteCollection in $GetSiteCollections)
{
$web = $GetSiteCollection.OpenWeb();
$spfolder = $web.getfolder("_catalogs\lt")
$spfileCollection = $spfolder.Files
$file = Get-Item c:\Temp\MyListTemplate.stp
spfileCollection.Add"MyListTemplate.stp", $file.OpenRead(),$true)
}

Thanks

Categories: SharePoint

Copy value from column to another using JQuery

August 19, 2011 Leave a comment

Copy the value from one column to another column on a New List Item Form.

In this example, I am populating the End Date Field with the Start Date Field value when user is filling out a meeting request form in SharePoint.

Add the following code on the page under “PlaceHolderMain” tag.

<script type="text/javascript" src="../../Shared Documents/Javascript/jquery/jquery.js">

$(document).ready(function(){
var strStartDate = $("input[title='Start Date']");
strStartDate.focusout(function()
 {
$("input[title='End Date']").val(strStartDate.val());
});
});
</script>

Follow

Get every new post delivered to your Inbox.

Join 67 other followers