Thursday, December 18, 2014

How to limit a SharePoint list to one row, with no-code

How to limit a SharePoint list to one row, with no-code

Have you ever wanted to use the functionality of a SharePoint list, but limit the list to only one row?

Did you go into Item Limit in the view, only to realize that you are limiting the number of items to be viewable, not actually limiting the number of items in the list?

I have, and I have come up with a very simple, OOB, no-code solution: Add a column, that is Required, Enforces Unique Values, and give it a Default Value. That’s it!
However, to make it more robust and transparent, you will need to:

    1. Create a site column


    2. Create a List Content Type


    3. Add the Site Colum to the Content Type


    4. Make the column Hidden
Let’s test it out. After adding my content type to a new custom list, I created one record: “Item 23665.” I can see it in the list. Now, I will attempt to add a second list item: “Item 27788”:


After pressing Save nothing happens (the window stays open – you will have to write some code to force it to close). The user must press Cancel to get out of this modal, and the record will not be saved.

I hope you find this helpful.

- Kristin Cameron


SharePoint Designer Cannot Display the Item

SharePoint Designer Cannot Display the Item

In Office 365, after successfully accessing the SharePoint site via the URL in the browser, and after successfully opening the site in SharePoint Designer 2010 or SharePoint 2013, I continuously received the following error when accessing workflows (to view or edit).


There is a very simple solution to this problem:

    1. Close SharePoint Designer 2013
    2. On the local computer, browse to the following folder:
    C:\Users\\AppData\Local\Microsoft\WebsiteCache
    3. Delete all the folders that are present.
    4. On the local computer, browse to the following folder:
    C:\Users\\AppData\Roaming\Microsoft\SharePoint Designer\ProxyAssemblyCache
    5. Delete all the folders that are present.
    6. Open SharePoint Designer 2013 and make the changes to your site as needed.


The TechNet article can be found here.
- Kristin Cameron

Tuesday, October 8, 2013

SharePoint Saturday Michigan - Managed Navigation

Thanks for everyone who attended my session last Saturday.  Below is a link to the deck.

https://skydrive.live.com/redir?page=view&resid=4A75F44C18CFBFF5!3187&authkey=!AEHUI_-dZn3a2Ck

Feel free to post questions, and I will do my best to respond in a timely manner.

Enjoy the fall colors.

~ Kristin Cameron


Thursday, January 31, 2013

SharePoint 2013 Hardware & Software Requirments

Rather than digging through and compiling Microsoft documentation, here are the hardware & software requirements for SharePoint 2013, all in one place.  

Enjoy! ~ Kristin Cameron










How to put an icon into a SharePoint calendar view


How to put an icon into a SharePoint calendar view



Working on a customized calendar project, the client requested the following:
v     If an executive will be attending an event, put an icon, such as a star, to the left of the event title, in Calendar view.

It sounds straightforward, but in SharePoint, there are often limitations to work around.  In this case, there were two limitations.  One being, that there really are no “icons” in SharePoint 2010.  Two being you can only have one field showing in the month view.  My original thought was to place the icon next to the Title field, but with only one field choice allowed, that wouldn't work.

What you can do; however, is insert ASCII into a text or calculated field.  There are a limited number of ASCII codes for images, but there are plenty of arrows, stars, crosses, etc. to choose from.  So, what I did was created a new calculated field, that was a concatenation of a star, pasted from an ASCII star (if the conditions were met) and the Title field.
The result looked like this:



You can have a lot of fun with this.

Enjoy!
Kristin Cameron, Managing Consultant
Project Leadership Associates

Monday, September 17, 2012


How to Color Code a SharePoint Calendar



There is no OOB way to Color Code a SharePoint calendar.  Bamboo has a web part for purchase; however, this web part has limited functionality and it makes significant changes to the look & feel of the calendar.
In order to simply change the color of the calendar entries, based on a column value, modify the JavaScript at the end of this blog to meet your needs.
1.  Create a document library for your code, such as, https://my.sharpoint.com/sites/MySite/CodeLib/ and copy jquery-1.5.1.js there
2.  Modify the first line of code to point to the location of your document library:  <script type="text/javascript" src="https://my.sharpoint.com/sites/MySite/CodeLib/jquery-1.5.1.js"></script>
3.  Create a column in the Calendar list, called “MyCategory.” 
4.  Modify the switch/case section of the javascript to the categories in your list, and choose the colors you would like:

