Blogger

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

    Recent items

Login

Tuesday, 04 March 2014 22:46

How to use and configure large lists

Sometime,

we need to store into lists a lot of elements. All developers that know SharePoint knows that in the OOB views there is the limit of 5000 items.
I want suggest these recommendations to create a definition for a list that have a lot of elements:

  • allow the folders and create an event receiver in order to store the items into the folders (maximum 5000 items for each folder)
  • enable one o more indexed columns (not on the ID field and the best fields are text fields). Each column that will be used for where condition or $filter condition need to enabled as indexed column
  • if you are quering on lookup column, you must use this

<FieldRef Name='ColumnName' LookupId='TRUE' /><Value Type='Integer'   >LOOKUP_ITEM_ID</Value>

In the case that you have already the list and you have exceeded the threshold, these are the steps for the work around:

  • from the central administration, modify the threshold value up to the current list count on the current web application
  • add the indexed column
  • create a view that contains less of 5000 items (for example with where condition on created date)
  • from the central administration, reset the threshold value to 5000 on the current web application

In the case that you want to use the REST API on the list, remember that all fields that you need to apply $filter condition, need to defined as indexed column, otherwise you'll have the error "Internal server error".


See these links for more details

Published in SharePoint

You may have encountered a warning similar to the following when browsing web sites with IE or Chrome:

"The Web site wants to run the following add-on: 'Name ActiveX Control' from 'Microsoft Corporation'. If you trust the Web site and the add-on and want to allow it to run, click here..."

The problem occurs only on PC that has Microsoft Lync installed. Infact, the browser needs the rights to execute a Microsoft dll (Name.dll) in order to display the presence icon.

I've also tried to disable the feature from the web application settings but it not resolve the problem.

If your application doesn't need of this feature and you want to disable this warning, you need to override the SharePoint OOB script that request the add-on. These are the steps to fix the problem:

  • Edit the master page
  • immediately under the body tag, add the follow script.

Show/Hidden javascript code

View source
 
 
 
<script>
    function ProcessImn()
    { }
    function ProcessImnMarkers()
    { }
</script>  
 
 
 

That is it.

Published in SharePoint

If you use this field to render a lookup field, the results is an hyperlink to view the related item.

Show/Hidden csharp code

View source
 
 
 
<SharePointWebControls:FieldValue ID="lfYear" FieldName="Year" runat="server"/>
 
 
 


If you want to create a reusable WebControl just to render the Lookup Value, you can copy and paste this code and reproduce these steps:

  • Create the web control. The property FieldName would be used to retreive the date from the SPListItem

Show/Hidden csharp code

View source
 
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Publishing.WebControls;
using Microsoft.SharePoint.Publishing.Internal.WebControls;
using System.Text.RegularExpressions;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Web.UI;
using Microsoft.SharePoint;
 
namespace LucaCostante.com.WebControls
{
    public class SimpleLookupView: WebControl
    {
        private string name;
        [Bindable(true), DefaultValue(""), Localizable(false)]
        public string FieldName
        {
            get { return name; }
            set { name = value; }
        }
 
        protected override void Render(HtmlTextWriter writer)
        {
            try
            {
                string value = GetLookupValue(FieldName);
                if (SPContext.Current.ListItem.Fields.ContainsFieldWithStaticName(FieldName))
                    value=SPContext.Current.Item[FieldName].ToString();
 
                if (!string.IsNullOrEmpty(value) && value.Contains(";#"))
                    value=value.Split(new string[]{";#"},StringSplitOptions.RemoveEmptyEntries)[1];
                writer.Write(value);
            }
            catch { }
        }
 
        public static string GetLookupValue(string fieldName)
        {
            string value = string.Empty;
            if (SPContext.Current.Item.Fields.ContainsFieldWithStaticName(fieldName))
                value = SPContext.Current.Item[fieldName].ToString();
 
            if (!string.IsNullOrEmpty(value) && value.Contains(";#"))
                value = value.Split(new string[] { ";#" }, StringSplitOptions.RemoveEmptyEntries)[1];
 
            return value;
        }
    }
}
 

  • Register the WebControl into the PageLayout

Show/Hidden csharp code

View source
 
 
 
<%@ Register Tagprefix="LCWebControls" Namespace="LucaCostante.com.WebControls" Assembly="LucaCostante.com, Version=1.0.0.0, Culture=neutral, PublicKeyToken=13f47470cb97767e"%>
 
 
 

  • Use the web control

Show/Hidden csharp code

View source
 
 
 
<LCWebControls:SimpleLookupView ID="lfYear" FieldName="Year" runat="server" />
 
 
 

 

Published in SharePoint
Tuesday, 26 February 2013 16:35

Use a non default webfont

Some customers when ask us to develope the Intranet or other SharePoint sites, they want to use another font otherwise default fonts.

All websites can use the WebFonts (at this link, you can find all web fonts and can download it). To use a non-default webfont also under SharePoint , you must deploy it into your farm (in my example, i've added it under layouts mapped folder).

After that, must add into the css file the directive:

Show/Hidden css code

View source
 
 
 
@font-face {
    font-family: 'OpenSans';
    src: url('/_layouts/style/fonts/OpenSans-CondLight-webfont.eot');
    src: url('/_layouts/style/fonts/OpenSans-CondLight-webfont.eot?#iefix') format('embedded-opentype'),
         url('/_layouts/style/fonts/OpenSans-CondLight-webfont.woff') format('woff'),
         url('/_layouts/style/fonts/OpenSans-CondLight-webfont.ttf') format('truetype'),
         url('/_layouts/style/fonts/OpenSans-CondLight-webfont.svg#OpenSansCondensedLight') format('svg');
    font-weight: normal;
    font-style: normal;
}
 
 
 

 

Published in SharePoint