PowerShell and CSOM: Tool to Import Design Package WSP with activation of required feature for SharePoint Online-O365

Introduction

This is my initial article to address the challenges around automation of SharePoint Online deployment.
Below artifacts can be developed through this technique,

  • List Definition
  • List Instance
  • Web part development
  • Template Development
  • JS Link webpart development
  • Remote Timer Job
  • Remote Event Handler
  • etc.
You can combine any set of above artifacts in to a WSP solution.

Tool Description

This tool is responsible for activating the mandatory features for any site other than Publishing and Installing or Upgrading the WSP Solution to SPO O365 tenant site collection.

Below are the features activated using this tool,

1. SharePoint Server Publishing Infrastructure

2. SharePoint Server Publishing

You can also extend the logic for activation of other feature by calling below,

PowerShell
Enable-SPOFeature -sSiteColUrl $SiteURL -spoCtx $Context -sFeatureGuid $FeatureGuidServerPublishing -IsSiteScope $False
Use below parameters while calling method,
$SiteURL – site collection URL
$Context – Context of the site
$sFeatureGuid – Guid of feature to be activated
$True or $False – is site collection level feature

 

Download Source

Click here to download Source

Authentication and Execution Model

Authentication and Execution Model
As depicted in above model diagram shows how PowerShell based tool help to authenticate, connect to SPO and on validation it helps to execute the CSOM based commandlets and deploy the WSP to perform deployment of different artifacts as packaged. Below are major component as depicted in diagram,
A. SharePoint Online Mangement Shell
B. Authentication component – while connecting to SharePoint Online tenant
C. Validated Admin enable to process the execution to SPO
D.SharePoint Tenant – Site Collection  Targeted destination for deployment

Run Execution Command

Below is the command will be helpful to execute the tool. Kindly modify the parameters before execution,

PowerShell
.\ApplyDesignPackageInstalltionAndUpgradeWSP.ps1 -User admin@xxxxxx.onmicrosoft.com -SiteURL "https://xxxxxx.sharepoint.com/sites/xxxxxx" -wspFullFilePath "C:\Amjad\<WSPBuildName>.wsp"  -WspFileName "<WSPBuildName>.wsp" -wspPackageName "<WSPBuildName>" -majorVersion 1 -minorVersion 0
 Parameters details are as below,

Script can accept 7 parameters from the command line#

# User – mandatory – Administrator login ID for the tenant we are querying

# SiteURL – mandatory – Destination Site URL for the tenant we are querying

# wspFullFilePath – mandatory – Path of WSP location to upload from

# WspFileName – mandatory – Name of WSP file

# wspPackageName – Optional – WSP Package Name for Solution Gallery

# majorVersion – Optional – majorVersion of the Build demployment or upgrade

# majorVersion – Optional – minorVersion of the Build demployment or upgrade#

 

Hope this article helps.

PowerShell and CSOM:Tool to Import Design Package WSP for SharePoint Online O365

Introduction

O365- SharePoint Online : This tool is responsible for activating the madatory features for any site other than Publishing and Installing or Upgrading the WSP Solution.

Below are the features,

1. SharePoint Server Publishing Infrastructure

2. SharePoint Server Publishing

Download Source

Click here to download Source

You can also extend the logic for activation of other feature by calling below,

PowerShell
Enable-SPOFeature -sSiteColUrl $SiteURL -spoCtx $Context -sFeatureGuid $FeatureGuidServerPublishing -IsSiteScope $False
 Use below parameters while calling method,
$SiteURL – site collection URL
$Context – Context of the site
$sFeatureGuid – Guid of feature to be activated
$True or $False – is site collection level feature

Run Execution Command

Below is the command will be helpful to execute the tool. Kindly modify the parameters before execution,

