Friday, September 27, 2013

How to Hide the Edit Tab in a Ribbon

In SharePoint 2010, add the following code to a CEWP.



<script type="text/javascript">// <![CDATA[
function ResetRibbon() {
try {
var ribbon = SP.Ribbon.PageManager.get_instance().get_ribbon();
SelectRibbonTab("Ribbon.Read", true);
ribbon.removeChild('Ribbon.ListForm.Display');
ribbon.removeChild('Ribbon.ListForm.Edit');
} catch (e)
{ }
}
SP.SOD.executeOrDelayUntilScriptLoaded(function () {
try
{
var pm = SP.Ribbon.PageManager.get_instance();
pm.add_ribbonInited(function () {
ResetRibbon();
});
var ribbon = null;
try {
ribbon = pm.get_ribbon();
}
catch (e) { }
if (!ribbon) {
if (typeof (_ribbonStartInit) == "function")
_ribbonStartInit(_ribbon.initialTabId, false, null);
}
else {
ResetRibbon();
}
},
"sp.ribbon.js");
}catch(e)
{}
// ]]></script>
<script type="text/javascript">
function ResetRibbon() {
try {
var ribbon = SP.Ribbon.PageManager.get_instance().get_ribbon();
SelectRibbonTab("Ribbon.Read", true);
ribbon.removeChild("Ribbon.ListForm.Display");
ribbon.removeChild("Ribbon.ListForm.Edit");
} catch (e)
{ }
}
SP.SOD.executeOrDelayUntilScriptLoaded(function () {
try {
var pm = SP.Ribbon.PageManager.get_instance();
pm.add_ribbonInited(function () {
ResetRibbon();
});
var ribbon = null;
try {
ribbon = pm.get_ribbon();
}
catch (e) { }
if (!ribbon) {
if (typeof (_ribbonStartInit) == "function")
_ribbonStartInit(_ribbon.initialTabId, false, null);
}
else {
ResetRibbon();
}
} catch (e)
{ }
}, "sp.ribbon.js");
</script>

and the tab will disappear :) 

Source: http://sharepoint247.wordpress.com/2013/05/24/javascript-to-hide-or-select-specific-tabs-in-sharepoint-ribbon/




Remove Content Approval Message from Forms.


Whenever a SharePoint list requires content approval for submitted items, you will find the following message on  your new item forms:

"'Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights.'"

I find this message very confusing to my users so I often remove it. 

To remove the message,

  1. Go to 'List settings' and then 'Advanced settings'
  2. Scroll down to 'Dialogs' 
  3. Select 'No' under 'Launch forms in a dialog?' then select 'OK'
  4. Go back to your list and select 'Add new item'. Your new item form will open as a page.
  5. Go to 'Site Actions ' and select 'Edit Page'
  6. Add a CEWP (Content Editor Web Part)
  7. Edit the web part's html source code 
  8. Enter the following CSS: 

<style>
.ms-informationbar{visibility:hidden;}</style>

    10. Click save 

The message will be removed from the form. 

If you want your forms to open as dialogues again, simply follow steps 1-3. However, in step 3 select 'Yes' instead.






Friday, August 30, 2013

Show only the time in your sharepoint column

I hate that SharePoint does not provide a time only column. So, what should one do if they have a form in which their users need to record the time only?

In my example, I had to use a time/date column, called "Departure time" in which users needed to provide the time in which they departed  a location. However, I did not need a date.

Problem:
In InfoPath, I could delete the date portion of the form and leave only the time field. However, when I went to  the list view I would still see a date with their recorded time proceeding.


To get around this I used the steps below:
  1. Created a calculated column called 'Recorded Departure Time'
  2. Inserted the following formula: =Text (Departure Time,"HH:MM:SS")
  3. Edited my view to only show only my 'Recorded Departure Time' and hide my original 'Departure time'
Please Note: This method will show in military time. However, if you don't mind military time; this is a great solution.

Source: http://social.technet.microsoft.com/Forums/sharepoint/en-US/c8035f07-8320-48b5-98d7-f48dde2eaf2f/sharepoint-2010-insert-only-time-in-list-column

Change Link - "Add new item"

At the bottom of your sharepoint list, there is usually a link that say's "Add new item". This link bascially allows users to create new items in a list. However, what if you wanted it to say something different? In my case, I had a contact list and wanted it to say "Add new contact".

Using the steps below, I was able to sucessfully do so.

  1. Add a Content Editor webpart to the view you would like the link changed on. Please note: if you have more then one view for this list, you will need to repat these steps for each view.
  2. Add the javascript below, replacing "your message here" with the message prefer:

<script> document.getElementById("idHomePageNewItem").innerHTML="Your message here"</script>


  
  Source: http://dishasharepointworld.blogspot.com/2011/08/sharepoint-2010-change-add-new-item-and.html

Tuesday, July 2, 2013

Create Calculated Columns Using [Me] or [Today]

As many may know, when creating custom list fields,  SharePoint does not allow you to use  [Me] or [Today] in a calculated field type. 

Here's a workaround, using [Me] as the example. However, you can also use these same steps for [Today] also. 

  1. In your list, create a "single line of text" field titled Me
  2. Now create a "calculated" field titled CalcMe with the following formula =[Me]
  3. Now go back and delete the first text field you created titled Me
By doing this you trick SharePoint into using the Me field. Hope this helps :) 


Tuesday, June 11, 2013

Adding Javascript to a Quick Launch or Top Link Bar

If you ever tried adding javascript to the Quick Launch or Top Link Bar you'll find it's impossible to do so using the setting page under navigation.

Here's another alternative:

1. Enter one of the following URL's into the address bar (this depends on which of the two you want to edit).  

Quick Launch: http://<site address>/_layouts/quiklnch.aspx  
Top Link Bar: http://<site address>/_layouts/topnav.aspx

2. Enter your javascript within the web address bar and the link title within the description. 



Removing the time from your SharePoint Calendar

Recently, I created a calendar but did not want the out-of-the-box time stamp (12:00) to show by each of my calendar's entries.

Here's what I found to remove this:
  1. Add a content editor webpart to your page 
  2. Enter the following code:
     <style>
.ms-acal-item {
BORDER-BOTTOM: 0px; BORDER-LEFT: 0px; BACKGROUND: none transparent scroll repeat 0% 0%; BORDER-TOP: 0px; BORDER-RIGHT: 0px
}
.ms-acal-time {
DISPLAY: none
}
.ms-acal-sdiv {
MARGIN-LEFT: -58px
}
.ms-acal-sdiv A {
POSITION: absolute; WIDTH: 100%; LEFT: 0px
}
.ms-acal-title {
HEIGHT: 35px; PADDING-TOP: 0px
}
< /style>


Voila! The timestamp is gone.

Source: http://happysharepointing.blogspot.com/2011/10/removing-default-time-from-sharepoint.html