var colour = null;
        switch (category.trim().toLowerCase()) {
             case 'custom category 1':
                colour = "#7bd148";
                break;
            case 'custom category 2':
                colour = "#f691b2";
                break;
            case 'custom category 3':
                colour = "#fbe983";
                break;
            case 'custom category 4':
                colour = "#9a9cff";
                break;
        }
        return colour;
5.   Save the .js file in a document library within the site collection (make sure all users have READ access to this document)
6.   Create a hidden web part that references this .js file
7.   Create a calculated field with ="|||"&MyCategory&"|||"&Title
8.   Create a calendar view choose the new Calculated field (from step 5) for Month View Title, Week View Title, etc. (instead of the default “Title”)


JavaScript
<script type="text/javascript" src="https://my.sharpoint.com/sites/MySite/CodeLib/jquery-1.5.1.js"></script>
<script type="text/javascript">
    _spBodyOnLoadFunctionNames.push('WaitForCalendarToLoad');
    var SEPARATOR = "|||";
    function WaitForCalendarToLoad() {
        if (typeof SP.UI.ApplicationPages.CalendarNotify.$4a == 'undefined') {
            // post SP1
            var pwold$4b = SP.UI.ApplicationPages.CalendarNotify.$4b;
            SP.UI.ApplicationPages.CalendarNotify.$4b = function() {
                pwold$4b();
                ColourCalendar();
            }
            SP.UI.ApplicationPages.SummaryCalendarView.prototype.renderGrids = function($p0) {
                var $v_0 = new Sys.StringBuilder();
                var $v_1 = $p0.length;
                for (var $v_2 = 0; $v_2 < $v_1; $v_2++) {
                    this.$7t_2($v_2, $p0[$v_2]);
                }
                for (var $v_3 = 0; $v_3 < $v_1; $v_3++) {
                    $v_0.append('<div>');
                    this.$I_2.$7o($v_0, $p0[$v_3], $v_3);
                    $v_0.append(this.emptY_DIV);
                    $v_0.append('</div>');
                }
                this.setInnerHtml($v_0.toString());
                ColourCalendar();
            }
        }
        else {
            // pre SP1
            var pwold$4a = SP.UI.ApplicationPages.CalendarNotify.$4a;
            SP.UI.ApplicationPages.CalendarNotify.$4a = function() {
                pwold$4a();
                ColourCalendar();
            }
            SP.UI.ApplicationPages.SummaryCalendarView.prototype.renderGrids = function($p0) {
                var $v_0 = new Sys.StringBuilder();
                var $v_1 = $p0.length;
                for (var $v_2 = 0; $v_2 < $v_1; $v_2++) {
                    this.$7r_2($v_2, $p0[$v_2]);
                }
                for (var $v_3 = 0; $v_3 < $v_1; $v_3++) {
                    $v_0.append('<div>');
                    this.$I_2.$7m($v_0, $p0[$v_3], $v_3);
                    $v_0.append(this.emptY_DIV);
                    $v_0.append('</div>');
                }
                this.setInnerHtml($v_0.toString());
                ColourCalendar();
            }
        }
    }

    function ColourCalendar() {
        if (jQuery('a:contains(' + SEPARATOR + ')') != null) {
            jQuery('a:contains(' + SEPARATOR + ')').each(function(i) {
                $box = jQuery(this).parents('div[title]');
                var colour = GetColourCodeFromCategory(GetCategory(this.innerHTML));
                //this.innerHTML = GetActualText(this.innerHTML);
                this.innerHTML = "<span style='color:#000000'>" + GetActualText(this.innerHTML) + "";
                jQuery($box).attr("title", GetActualText(jQuery($box).attr("title")));
                $box.css('background-color', colour);
            });
        }
    }

    function GetActualText(originalText) {
        var parts = originalText.split(SEPARATOR);
        return parts[0] + parts[2];
    }

    function GetCategory(originalText) {
        var parts = originalText.split(SEPARATOR);
        return parts[1];
    }

    function GetColourCodeFromCategory(category) {
      
var colour = null;
        switch (category.trim().toLowerCase()) {
            case 'custom category 1':
                colour = "#7bd148";
                break;
            case 'custom category 2':
                colour = "#f691b2";
                break;
            case 'custom category 3':
                colour = "#fbe983";
                break;
            case 'custom category 4':
                colour = "#9a9cff";
                break;
        }
        return colour;
    }
</script>



Happy Color Coding!

-          Kristin Cameron, Managing Consultant
   Project Leadership Associates