PowerShell
.\ApplyDesignPackageInstalltionAndUpgradeWSP.ps1 -User admin@xxxxxx.onmicrosoft.com -SiteURL "https://xxxxxx.sharepoint.com/sites/xxxxxx" -wspFullFilePath "C:\Amjad\<WSPBuildName>.wsp"  -WspFileName "<WSPBuildName>.wsp" -wspPackageName "<WSPBuildName>" -majorVersion 1 -minorVersion 0

Parameters details are as below,

Script can accept 7 parameters from the command line#

# User – mandatory – Administrator login ID for the tenant we are querying

# SiteURL – mandatory – Destination Site URL for the tenant we are querying

# wspFullFilePath – mandatory – Path of WSP location to upload from

# WspFileName – mandatory – Name of WSP file

# wspPackageName – Optional – WSP Package Name for Solution Gallery

# majorVersion – Optional – majorVersion of the Build demployment or upgrade

# majorVersion – Optional – minorVersion of the Build demployment or upgrade#

Environment Setup for Node.js web apps for Azure App Service

The instructions in this tutorial can be followed on any operating system that can run Node.js.

Below is the list of installation required

  • Node.js – Click here to install setup
    • Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.

  • Bower – Click here to install setup
    • Bower can manage components that contain HTML, CSS, JavaScript, fonts or even image files. Bower doesn’t concatenate or minify code or do anything else – it just installs the right versions of the packages you need and their dependencies.

  • Yeoman – Click here to install setup
    • Yeoman helps you to kickstart new projects, prescribing best practices and tools to help you stay productive.

      To do so, Yeoman provides a generator ecosystem. A generator is basically a plugin that can be run with the `yo` command to scaffold complete projects or useful parts.

  • Git – Click here to install setup
    • The Git is a Source Code Management (SCM).The Git feature that really makes it stand apart from nearly every other SCM out there is its branching model.

      Git allows and encourages you to have multiple local branches that can be entirely independent of each other. The creation, merging, and deletion of those lines of development takes seconds.

  • Azure CLI 2.0 Preview – Click here to install setup
    • Microsoft has improved and update Azure CLI to provide a great native command-line experience for managing Azure resources.
  • A Microsoft Azure account. If you don’t have an account, you can sign up for a free trial or activate your Visual Studio subscriber benefits.
  • Also we need to install
    • Install Azure SDK for Node.js: Use and manage your Azure resources with Node.js

      Get the SDK from npm:
      Use below command
      npm install azure

      &amp;amp;amp;amp;lt;a href=”https://www.olark.com/site/8335-828-10-8454/contact&#8221; title=”Contact us” target=”_blank”&amp;amp;amp;amp;gt;Questions? Feedback?&amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;gt; powered by &amp;amp;amp;amp;lt;a href=”http://www.olark.com?welcome&#8221; title=”Olark live chat software”&amp;amp;amp;amp;gt;Olark live chat software&amp;amp;amp;amp;lt;/a&amp;amp;amp;amp;gt;

O365, SPO, SP 2016, SP 2013: CSOM, JSOM – Custom Field Creation – Field Type

While creating a field, whether you are using CAML, server-side object mode, or one of the client-side object models, you typically specify the following attributes:

  • The ID of the fied, which is a GUID
  • The Name, which is the internal name of the field
  • The StaticName, which is the static name of the field
  • The DisplayName, which is display name of the field
  • The Type attribute which indicates the data type of the field

Below is the code for creating custom field using JSOM:

 

function addFields() {
var clientContext = new SP.ClientContext.get_current();
var oWebsite = clientContext.get_web();
//Getting reference to the list
oList = clientContext.get_web().get_lists().getByTitle(“List Name”);
// Get filed collection
var fldCollection = oList.get_fields();

var f1 = clientContext.castTo(fldCollection.addFieldAsXml(‘<Field Type=”Text” DisplayName=”Desc” Name=”Description” />’, true, SP.AddFieldOptions.addToDefaultContentType), SP.FieldText);

f1.update();
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed)
);
}

