2/5/18

What is _spPageContextInfo ?

_spPageContextInfo is a  JavaScript context variable, which will rendered for each SharePoint page. _spPageContextInfo holds few proprieties which will be useful in JavaScript and client object model code. 

_ spPageContextInfo has below properties:

  1.  webServerRelativeUrl
  2.  webAbsoluteUrl
  3. siteAbsoluteUrl
  4. serverRequestPath
  5. layoutsUrl
  6. webTitle
  7. webTemplate
  8. tenantAppVersion
  9. isAppWeb
  10. webLogoUrl
  11. webLanguage
  12. currentLanguage
  13. currentUICultureName
  14. currentCultureName
  15. env
  16. nid
  17. fid
  18. clientServerTimeDelta
  19. updateFormDigestPageLoaded
  20. siteClientTag
  21. crossDomainPhotosEnabled
  22. webUIVersion
  23. webPermMasks
  24. pagePersonalizationScope
  25. userId
  26. userLoginName
  27. systemUserKey
  28. alertsEnabled
  29. siteServerRelativeUrl
  30. allowSilverlightPrompt
  31. themedCssFolderUrl
  32. themedImageFileNames


To know properties of _spPageContextInfo, go to view page source and find text with "_spPageContextInfo".


12/20/17

Set Choice Field Allow 'Fill-in' Choice option As TRUE For all the Lists in Site Collection Programmatically using C# CSOM in SharePoint Online

Here I demonstrate how to update Choice column property AllowFillInChoice as True for all the Lists in Site Collection using console application










