Posts

Showing posts from June, 2020

Get All content types from ContentTypeHub using SharePoint Rest API v2 using JavaScript

Why get the content type from Content Type Hub(CTH )? Content Type Hub is a centralized location where we manage and publish content types to other web applications. Content Type Hub is actually a Site Collection.  "In simple words, it is one place where you get to manage all the content type present in a tenant." To get all the Content Type from ContentTypeHub using REST API V2.* becomes easy now. It involves only the following two steps: Get the site ID of the ContentTypeHub https:// {YourtenantURL} /sites/contentTypeHub/_api/site Get all content types https:// {YourtenantURL} /_api/v2.1/sites/ {siteID of ContentTypeHub} /contentTypes Step 1: I am g etting the site ID of the ContentTypeHub by calling the REST API. As this is still from V1.0 endpoint, after  '/api'  , there is no need to mention the endpoint version.  In the success method, I am calling the method  getAllContentTypes  which will get the content types. var  siteURL=_spPageContextInfo.s...

How To Add Custom CSS File In SharePoint Framework Projects And Reference It In Your Component

Image
Introduction If you are working on classic SharePoint site, you know it is easy to refer to a CSS file or use inline CSS in the same file. In SPFx projects, you will have SCSS files created by default, which are similar to CSS files but with added capabilities, such as variables, nested rules, and mixins. There are cases you will have to refer to the custom CSS file. This article will help you how to add a custom CSS in your SPFx projects. Installation So, first, let’s start by installing the two loaders that help in loading the custom CSS files. Run the below commands in the terminal/ in the node command prompt. CSS-loader           npm install --save-dev css-loader Style-loader           npm install style-loader --save-dev It's recommended to combine style-loader with the css-loader. Or, you could install them in one go, npm install css-loader style-loader --save-dev Adding a .css file ...

Send Email To SharePoint Groups From MS Flow

Image
If you are working on SharePoint, you know it is easy to send an email to SharePoint groups through SPD/Nintex workflows, because these are the apps related to SharePoint which know the SharePoint context. On the other hand, MS Flow is a separate Office 365 app and independent of SharePoint but this also helps in automating the workflows. However, here comes the issue. MS Flow can recognize the O365 users but there is no straightforward way to get the SharePoint group users from the dynamic data.   There are different ways to achieve this solution. In one of the articles I read online, the user did a REST call to get all the group users from the group and had to use for each loop to get all the users' email ids in a variable. Then, the author used the variable to send an email. But I found the following way very simple and time-saving.   In short, we are going to send an email via SharePoint Rest API by hitting  "/_api/SP.Utilities.Utility.SendEmail"   pointing to se...

Face API Using MS Flow

Image
The Azure Cognitive Services Face API provides algorithms that are used to detect, recognize, and analyze human faces in images. The ability to process human face information is important in many different software scenarios. Example scenarios are security, natural user interface, image content analysis and management, mobile apps, and robotics. In this example, we will see that when a user uploads an image in the document library, the MS flow will be triggered and sends an email about the analysis of the image.   Steps to create the Face API resource in the Azure portal   If you do not have an Azure subscription, create a  free account  before you begin.   Step 1   Login to your Azure account. Click "Create a resource" and select “AI + Machine Learning”. Then, select “Face" as shown in the image.     Step 2   On the Create page, provide the following information.   Name A descriptive name for your cognitive services resource. ...

Create And Deploy Outlook Add-Ins Using SPFx 1.10

Image
These are simple steps to create your first Outlook add-in from the SharePoint framework 1.10 version. The integration of SharePoint Framework lets you use all of the tools of SPFx, including access to Graph APIs, along with the rich, native JavaScript APIs that are available across applications. Please note that it is still in Preview mode.   Prerequisites Node version 10 LTS Latest Yeoman and gulp Visual studio code For more details, Please follow check Microsoft docs for  Setting up your SharePoint Framework development environment .   Development Steps Run the following command:   yo @microsoft/sharepoint --plusbeta   For the below question, select yes, as the solution needs to be deployed, tenant scoped.    Do you want to allow the tenant admin the choice of being able to deploy the solution to all sites immediately without running any feature deployment or adding apps in sites?  Y   Select the framework you would want to use. I preferre...