Skip to main content

Posts

Showing posts with the label RestAPI

Power Automate and Team Sites

W e can create Team Sites using Power automate. Use “Send HTTP Request to SharePoint” action for creating team site. To create Modern Team Site (No Group) We need to make a call to “/_api/SPSiteManager/create” end point. SiteDesignID parameter is optional. Your call should look like below when action is created.     Modern Team Site (Linked to a Group) We need to make a call to “_api/GroupSiteManager/CreateGroupEx” end point. Ensure to pass implicit formula parameter something like below. ["implicit_formula_292aa8a00786498a87a5ca52d9f4214a_7c13ef32-45f0-4282-a3c7-2d05ff0a9189"] Your call should look like below when action is created.   Thanks, Keyur Pandya

Site Design Tasks, Power Automate and Modern Sites

S harePoint Site templates are now replaced with Site designs in Modern Sites. We can create custom site designs using some json script(s). Site Design allows to create lists, create list views, apply theme, customize navigation, create content types, create site columns and so on. Click here to see JSON scheme reference for creating custom site design.  Endpoint to apply site design as a part of flow is as below. _api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility.AddSiteDesignTaskToCurrentWeb We must use “Send Http Request to SharePoint” action to make an API call to SharePoint. SiteDesignId must be part if body, this is GUID of the SharePoint site design you need to apply. We can line up sequence of calls if we need to apply multiple site designs to a single site. We can now wait for few mins and all our sited designs will get applied or we can also check the status by making another API call with below endpoint. You just need to pass the Apply Design ta

Custom Connector Deployment

In continuation to my previous blog on custom connector . Here is the blog on how to deploy connector to a new environment. To move custom connectors from one environment to another. We have to perform 3 different actions. 1.        Adding connectors to Solutions. 2.        Exporting solutions   3.        Importing solutions in new environment. Click here to visit Power Automate Portal. Login with admin user credentials.         •    Click on the “Solutions” tab on the left panel. Please refer image below.     Note: Custom connectors created outside solutions cannot be added to solutions at this time.   Adding a connector to a solution To add Custom Connector to Solutions below steps are to be followed. •        Click on New Solution on top ribbon. Enter necessary details like solution name, version and so on and click on “Create” button.   •        You should be able to see the newly created solution on the top. You can click and open

Power Automate Customer Connectors

Recently I came across a requirement to create an interface between SharePoint and 3rd party project management tool. Click here  login with your Ofice365 account. Click on Data > Custom Connector menu option from left navigation pane. Click on "New Custom Connector" from top right corner. Select Create from blank. You can now see a new connector creation screen. General Tab Provide the host URL and API end point URL. Click on "Security" tab select the authentication method that the source tool is using. Security Tab Based on your selection rest of the input controls will be be shows, Lets assume you have selected 0Auth 2.0. You should now see columns like  Client ID : is id from app registered in project management tool to consume API.  Client Secret : is a secret key generated by the source from where you are to consume API. Authorization URL : is token generation endpoint URL.  Token URL : is Refresh token URL. Scope : Specify if the API documentation has

Fetch outlook Calendar Events in SharePoint Webpart

Today I came across a requirement to get outlook events to SharePoint custom webpart. Thanks to Graph API to ease the work. Here are the steps that we need to follow in order to get events. 1. Register a new app in Azure Active Directory . Here is the blog that i referred. 2. Now its time to get access token using generated client id and secret in previous step. Execute below code to get access token. $.ajax({     type: "POST",     crossDomain: true,     url:       "https://cors-anywhere.herokuapp.com/https://login.microsoftonline.com/<Tenant ID>/oauth2/v2.0/token",     headers: {       "content-type": "application/x-www-form-urlencoded"     },     data: {       grant_type: "client_credentials",       client_id: "", //ClientId@TenantId       client_secret: "",//Client Secret       scope: "https://graph.microsoft.com/.default"     },     s

Uploading multiple files to SharePoint List

Wow SharePoint is doing great with SharePoint rest api now you can do almost everything related to SharePoint using rest api. Today I am trying to upload multiple documents to SharePoint list item. You know what the problem is? You first need to create a SharePoint list item and then you can upload documents to the same SharePoint list item. So let’s now try to create a new SharePoint list item. function CreateNewItem() {     var data = {         __metadata: { 'type': "SP.Data.ListItem" },         Title: $('#Title').val()     };     $.ajax({         //_spPageContextInfo.webAbsoluteUrl get current SharePoint site url         url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('" + ListTitle + "')/Items",         type: "POST",         headers: {             "accept": "application/json;odata=verbose",             "X-RequestDigest": $("#__REQUESTDIGEST").val