using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using System.Security;
namespace AllowFillInChoice
{
    class Program
    {
        static void Main(string[] args)
        {

            using (var ctx = new ClientContext("https://@@@@@@@.sharepoint.com/sites/Dev/"))
            {
                string userName = "---------@-------.onmicrosoft.com";
                string pwd = "--------";
                var securePassword = new SecureString(); ;
                foreach (char c in pwd)
                {
                    securePassword.AppendChar(c);

                }
                securePassword.MakeReadOnly();
                try
                {
                    ctx.Credentials = new SharePointOnlineCredentials(userName, securePassword);
                    Site site = ctx.Site;
                    Web web = ctx.Web;
                    ctx.Load(web);
                    ctx.ExecuteQuery();
                    ListCollection listcoll = web.Lists;
                    ctx.Load(listcoll);
                    ctx.ExecuteQuery();
                    foreach (List olist in listcoll)
                    {
                        if (olist.BaseTemplate == 100)
                        {
                            List list = web.Lists.GetByTitle(olist.Title);
                            ctx.Load(list);
                            ctx.Load(list.Fields);
                            ctx.ExecuteQuery();
                            foreach (var field in list.Fields)
                            {
                                if (field.TypeAsString == "Choice")
                                {

                                    System.Console.WriteLine(field.Title + " - " + field.TypeAsString);
                                    var choiceField = ctx.CastTo<FieldChoice>(field);
                                    choiceField.FillInChoice = true;
                                    choiceField.Update();
                                    ctx.Load(field);
                                    ctx.ExecuteQuery();
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    System.Console.WriteLine(ex.Message);
                }
            }
        }

    }
}

11/4/17

Filter with NULL value using REST API in SharePoint

$filter=FIeldName ne null

url: _spPageContextInfo.webAbsoluteUrl+"/_api/Web/Lists/GetByTitle('Products')/Items?$select=Name,Price,Size&$filter=Size ne null",

The above URL returns the items not having Size field value as Null.

ne - Not Equal

                    

9/21/17

Introduction To SharePoint Framework

SharePoint Framework is also abbreviated as SPFx. SharePoint Framework offers modern technologies, Node-based development, TypeScript etc. that are applied to SharePoint and Office 365 development.


Earlier, we used to create web-parts (rectangular boxes with defined functionality) and even business users knew what web-parts are. In SharePoint Framework, these web-parts are termed as Client web-parts. From a technology perspective, they are quite different, but from a user perspective, they are the same rectangular widgets that the users can add on their pages. In addition, we know about Add-In model and the Iframe-based integration, which we used in our daily SharePoint development.

History of SharePoint Development
  1. Farm Solutions
    The development in SharePoint started with Farm Solutions, WSPs, full trust code. This approach was very powerful and developers could literally do whatever they wanted to do on the SharePoint Farm. However, it made upgrades very difficult and it made maintaining and keeping the environment secure very difficult.
  2. Sandbox Solutions
    A box in which code cannot run outside the boundary of the box.
  3. Add-Ins (App Model)This has been introduced in SharePoint 2013 and Office 365. It is based on Iframe-based integration. This approach also has many disadvantages.
  4. Script InjectionUsing Content Editor and Script Editor web-parts. With this approach, we can almost everything on a SharePoint page; however, this is not the best-recommended approach from Microsoft.
  5. No-script capabilityA tenant wide setting which removes all content editor web-part and scripts from the page.
  6. SharePoint FrameworkIt is a custom and supported way from Microsoft, to allow to embed code inside SharePoint sites.

9/13/17

Apple Unveils iPhone 8, Plus, iPhone X; Facial Recognition, Wireless Charging Are Key Features

Apple unveiled three new iPhone models on Monday, including a top-of-line handset described as "the biggest leap forward" since the original iPhone 10 years ago. Apple chief executive Tim Cook announced the premium iPhone X -- pronounced 10 -- as well as a new iPhone 8 and 8 Plus. Cook, speaking at the first event at the new campus theater named for the late Apple co-founder Steve Jobs, said the latest flagship handset is a milestone for the company a decade after the first iPhone release.


"Ten years later it is only fitting that we are here in this place, on this day to reveal a product that will set the path for technology for the next decade," Cook said, calling the iPhone X "the biggest leap forward since the original iPhone." The iPhone X has an edge-to-edge screen and uses facial recognition to unlock the device, and improved "super retina" display with improved graphics and resolution. Apple senior vice president Phil Schiller said the glass-body iPhone 8 and 8 Plus handsets were the first smartphones "really created for augmented reality," with improved power and graphics over their predecessors. Apple also unveiled an updated smartwatch and an upgraded streaming video system for 4K high-definition television.

iPhoneX

iPhone X, the future of the smartphone, is a gorgeous all-glass design with a beautiful 5.8-inch Super Retina display, A11 Bionic chip, wireless charging and an improved rear camera with dual optical image stabilization. iPhone X delivers an innovative and secure new way for customers to unlock, authenticate and pay using Face ID, enabled by the new TrueDepth camera. iPhone X will be available for pre-order beginning Friday, October 27 in more than 55 countries and territories, and in stores beginning Friday, November 3.
iPhone X introduces a revolutionary design with a stunning all-screen display that precisely follows the curve of the device, clear to the elegantly rounded corners. The all-glass front and back feature the most durable glass ever in a smartphone in silver or space gray, while a highly polished, surgical-grade stainless steel band seamlessly wraps around and reinforces iPhone X. A seven-layer color process allows for precise color hues and opacity on the glass finish, and a reflective optical layer enhances the rich colors, making the design as elegant as it is durable, while maintaining water and dust resistance.
The beautiful 5.8-inch Super Retina display2 is the first OLED panel that rises to the standards of iPhone, with stunning colors, true blacks, a million-to-one contrast ratio and wide color support with the best system-wide color management in a smartphone. The HDR display supports Dolby Vision and HDR10, which together make photo and video content look even more amazing. The addition of True Tone dynamically adjusts the white balance of the display to match the surrounding light for a more natural, paper-like viewing experience.
The new 7-megapixel TrueDepth camera that enables Face ID features wide color capture, auto image stabilization and precise exposure control, and brings Portrait mode to the front camera for stunning selfies with a depth-of-field effect.
The glass back design enables a world-class wireless charging solution. Wireless charging works with the established Qi ecosystem, including two new wireless charging mats from Belkin and mophie, available from apple.com and Apple Stores.
Price
iPhone X will be available in silver and space gray in 64GB and 256GB models starting at $999 (US) from apple.com and Apple Stores and is also available through Apple Authorized Resellers and carriers (prices may vary).
iPhone 8 and iPhone 8 Plus

The new iPhone features a new glass and aluminum design in three beautiful colors made out of the most durable glass ever in a smartphone, Retina HD displays and A11 Bionic chip, and is designed for the ultimate augmented reality experience. The world’s most popular camera gets even better with single and dual cameras featuring Portrait Lighting on iPhone 8 Plus, and wireless charging brings a powerful new capability to iPhone. Both devices will be available for pre-order beginning Friday, September 15 in more than 25 countries and territories, and in stores beginning Friday, September 22.
iPhone 8 and iPhone 8 Plus introduce a beautiful glass back design made with the most durable glass ever in a smartphone in three new finishes: space gray, silver and gold. The glass finish is made using a seven-layer color process for precise hue and opacity, delivering a rich depth of color with a color-matched aerospace-grade aluminum bezel, and is water and dust resistant.
The new 4.7-inch and 5.5-inch Retina HD displays with the addition of True Tone adjust the white balance of the display to match the surrounding light for a more natural, paper-like viewing experience. The vibrant wide color gamut Retina HD display offers the best color accuracy in the industry. Redesigned stereo speakers are up to 25 percent louder and deliver deeper bass, enabling richer-sounding music, videos and speakerphone calls.
The world’s most popular camera gets even better, featuring an improved 12-megapixel camera with a larger and faster sensor, a new color filter and deeper pixels.
The glass back design enables a world-class wireless charging solution. Wireless charging works with the established Qi ecosystem, including two new wireless charging mats from Belkin and mophie, available from apple.com and Apple Stores.
Price
iPhone 8 and iPhone 8 Plus will be available in space gray, silver and an all-new gold finish in increased 64GB and 256GB capacity models starting at $699 (US) from apple.com and Apple Stores and is also available through Apple Authorized Resellers and select carriers (prices may vary).

9/10/17

Prerequisites To Build SharePoint Solutions With Typescript


  1. TypeScript was developed and introduced by Microsoft.
  2. TypeScript is object oriented programming language which is considered as a super set of JavaScript.
  3. TypeScript cannot be used directly on SharePoint platforms.
  4. TypeScript code has to be precompiled to JavaScript before deploying it on SharePoint.
  5. TypeScript has compiler (tsc) to compile the code from TS to JS. The compiler produces a JavaScript file from a TypeScript source file
We can install TypeScript for Visual Studio from Microsoft site (https://www.microsoft.com/en-us/download/details.aspx?id=48593). For other versions of Visual Studio, the download links are available from http://www.typescriptlang.org/index.html#download-links.

Create a new SharePoint 2016 - Empty project (or SharePoint 2013).

Fill in the site URL and select "Deploy as sandbox solution" option.

 

On Visual Studio, navigate to Tools -> NuGet Package Manager -> Manage NuGet Packages for solution. Install the TypeScript plugins. The required plugins for executing TypeScript sample on SharePoint are -

jquery.TypeScript.DefinitelyTyped
Microsoft.TypeScript.Compiler
Microsoft.TypeScript.MSBuild
sharepoint.TypeScript.DefinitelyTyped 
microsoft-ajax.TypeScript.DefinitelyTyped

The above plugin also installs the TypeScript build/compiler components.
 
Edit the project file (Required if the compiler/build plugins are not available for Visual Studio)
From the solution explorer, right click the project and select "Unload Project" option
Again right click on the project and select edit project.
Paste the below code on the project file within the project tag. Save the project file.

 <PropertyGroup>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
  </PropertyGroup>
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" />



*From Solution explorer, right click the project and select reload project option. If the dialog box appears, close it and proceed loading the project.

*From Solution Explorer, right click the project and select properties option. TypeScript build option will appear on the properties.


Benefits Of SharePoint 2016 From A End User Perspective

The new changes introduced in SharePoint 2016.

List/Library Improvements 

Durable Links
This is a feature introduced in SharePoint 2016 for document library. It allows users to rename or move their documents to new locations without breaking the links referring to the document. It also helps in the SEO improvement and search based indexing to let the documents to be functional.

Internally, SharePoint maintains the same DocID assigned to the document, even if it is renamed or moved to a different location. We need to activate the “Document ID Service” feature from the Site Collection features page. Henceforth, with the introduction of Durable links in SharePoint 2016, users do not have to worry about the broken or dead links while renaming or moving a document from one document library to another.


File Names
With the release of SharePoint 2016, Microsoft has introduced two of the good features for documents in a document library:-

Special Characters
In SharePoint 2013, there was a restriction on file names in a document library while creating or uploading the files. The restriction was – “A file name cannot contain any of the following characters: \ / : * ? < > | # {} % ~ &”. In SharePoint 2016, this restriction has been removed and now users can upload files having special characters like ~, &, %, {} etc.

Filename Length
In SharePoint 2013, there was a limit of 128 characters while uploading a file or while creating a folder in a document library (SharePoint 2013 used to give error – “Sorry something went wrong”, if we create files longer than 128 characters). In SharePoint 2016, users can create or upload files that are longer than 128 characters.
Usability Ease (Shortcuts)

Keyboard shortcuts are included in document library, for the following tasks:-
Alt + N – New
Alt + E – Edit
Alt + U – Upload
Alt + S – Share
Alt + Y – Synchronization

Large File Handling

The addition of large file limit was introduced in SharePoint 2013, however that was only 2 GB. In SharePoint 2016, users can now upload large files, as it has been increased from the 2 GB maximum file limit to 10 GB maximum file size. In addition, the threshold limit of list and libraries have been increased.

Hybrid Sites

Users can now follow sites on both SharePoint Online and SharePoint On-Premise and these followed sites can be displayed in single unified list.

Hybrid One Drive for Business


Users can now sync their files with Office 365. This gives an advantage to the users to access files (documents, images etc.) directly from Office 365 and on any device.

User Profile 


Users can now have a single profile in Office 365 where all their profile information will be stored and users can use that profile information for both SharePoint Online and SharePoint On-Premise environments.

Hybrid Search

The Hybrid Search concept was introduced in SharePoint 2013 which allows searching across both SharePoint Online and SharePoint On-Premise environments through a single interface. However, in SharePoint 2013 Hybrid Search, there was an issue  that search results from the SharePoint Online and SharePoint On-Premise environments used to appear as separate and not integrated. This caused the users a problem to determine which result is more relevant etc.

The above issue got resolved in SharePoint 2016.


SharePoint 2016 now provides a unified search experience for hybrid cloud search. Essentially, the way this works is that the Office 365 search functionality will consume the SharePoint On-Premise search index so that it can provide integrated results from both sources for the same query and users will now get the most relevant results from the two environments.

Zero Downtime Patching

As we know, applying patches on a regular basis is an important part of SharePoint environment from a maintenance standpoint. Earlier, installing patches was a time-consuming process because it needed the installation of large cumulative update files (in GB’s). Applying all the patches would result in the downtime of the environment for some time, which ultimately created the problem for end users.

SharePoint 2016 introduced the concept of Zero Downtime Patching where patches are in the form of small packages (in MB’s) and all these patches are having very less or no dependencies on one another. So, now the patches contains more targeted changes, so the SharePoint Administrator has choice about which patches to install and which patches to skip, so that users do not face any downtime of the application.


Additionally, there is a concept introduced called Automatic Patching, which means that SharePoint 2016 Server receives automatic patch updates that allows less downtime for organizations.

What is _spPageContextInfo ?

_spPageContextInfo is a  JavaScript context variable, which will rendered for each SharePoint page. _spPageContextInfo holds few proprietie...