Featured

SharePoint Framework Office UI Fabric

SharePoint Framework Office UI Fabric

Today, lets take a look at using SharePoint Framework Office UI Fabric. Lets start by creating a SharePoint Framework project. Create a new folder and execute the yo @microsoft/sharepoint command within the folder. If you have not yet set up your workstation for SharePoint Framework you can check out my post SharePoint Framework SpFx Setup Continue reading “SharePoint Framework Office UI Fabric”

Featured

SharePoint Framework Provision Assets

SharePoint Framework Provision Assets

Today, lets take up the topic ‘SharePoint Framework provision assets’. Basically I am referring to the basic building blocks of SharePoint such as:

  1. Create site columns
  2. Site content type
  3. Use SharePoint Framework – Provision List (Create List)

Continue reading “SharePoint Framework Provision Assets”

Featured

Creating a SharePoint SPA using AngularJS and Breeze

Today, we will look at creating a SharePoint SPA using AngularJS and Breeze in a SharePoint hosted app. Single Page Apps or SPA does not mean the application is limited to one page. The experience of navigating between pages is seamless for the user without the postback which happens when navigating to a page.
Continue reading “Creating a SharePoint SPA using AngularJS and Breeze”

Featured

Workflows in SharePoint 2013 using Visual Studio

The SharePoint 2013 workflow architecture has introduced a workflow manager farm. Workflow manager communicates with SharePoint 2013 using the REST API. Workflow manager requires the user profile application to be already created and configured.

Read on to understand workflows in SharePoint 2013. We’ll go over an example of creating a workflow for a contacts list which creates a task to categorize the contact as Developer, Team Lead or Manager instead of the out of box Approve, Reject options in the task form.
Continue reading “Workflows in SharePoint 2013 using Visual Studio”

Featured

Using JavaScript or JQuery and JSOM in SharePoint

In this article we’ll see how to plug in some JavaScript and use the JavaScript object model or JSOM to interact with SharePoint. The advantage with JSOM is that it allows you to batch the requests to the server.

It would also be easier to make REST API calls from JavaScript. And, it would be easier to work with the return data like json from these REST calls using JavaScript as well.
Continue reading “Using JavaScript or JQuery and JSOM in SharePoint”

Featured

WebMethods in SharePoint using JQuery

Lets say we have a SharePoint Site Page or Application Page which has a server side method and we would like to call this method from JavaScript code. Wouldn’t it be great if we can do the server side processing and return the result such as a string or a json object back to the client side? Well, this is precisely what we can do using WebMethod framework.
Continue reading “WebMethods in SharePoint using JQuery”

Featured

Download files from SharePoint document library using C#

How to download files from SharePoint document library programmatically using C#

Sometimes, we would want to download multiple files based on a pre-defined query such as a monthly report or a bulk download.

If it is a few files or if it is a complete folder, we can use the explorer view to copy paste the files. However, if we want to customize the query or automate the process, then we need to write custom code to download the files programmatically. This is also true, if we want to access the metadata of the files along with downloading the actual files.
Continue reading “Download files from SharePoint document library using C#”

SharePoint Framework SpFx Example

SharePoint Framework SpFx example

Let us have a look at a SharePoint Framework SpFx example without using any client side framework i.e it uses plain vanilla JavaScript or TypeScript.

In the previous post, we set up the development environment and created a simple hello world web part. If you need to setup your dev environment, you can check out the post – SharePoint Framework SpFx setup. Now, lets examine how to
customize the SharePoint Framework SpFx step by step to retrieve and display some list data.

In the top of the HelloWorldWebPart.ts, we need to import the SPHttpClient and SPHttpClientResponse objects. This will provide us the helper methods to make the REST calls.

import {
SPHttpClient,
SPHttpClientResponse
} from '@microsoft/sp-http';

Lets create couple of interfaces to represent the structure of data returned from the api

