Showing posts with label o365. Show all posts
Showing posts with label o365. Show all posts

Friday, September 16, 2016

Using Custom fonts in SharePoint

You can use the custom fonts in SharePoint applications ,below are the few things you may have to perform in order to get the new stylish fonts which you want to display to your users in your application .

My experience was to try use the "Avenier" fonts ,this is a paid font and it is been widely used these days .

1)I received the few packages like "Avenir Next Condensed.ttc" "Avenir Next.ttc" "Avenir.ttc"
2) If you try to use these package directly on to your site it will not work ,as the the extension of the file says it is a collection  "TrueType collection font file" .
3)Hence use some tools (many tools are readily available online)  to convert the truetype collection font file to "TrueType font file.
4)What it basically does it breaks the collection of files into individual files (ttf from ttc)
5)Now there are many different formats of font file you can use in your application
6)I have again used the online converter and converted my ttf  files to ".woff"  format
7)Upload these files in any of the document library (eg: site assets"
8)Now you are ready to use your new font in your css file as below

@font-face {
      font-family: "ThiloshNewFont";
      src: url("http://SiteCollection/SiteAssets/HLS-LEAD-FontFamily/AvenirNext-DemiBold.woff");


using in the custom class as below 


.testNewclass
{

     font-family: "ThiloshNewFont";

}


So now in which ever HTML element you use this ".testNewClass" the font style applied will be  "AvenirNextDemiBold"


Thursday, May 19, 2016

Add items to Sharepoint having multiselect Lookup through SharePoint REST


If you are trying to add the list items in the normal way using the REST you would probably get this error

"an unexpected 'primitivevalue' node was found when reading from the json reader"

This is because you would have used the wrong format of people picker or lookup field to update or add item .Below eg "spLookup" is my lookup field and is multiselect .Sharepoint creates the field named spLookupId .


function CreateListItems(){
var data = {
    __metadata: { 'type': 'SP.Data.ThiloshListItem' },
    Title: 'Create from the REST code',  
    spLookupId : { 'results': [1,2] }
};

var url = "/_api/web/lists/getbytitle('thilosh')/items";
var siteurl = "https://thilosh1224456.sharepoint.com/sites/TeamSite"
//var test = __spPageContextInfo.webAbsoluteUrl;
$.ajax({
       // url: __spPageContextInfo.webAbsoluteUrl + url,
   url : siteurl + url,
        type: "POST",
        headers: {
            "accept": "application/json;odata=verbose",
            "X-RequestDigest": $("#__REQUESTDIGEST").val(),
            "content-Type": "application/json;odata=verbose"
        },
        data: JSON.stringify(data),
        success: function (data) {
            $("#resultArea").append("Item added from REST code");
        },
        error: function (error) {
            alert(JSON.stringify(error));
        }
    });
}