function onQuerySucceeded() {
alert(“List Field Updated”);
}

function onQueryFailed(sender, args) {
alert(‘Request failed. ‘ + args.get_message() + ‘\n’ + args.get_stackTrace());
}

This post gives you an overview of the different field types that you can create through CSOM or JSOM.

Create a Text field

A simple text field can be created as follows:

string schemaTextField = "<Field ID='<GUID>' Type='Text' Name='LastName' StaticName='LastName' DisplayName='Last Name' />";
Field simpleTextField = demoList.Fields.AddFieldAsXml(schemaTextField, true, AddFieldOptions.AddToDefaultContentType);
clientContext.ExecuteQuery();

Written like this, SharePoint will ignore the internal name you specified, and will apply the display name. To make sure your internal name is applied, you have to add the AddFieldOptions.AddFieldInternalNameHint:

string schemaTextField = "<Field Type='Text' Name='LastName' StaticName='LastName' DisplayName='Last Name' />";
Field simpleTextField = demoList.Fields.AddFieldAsXml(schemaTextField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

 

Creating a hidden field

If you want to create a hidden field, you have to include the hidden attribute and set it to true:

string schemaTextField = "<Field Type='Text' Name='LastName' StaticName='LastName' DisplayName='Last Name' Hidden='TRUE' />";
Field simpleTextField = demoList.Fields.AddFieldAsXml(schemaTextField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Omitting this attribute will create a field visible to your users.

You can also

Creating an indexed field

While creating a field, you can also index it.

Field f = list.Fields.GetByInternalNameOrTitle(fieldName);
clientContext.Load(f);
clientContext.ExecuteQuery();
f.Indexed = true;
f.Update();

clientContext.ExecuteQuery();

Create a multi line field

You can create different types of multi line fields:

  • a plain text field
  • a rich text field
  • an enhanced text field

A plain multi line text field

string schemaMultilineTextField = "<Field ID='<GUID>' Type='Note' Name='Comments' StaticName='Comments' 
DisplayName='Comments' NumLines='6' RichText='FALSE' Sortable='FALSE' />" 
Field multilineTextField = demoList.Fields.AddFieldAsXml(schemaMultilineTextField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

A rich multi line text field

string schemaRichTextField = "<Field ID='<GUID>' Type='Note' Name='Comments' StaticName='Comments'
DisplayName='Comments' NumLines='6'  RichText='TRUE' Sortable='FALSE' />" 
Field multilineTextField = demoList.Fields.AddFieldAsXml(schemaRichTextField , true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

An enhanced multi line text field

string schemaRichTextField = "<Field ID='<GUID>' Type='Note' Name='Comments' StaticName='Comments' 
DisplayName='Comments' NumLines='6' RichText='TRUE' RichTextMode='FullHtml' IsolateStyles='TRUE' Sortable='FALSE' />" 
Field multilineTextField = demoList.Fields.AddFieldAsXml(schemaRichTextField , true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Create a boolean field

In the SharePoint user interface this is called a Yes/No field.

string schemaBooleanField = "<Field Type='Text' Name='Married' StaticName='Married' DisplayName='Married' />";
Field booleanField = demoList.Fields.AddFieldAsXml(schemaBooleanField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

If you want to set a default value, you have to specify a 0 for false or a 1 for true:

string schemaBooleanField = "<Field Type='Boolean' Name='Married' StaticName='Married' DisplayName='Married'>"
    + "<Default>0</Default></Field>;
Field booleanField = demoList.Fields.AddFieldAsXml(schemaBooleanField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Create a DateTime field

A DateTime field is created in a similar way, but you can set additional properties, like the Format property. In case of a DateTime field, the format attribute will indicate whether you want to create a date only field, or a date time field.

Date only field

string schemaBirthDate = "<Field ID='<GUID>' Type='DateTime' Name='BirthDate' StaticName='BirthDate' 
   DisplayName='Birth date' Format='DateOnly' >"
   + "<Default>[Today]</Default></Field>";
Field birthDateField = demoList.Fields.AddFieldAsXml(schemaBirthDate, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

The Default node is optional. The sample code snippet indicates that today’s date will be suggested to the user. If nothing is specified, no date will be sugested to the user.

Date and time field

string schemaArrivalField = "<Field ID='<GUID>' Type='DateTime' Name='ArrivalDateTime' StaticName='ArrivalDateTime' 
   DisplayName='Arrival' Format='DateTime'>"
   + "<Default>[Now]</Default></Field>";
Field birthDateField = demoList.Fields.AddFieldAsXml(schemaBirthDate, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

As in previous code sample, the Default node is optional. This sample code snippet indicates that the current date and time will be suggested to the user. If nothing is specified.

Create a Number field

With this type of field, you have to specify the different choices on beforehand. You can also choose if you want to show the different options within a dropdown list or with radio buttons.

string schemaNumberField = "<Field ID='<GUID>' Type='Number' Name='NbrOfEmployees' StaticName='NbrOfEmployees' 
   DisplayName='Number of employees' />";
Field birthDateField = demoList.Fields.AddFieldAsXml(schemaBirthDate, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Previous code snippet will create a standard number field where the user can set positive and negative numbers, and where the number of decimals is generated automatically. If you want to declare a number field that only allows positive numbers, you will have to declare it this way:

string schemaPosNumberField = "<Field ID='<GUID>' Type='Number' Name='NbrOfEmployees' StaticName='NbrOfEmployees' 
   DisplayName='Number of employees' Min='0' />";

And if you want to restrict the range of values that can be entered by the user, you have to declare the number field the following way:

string schemaNumberField = "<Field ID='<GUID>' Type='Number' Name='NbrOfEmployees' StaticName='NbrOfEmployees' 
   DisplayName='Number of employees' Min='0' Max='5000'/>";

You can also define the number of decimals:

string schemaNumberField = "<Field ID='<GUID>' Type='Number' Name='NbrOfEmployees' StaticName='NbrOfEmployees' 
   DisplayName='Number of employees' Min='0' Decimals='0' />";

You can also create a percentage field by using the Number type. In that case you have to add an addition attribute Percentage, which you have to set to true:

string schemaPercentageField = "<Field ID='<GUID>' Type='Number' Name='NbrOfEmployees' StaticName='NbrOfEmployees' 
   DisplayName='Number of employees' Percentage='True' Decimals='2' />";

Create a Choice field

With this type of field, you have to specify the different choices on beforehand. You can also choose if you want to show the different options within a dropdown list or with radio buttons.

Dropdown list

string schemaChoiceField = "<Field ID='<GUID>' Type='Choice' DisplayName='Menu Choice' Name='MenuChoice' StaticName='MenuChoice' 
   Format='Dropdown'>"
   + "<Default>Meat menu</Default>"
   +         "<CHOICES>"
   +         "    <CHOICE>Fish menu</CHOICE>"
   +         "    <CHOICE>Vegeterian menu</CHOICE>"
   +         "</CHOICES>"
   + "</Field>";
Field choiceField = demoList.Fields.AddFieldAsXml(schemaChoiceField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Radio buttons

string schemaChoiceField = "<Field ID='<GUID>' Type='Choice' Name='DessertChoice' StaticName='DessertChoice' 
   DisplayName='Desserts' Format='RadioButtons'>"
   + "<Default>Ice cream</Default>"
   +         "<CHOICES>"
   +         "    <CHOICE>Fresh fruit</CHOICE>"
   +         "    <CHOICE>Sorbet</CHOICE>"
   +         "</CHOICES>"
   + "</Field>";
Field choiceField = demoList.Fields.AddFieldAsXml(schemaChoiceField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Checkboxes

When creating Choice fields  in the user interface, you also have the option to display checkboxes to allow more than one selection:

multichoice

To achieve this in code you have to set the Type attribute to MultiChoice. Of course, don’t specify the Format attribute.

string schemaChoiceField = "<Field ID='<GUID>' Type='MultiChoice' Name='SideDishesChoice' StaticName='SideDishesChoice' 
   DisplayName = 'Side dishes' >"
   + "<Default>Patatoes</Default>"
   +         "<CHOICES>"
   +         "    <CHOICE>Fresh vegetables</CHOICE>"
   +         "    <CHOICE>Beans</CHOICE>"
   +         "    <CHOICE>Pepper Sauce</CHOICE>"
   +         "</CHOICES>"
   + "</Field>";
Field choiceField = demoList.Fields.AddFieldAsXml(schemaChoiceField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Fill In option

To allow users to fill in a different choice than already available, you have to add the FillInChoice attribute. If that attribute is omitted in the XML,  users will only be able to choose from the available options.

string schemaChoiceField = "<Field ID='<GUID>' Type='Choice' DisplayName='Menu Choice' Name='MenuChoice' StaticName='MenuChoice' 
   Format='Dropdown' FillInChoice='TRUE'>"
   + "<Default>Meat menu</Default>"
   +         "<CHOICES>"
   +         "    <CHOICE>Fish menu</CHOICE>"
   +         "    <CHOICE>Vegeterian menu</CHOICE>"
   +         "</CHOICES>"
   + "</Field>";
Field choiceField = demoList.Fields.AddFieldAsXml(schemaChoiceField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Create a Picture field

If you want to create a picture field, you have to set the field type to URL. An additional attribute Format will indicate that you want to create a picture field:

string schemaPictureField = "<Field ID='<GUID>' Type='URL' Name='EmployeePicture' StaticName='EmployeePicture' 
   DisplayName='Employee Picture' Format='Image'/>";
Field pictureField = demoList.Fields.AddFieldAsXml(schemaPictureField, true, AddFieldOptions.AddInternalNameHint);
clientContext.ExecuteQuery();

Create a URL field

If you want to create a field to contain an hyperlink, you also have to define a field of type URL, but in that case you set the Format attribute to Hyperlink:

string schemaUrlField = "<Field ID='<GUID>' Type='URL' Name='BlogUrl' StaticName='BlogUrl' DisplayName='Blog URL' Format='Hyperlink'/>";
Field urlField = demoList.Fields.AddFieldAsXml(schemaPictureField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Create a Lookup field

You typically create a lookup field when the value needs to be looked up in another SharePoint list. When creating a Lookup field, you also need to specify the necessary attributes to indicate the lookup list and the field that is shown when a value is selected:

string schemaLookupField = "<Field ID ='<GUID>' Type='Lookup' Name='Country' StaticName='Country' DisplayName='Country' 
    List='Countries' ShowField='Title' />"
Field lookupField = demoList.Fields.AddFieldAsXml(schemaLookupField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

If you want to show another field from the lookup list, instead of the Title, you can set the ShowField attribute to another field.

You can also define how the relationship with the lookup field must behave.  But in that case the field needs to be indexed:

string schemaLookupField = "<Field ID ='<GUID>' Type='Lookup' Name='Country' StaticName='Country' DisplayName='Country' 
    List='Countries' ShowField='Title' RelationshipDeleteBehavior='Restrict' Indexed='TRUE'/>"

If you want to create a multi-select lookup field, you have to use the type LookupMulti, and you have to set an additional attribute Mult (and not Multi):

string schemaMultiLookupField = "<Field ID ='<GUID>' Type='LookupMulti' Name='Country' StaticName='Country' DisplayName='Country' 
    List='Countries' ShowField='Title' Mult='TRUE'/>"

Create a User field

A field of type User is defined as follows:

string schemaUserField = "<Field ID ='<GUID>' Type='User' Name='Employee' StaticName='Employee' DisplayName='Employee' />"
Field userField = demoList.Fields.AddFieldAsXml(schemaUserField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

You can set different attributes:

  • UserSelectionMode: this attribute can be set to PeopleOnly or to PeopleAndGroups
  • UserSelectionScope: this attribute can be set to limit the selection of possible users to a certain group. The value must be an integer value that indicates the ID of group

Following code sample defines a user field that allows selection of multiple users from the site member group:

string schemaUserField = "<Field ID ='<GUID>' Type='UserMulti' Name='Employee' StaticName='Employee' DisplayName='Employee' 
   UserSelectionMode='PeopleOnly' UserSelectionScope='7' Mult='TRUE'/>"

Create a Managed Metadata field

The creation of a managed metadata field requires a bit more than just defining the CAML. I’ll add it here for completeness, but credits are for Waldek Mastykarz with his post Programmatically creating Site Columns and Content Types using the App Model

string schemaTaxonomyField = "<Field ID ='<GUID>’ Type='TaxonomyFieldType' Name='ProductCategory' StaticName='ProductCategory' 
    DisplayName='ProductCategory' />"
Field field = demoList.Fields.AddFieldAsXml(schemaTaxonomyField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Of course, this is not enough; you also have to bind this field to a termset or term in the term store:

Guid termStoreId = Guid.Empty;
Guid termSetId = Guid.Empty;
GetTaxonomyFieldInfo(clientContext, out termStoreId, out termSetId);
 
// Retrieve the field as a Taxonomy Field
TaxonomyField taxonomyField = clientContext.CastTo<TaxonomyField>(field);
taxonomyField.SspId = termStoreId;
taxonomyField.TermSetId = termSetId;
taxonomyField.TargetTemplate = String.Empty;
taxonomyField.AnchorId = Guid.Empty;
taxonomyField.Update();
 
clientContext.ExecuteQuery();

In case you want to create a multi-select managed metadata field, you have to define a field of type TaxonomyFieldTypeMulti.

Create a Calculated field

Calculated fields can be created in a number of flavors. The following code snippet generates a calculated field that will show employee data based on the fields FirstName, LastName and EmployeeID. It will be formatted as follows:

Karine Bosch (id 82176)

string formula = "<Formula>=FirstName&amp; \" \" &amp;LastName&amp; \" (id: \" &amp;EmployeeID&amp; \" \"</Formula>"
      + "<FieldRefs>"
      + "<FieldRef Name='FirstName' />"
      + "<FieldRef Name='LastName' />"
      + "<FieldRef Name='EmployeeID' />"
      + "</FieldRefs>";

string schemaCalculatedField = "<Field ID='<GUID>' Type='Calculated' Name='FullName' StaticName='FullName' 
   DisplayName='Full Name' ResultType='Text' Required='TRUE' ReadOnly='TRUE'>" + formula + "</Field>";
Field fullNameField = demoList.Fields.AddFieldAsXml(schemaCalculatedField, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Another example is a field that defaults to the year number of todays’ date. In this case the element <DefaultFormula> is used within a Text field:

string fieldXml = "<Field DisplayName='Year' Type='Text'>"
   + "<DefaultFormula>=CONCATENATE(YEAR(Today))</DefaultFormula>"
   + "</Field>";
Field field = list.Fields.AddFieldAsXml(fieldXml, true, 
    AddFieldOptions.defaultValue);
context.ExecuteQuery();

Interview Question and Answer – SharePoint 2013 , SharePoint 2016 and SharePoint Online

What does the content database handles in SharePoint?

The SharePoint database handles

  • Published reports
  • Reports models
  • Shared data sources
  • Properties
  • Resources
  • Permissions

Explain how to manage projects in SharePoint?

To manage projects SharePoint offers many facilities like

  • Dashboards: The dashboards consist of customs KPIs; reports and graphs give you status updates at a glance
  • Scheduling tools: Update and assign multi-level tasks from a Gantt view calendar
  • Personalization: Filter out projects and tasks that don’t affect your project
  • Resources: It is helpful in tracking cost, display availability and report of hours worked
  • Alerting: Keep team alert about various activities related to project and to remind about various important meeting and seminars

What query string element enables a client webpart to talk back to the parent?

1.Such communication is not allowed due to security
2.ParentId
3.OwnerId
4.SenderId

Answer: 4


What JavaScript library makes it possible to load SharePoint branding in Provider Hosted Apps?

1.ChromeControl.js
2.js
3.UI.Controls.js
4.Controls.js

Answer: 3


Which of the following is accurate?

1.The PFX cert is required by the App and the CER cert is needed by SharePoint
2.Both SharePoint and the App need the CER and PFX cert
3.The PFX cert is required by SharePoint and the CER cert is needed by the App
4.Both SharePoint and the App need the PFX cert

Answer: 1


How does SharePoint send context details to a SharePoint App?

1.Cookies
2.A Post request
3.Query String
4.None of these

Answer: 3


What query string element strips out the chrome of a SharePoint page?

1.IsDialog
2.Dialog
3.Dlg
4.IsDlg

Answer: 4

 


JavaScript Cross Domain calls in SharePoint need.

1.A Certificate and IssuerID
2.An AppWeb
3.CSOM
4.REST API

Answer: 2


How does a provider hosted app adopt the SharePoint page’s look and feel?

1.It uses the SharePoint master page
2.It uses the Chrome Control
3.This is not possible since the provider hosted app is a completely different app
4.You have to manually copy over SharePoint’s _layouts folder to the App

Answer: 2


The .app file is

1.A 7z file
2.A rar file
3.A zip file
4.A cab file

Answer: 3


Your SharePoint server is hosted on http://sp.yourcompany.com. Which of the following is an invalid App URL?

1.http://apps.sp.yourcompany.com
2.http://myapps.yourcompany.com
3.http://mycompanyapps.com
4.http://ws-949121A.yourcompany.com

Answer: 1


Every App needs an App Web

1.true
2.false

Answer: 2


Apps run on the SharePoint Server

1.false
2.True

Answer: 1


Which Powershell command do we use to generate and register an issuerid?

1.New-SPTrustedSecurityIssuerID
2.New-SPTrustedSecurityTokenIssuer
3.New-SPTrustedTokenIssuer
4.New-SPTrustedIssuerID

Answer: 2


Sandbox solutions in SharePoint 2013 are,

1.Encouraged to be used
2.Disabled completely
3.Deprecated
4.Still supported, but user code is deprecated

Answer: 4


What control allows a SharePoint Page to be shown in an IFRAME?

1.It is not possible to embed SharePoint pages in an IFRAME
2.WebPartPages:AllowFraming
3.No control is necessary, you can embed pages at will.
4.FramePages:WebPartPage

Answer: 2


Provider Hosted Apps have a predictable URL

1.false
2.true
3.true except for autohosted apps
4.false in all scenarios

Answer: 3


Custom editors for Client WebParts ..

1.Inherit from EditorPart
2.You cannot write custom editors
3.You can do limited editing capability using CAML
4.Client WebParts are not supposed to be edited

Answer: 3


In provider hosted apps, one Issuer ID can be setup for hosting multiple client s/apps?

1.True
2.False

Answer: 1


Which file Provider Hosted App Visual Studio project, makes developer work little bit easier? So, how do we authenticate our app to SharePoint? The underlying mechanics of that are somewhat complicated, so they visual studio made developer lives easier by giving us this file?

1.cs
2.xml
3.Config
4.xml

Answer: 1


SharePoint-hosted apps, they can work with FBA, but they can’t work with Claims, or ADFS, or Azure ACS?

1.True
2.False

Answer: 1


During development of Provider Hosted Apps, client ID generated is mentioned in two places?

1.xml, machine.config
2.xml and Web.config
3.xml and Manifest.xml
4.config and Machine.config

Answer: 2


What API do Apps use?

1.REST
2.CSOM
3.Server side API
4.REST and CSOM

Answer: 4


How can you create a ClientContext?

1.Using the constructor
2.By calling ClientContext.get_Current()
3.By calling ClientContext.Current
4.All of the above

Answer: 4


What is the preferred URL for REST API in SharePoint 2013?

1._api
2.svc
3./_vti_bin/_api
4./_vti_bin/listdata.svc

Answer: 1

 


What method in CSOM allows you to make a round trip to the server?

1.$.ajax
2.ExecuteQuery
3.$.get
4.$.getJSON

Answer: 2


Where will you find the necessary DLL references for a thick client CSOM client?

1.ISAPI folder
2.on MSDN
3.BIN folder
4.Layouts folder

Answer: 1


Which of the following requires a Form Digest?

1.DELETE
2.PUT
3.POST
4.All of the above

Answer: 4


Which one of the below helps in concurrency handling?

1.None of the above
2.Promises
3.Try Catch
4.Object Identity

Answer: 4


How does CSOM authenticate when not running as an App?

1.It is preauthenticated
2.It uses the user’s identity
3.It asks the user to enter a username/password
4.It works in anonymous mode

Answer: 2


What serialization formats are used with REST in SharePoint?

1.ATOM and JSON
2.JSON and OData
3.ATOM And OAuth
4.None of the above

Answer: 1


Which version of SharePoint was CSOM introduced in?

1.2013
2.2007
3.2010
4.2003

Answer: 3


How do you specify last-in-wins concurrency checks?

1.Don’t specify ETag
2.Set ETag to *
3.Set ETag to 0
4.Set Etag to “”

Answer: 2


What facility in REST API helps you deal with concurrency issues?

1.Object Context
2.client Context
3.$.get
4.eTAG support

Answer: 4

Connect PHP with MySQL and display data rows into HTML table

MySQL Database having table name “emp” has records as below,

mysqldb_emp

Below is the source code to connect PHP with MySQL:

<!DOCTYPE html>
<html>
<?php
mysql_connect(“localhost”, “root”, “”) or die(mysql_error());
mysql_select_db(“Employeedb”) or die(mysql_error());
$data = mysql_query(“Select * from emp”)
or die(mysql_error());

while($row = mysql_fetch_assoc($data))
{

echo “<table style=’border: 1px solid black; width:40%’>
<tr>
<td style=’border: 1px solid black; width:20%’>”.$row[“EmpID”]
.”</td>
<td style=’border: 1px solid black;’>”.$row[“EmpName”]
.”</td>
</tr>
</table>”;

}
?>
</html>

Below is output:

phpemppage

O365 SPO: Angular JS based APPS – Business Card development

Requirement

Seamless Business Card development based on the available metadata of SharePoint User Profile on O365.

angular-js-based-apps-demo

Solution

Based on the above requirement there are various way to implement the same. Based on my past experience and availability of light weight technologies, I have opted Angular JS based solution, Principal Architecture of the same is as depicted below,

architecture-for-apps-model-for-angular-js-based-solution

A, B and C: Reperesents deployment of the Azure AD Connect tool (DirSync) on a virtual machine in Azure to synchronize accounts between your on-premises directory and your Azure AD tenant with Office 365

D: Reperesents Azure (the DirSync server) synchronizing on-premises AD DS to Office 365

E: O365 tenant available with you

F: User Profile metadata for a specific user

G: Depicts the view – HTML – It binds the data provided by the H and I

H and I: Model and Controller for Angular JS – consists of the all functions and https REST API call implmentation – This is also responsible to load the data to the collection objects

J: Binding of data

K: Referencing the Model to connect with View and Controller – All files are deployed to Document Library

L: REST API – http GET call to fetch the item from user profile services of O365