export interface ITaskListItems {
  value: ITaskListItem[];
}
export interface ITaskListItem {
  Title: string;
}
In the HelloWorldWebPart class, remove the existing default row provided by the framework and add a new row to load the results. Also, we’ll call a
JavaScript method to load the data. The updated render method looks like
public render(): void {
    this.domElement.innerHTML = `
      <div class="${ styles.helloWorld }">
        <div class="${ styles.container }">
          <div class="${ styles.row }">
            <div class="${ styles.column }">
              <div id="taskListInfo" />
            </div>
          </div>
        </div>
      </div>`;

      this.loadTaskListInfoAsync();
  }

loadTaskListInfoAsync calls two helper methods


private loadTaskListInfoAsync(): void {
this.getListData()
.then((response) => {
this.renderListInfo(response.value);
});
}

One to query the data
private getListData(): Promise {
return this.context.spHttpClient.get(this.context.pageContext.web.absoluteUrl + `/_api/web/lists/getByTitle('Tasks')/Items?$select=Title`, SPHttpClient.configurations.v1)
.then((response: SPHttpClientResponse) => {
return response.json();
});
}
and a method to load the data to the html
Ensure that you have started the server by running
gulp serve
Now if we navigate to the SharePoint Online workbench and add the webpart, we should see the list of items in the
Tasks list
{sharepoint online site url}/_layouts/15/workbench.aspx
Items in Tasks List
Items in Tasks List

Now we can see the SharePoint Framework SpFx example in the SharePoint online workbench.

Deploy the app

Now lets deploy our SharePoint Framework SpFx example to SharePoint online. Press Ctrl + C to stop the gulp serve

Under the config folder, check the package-solution.json file. You can change any of the parameters such as id,
name etc. You can leave it as defaults for now.

Now, we can package up the solution

gulp package-solution

which will create a package file

helloworld-webpart.sppkg in sharepoint/solution folder
Now we can add this package to our app catalog(Admin center -> apps -> app catalog). If it’s the first time
you are accessing your SharePoint online tenant you need to create the app catalog for this tenant.
SharePoint Framework SpFx Example - Trust App in App Catalog
Trust App in App Catalog

Once it is added to app catalog, it will list the app and error column should say something like ‘No errors’

App Catalog
App Catalog

Now, lets add the SharePoint Framework SpFx example to the dev site. navigate to the dev site and click the gear icon and ‘Add an app’ and select the hello world web part.

Add an app
Add an app

Ensure ‘gulp serve’ is running on your local machine again. Now you can go to any page in your site and add this web part.

App added to page
App added to page

Notice that we are still serving this app from local server. You might get an error if gulp serve is not running
locally.

Deploying the files to Office 365 tenant CDN

Now instead of serving the files locally, we can upload it or host it in the CDN which is given for free by
Microsoft. Let’s go ahead and upload our SharePoint Framework SpFx example package to Microsoft CDN.

First, ensure you have the latest SharePoint
Online Management Shell

Next, connect to your tenant admin site

Connect-SPOService -Url https://<yourtenant>-admin.sharepoint.com

Enable the public CDN for the tenant

Set-SPOTenantCdnEnabled -CdnType Public

Lets check the setting by running

Get-SPOTenantCdnOrigins -CdnType Public and we should get back

Check Cdn settings using Get-SPOTenantCdnOrigins

In the package-solution.json ensure that includeClientSideAssets is set to true.
Let’s package the solution
gulp bundle --shipgulp package-solution --ship and redeploy the package. If the previous local package is already present, it will ask to replace. Click on ‘Replace it’Replace app packageNow, if we refresh our page and go to the console window and check the Sources tab, we can see the files for the SharePoint Framework SpFx example are served
from a public cdn. You can now do a Ctrl + C to end the ‘gulp serve’ on your local machine. The web part will still
work! Congratulations! you have successfully deployed a SharePoint Framework SpFx web part to Office 365 and served the
required files from a public cdn.

Customizing SharePoint 2013 Search Center

In SharePoint 2010, FAST search existed alongside with SharePoint Search. In SharePoint 2013, both have been integrated and you now have a single interface of SharePoint Search.

In this post, we’ll go over some SharePoint 2013 Search concepts such as crawled properties, managed properties. Then, we’ll see how you can customize the search center with Custom result page and navigation, Result Source, Display template, Result type, Query Rules and Refiners.

Continue reading “Customizing SharePoint 2013 Search Center”