Three steps to activate Bot features within SharePoint Framework

Check out video “Three steps to activate Bot features within SharePoint Framework

ActivateBotFeatureswithinSharePointFramework_960

Advertisements

Get | Resolve Term ID for Term Value in SharePoint Metadata Service

This may be generic function you can use when you play with managed metadata (taxonomy) columns or with Managed Managed Metadata Service.

Notes:

  • Used JSOM since no impletation in REST API to get done this task in SharePoint to date of post
  • Passing term set ID is must since there may may be many term values equivalent in the term store
  • For the example, I have retrieved the term set ID from the list field which glued with the managed metadata service.

Following code illustrate how to get term ID for term value provided.


// Resolve Term ID for the Term Value 
 function getTermIdForTermValue(siteUri, listName, fieldName, termValue) {
 //Define
 var deferred = $q.defer()
 , termId;
 var clientContext = new SP.ClientContext(siteUrl);
 var list = clientContext.get_web().get_lists().getByTitle(listName);
 //Tx field
 var field = list.get_fields().getByInternalNameOrTitle(fieldName);
 var txField = clientContext.castTo(field, SP.Taxonomy.TaxonomyField);
 //load context
 clientContext.load(field);
 clientContext.load(txField);
 // //excute async of context
 clientContext.executeQueryAsync(
 //Success on Async
 Function.createDelegate(this
 , function () {
 //Getting term set of the field
 var termSetId = txField.get_termSetId().toString();
 var tSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(clientContext);
 var ts = tSession.getDefaultSiteCollectionTermStore();
 var tset = ts.getTermSet(termSetId);
 //Define term label to match
 var lmi = new SP.Taxonomy.LabelMatchInformation(clientContext);
 lmi.set_lcid(1033);
 lmi.set_trimUnavailable(true);
 lmi.set_termLabel(termValue);
 var termMatches = tset.getTerms(lmi);
 //context loading with taxanomy values
 clientContext.load(tSession);
 clientContext.load(ts);
 clientContext.load(tset);
 clientContext.load(termMatches);
 clientContext.executeQueryAsync(
 function () {
 if (termMatches && termMatches.get_count() > 0) {
 termId = termMatches.get_item(0).get_id().toString();
 console.log("Resolved Term Id for Term " + termValue, termId);
 deferred.resolve(termId);
 }
 else {
 console.log("No IDs to resolved for Term " + termValue);
 deferred.resolve(null);
 }
 }
 , function (sender, args) {
 console.log("Error on resolving term ID", args);
 deferred.reject(null);
 });
 }
 , function (sender, args) {
 console.log(args.get_message() + '\n' + args.get_stackTrace());
 })
 //Failed on Async
 , Function.createDelegate(this, function (err) {
 console.error(err.get_message());
 })
 );
 return deferred.promise;
 }

Click here to view in gist.

For more details refer following links;

SharePoint framework dev startup | npm generating | Yeoman scaffolding

This will be first step towards developing on SharePoint Framework. You will use npm to manage the packages and Yoeman for generate SharePoint framework.

#check for existence of Node.js; install if following not returns version
node -v 

#install Yeoman
npm install -g yo

#install generator
#Office template https://github.com/officedev/generator-office
npm install -g generator-office

#move to your working folder or create folders if required
cd D:\location
mkdir "Folder Name"

#Yeoman console..and pick your generator..it should be office generator
yo
#Or else directly call callout below
yo office

After execution of above code your can select default selections and also able to provide customized values if required.

You can be used either Powershell or Cmder. But I prefer Cmder since it gives better experience if your are a windows user. But for other OS users, you can pick as you wish.

Note: Now, your source template is generated(scaffolded) and can be startup editing with any favorite code editor such as  VS, VS code, Sublime, NotePad++ or any.

 

#SPTechInspirit #1 What | Why SharePoint

As first post on this series, though of starting from the elementary basics which are what and why. Briefly post will be focusing on below;

What is SharePoint?

Why SharePoint?

Why need SharePoint rather than moving to developing from the scratch approach? 

SharePoint is a platform for developers and professionals where mostly focuses on business content.

SharePoint serve as a platform you to design and develop business solutions.

Currently SharePoint available as both On-promise (Host SharePoint locally) and subscription based service (Office 365)

Main advantage if you moved to develop with SharePoint is its OOTB (Out of The Box) features it contains. As a example, if you develop with other development model you may need to develop and concentrate on authentication, administration, deployment, maintenance and etc. But In the SharePoint it ready made, you need to concentrate on those minimally.

 

SharePoint History | Versions

Microsoft have released six versions of SharePoint (On Premise) with differentiated enhancements and features.

Year Core infastructure SharePoint Version
2001 SharePoint Team Services SharePoint Portal Server 2001
2003 Windows SharePoint Services 2.0 Microsoft SharePoint Portal Server 2003
2007 Windows SharePoint Services 3.0 Microsoft Office SharePoint Server 2007
2010 Microsoft SharePoint Foundation 2010 Microsoft SharePoint Server 2010
2013 Microsoft SharePoint Foundation 2013 Microsoft SharePoint Server 2013
2016 Not distribute separately and compatible with Foundation 2013 Microsoft SharePoint Server 2016

SharePoint 2001 was the first version which only capable of perform data driven actions such as sites, list, document libraries. This was build on top of SQL Server database.

SharePoint 2003 was first version which built on .NET framework and ASP.NET and first which enabled developers to developers add custom solutions.

SharePoint 2007 introduced site columns, content types, features, master pages, user controls, navigation, authentication and which architectural changes.

SharePoint 2010 introduced with more user experience with server side ribbon, model dialog, async JavaScript, AJAX

SharePoint 2013, introduced with further user experience. This is the last version which supported with InfoPath forms. Parallel to this, Microsoft Introduced the online (cloud) version of the SharePoint.

SharePoint 2016, additional features with more responsive and better user experience. Microsoft Flow, Power Apps, more document management features, business intelligence features and etc introduced herewith.