Using HTTP Call/ Rest API from SharePoint Designer workflow to create list

In this post, i will show how to call http/rest API using SharePoint Designer workflow to create new task List.

Open SharePoint Designer.

Create a workflow and add the below steps.

  1. Set variable RESTUrl of type string with value as workflow context – current site url and append _api/web/lists.http8
  2. Build Dictionary, add two string variables(Accept – Type String – Value as application/json;odata=verbose) and Content-Type as another variable with type string and value as application/json;odata=verbosehttpcall1output to variable requestHeaders.
  3. Add one more step, build dictionary, add variable name as type and type as String with value SP.List as below.httpcall2output variable to metadata.
  4. Add another Dictionary with variables below.httpcall3.PNGoutput variable to parameters.
  5. add variable like __metadata of type dictionary and choose workflow variable and choose variable metadata.httpcall3
  6. note: metadata variable should have two underscores, BaseTemplate as type Integer with value 107. In my case 107 is task list check for others if you want to create other list types, Description as type string and value as some description. Title as type string as per your need.
  7. Add step call http web service as below and change the variable like below.
  8. http4
  9. right click on the step and choose properties and change as needed. change request type to POST
  10. http5
  11. http6http7
  12. Log response code to see if any error comes out. Now trigger the workflow.

Make sure that you have enough permissions to run the workflow. if you face access related errors activate the feature workflow can use app permissions and register the workflow like below

https://docs.microsoft.com/en-us/sharepoint/dev/general-development/create-a-workflow-with-elevated-permissions-by-using-the-sharepoint-workflo 

Thats all.

Advertisements

Integrate Microsoft Sway with SharePoint Online

In this post, I’m going to show how to integrate Microsoft Sway with SharePoint Online site.

Its just as simple as it is.

Create your Sway with your own design.

Design SwayDesign sway1

Once designed, click on share button for options. choose get embed code and copy to notepad.

Get Embed code

 

embeded code

Go to SharePoint Online site, Add Content Editor web part to any of the pages, choose source code and paste the above embed code in that. That’s all

Sharepoint_Content Editor

 

Item level permissions using Microsoft Flow

Microsoft Flow is a licensing tool which is used to automate the tasks and workflows.

In this post, as a beginner, I will tell you how to set item level permissions on SharePoint List and make it recurrence to run daily over a period of time.

One of the most interesting feature is we can set recurrence/trigger the flow and make it run like a timer job to run/schedule sequence of steps where as using SharePoint Designer we cannot set the timer and need an action (add/edit) to execute the workflow.

I have a requirement for a SharePoint Tasks list items to lock down /set read only permissions over items based on date created. so, Lets start how to achieve this using Microsoft Flow.

  1. Login to the MS Flow (https://us.flow.microsoft.com)
  2. Under MyFlows choose create from blank.Flow from blank
  3. search for Recurrence and add Schedule Recurrence step and name the flow.add a trigger.png
  4. Add a schedule as per your need.recurrence step
  5. Add Get Items steps and provide the details below to get items from the SharePoint Site and List with optional Filter Query. In my case I just added Created date less than or equal to today date. you can still add more expressions/dynamic content.filter query
  6. Add apply to each step by click more with ellipses button.apply to each step
  7. choose value as output and one condition in apply to each choose dynamic conditions if any as per your need. I have added ID is greater than 1 condition just for example.value
  8. Under yes branch, add HTTP Condition. For this you need few parameters from the tenant along with App Registration.
  9. Just follow this link for getting those parameters using PostMan.
  10. After getting all the parameters,Get Access Token
  11. Parse the json code from the access token reply. Add this step. Choose the Data Operations action – Parse JSON. add the dynamic condition Body from the requestParse JSON from Get Access Token
  12. Copy this to schema.
     
    
    {
    "type": "object",
    "properties": {
    "token_type": {
    "type": "string"
    },
    "expires_in": {
    "type": "string"
    },
    "not_before": {
    "type": "string"
    },
    "expires_on": {
    "type": "string"
    },
    "resource": {
    "type": "string"
    },
    "access_token": {
    "type": "string"
    }
    }
    }
  13. Add one more step of HTTP to get access token as below.
  14. get token
  15. Add Parse JSON step, paste this script under schema
  16. {
    "type": "object",
    "properties": {
    "odata.metadata": {
    "type": "string"
    },
    "odata.type": {
    "type": "string"
    },
    "odata.id": {
    "type": "string"
    },
    "odata.editLink": {
    "type": "string"
    },
    "Id": {
    "type": "number"
    },
    "IsHiddenInUI": {
    "type": "boolean"
    },
    "LoginName": {
    "type": "string"
    },
    "Title": {
    "type": "string"
    },
    "PrincipalType": {
    "type": "number"
    },
    "Email": {
    "type": "string"
    },
    "IsEmailAuthenticationGuestUser": {
    "type": "boolean"
    },
    "IsShareByEmailGuestUser": {
    "type": "boolean"
    },
    "IsSiteAdmin": {
    "type": "boolean"
    },
    "UserId": {
    "type": "object",
    "properties": {
    "NameId": {
    "type": "string"
    },
    "NameIdIssuer": {
    "type": "string"
    }
    }
    }
    }
    }
  17. Add HTTP condition for Breaking Permissions.
  18. break permission
  19. Add another HTTP Condition to set permission.
  20. set permission
    Permissions level Role ID
    Full Control 1073741829
    Contribute 1073741827
    Read 1073741826
  21. Thats all save your flow and test the flow. verify your list items permission by selecting the item ECB Menu.

Please feel free to comments if you have any doubts.

Information Management Policy Settings / Retention Stage not working for SharePoint Online

Check for “Library and Folder Based Retention” feature under top level site features and activate.

You can enable and add retention stage over List/Library under settings to schedule policy and action over a period of time. for eg, after 30 days of creation date, you can start the workflow to trigger, move to recylcebin, permanently delete the document/list etc.

There are two timer jobs behind the scenes which will run on weekly basis.

For SharePoint On Premise, restart the below timer jobs to make it working.

  1. Expiration Policy.
  2. Information management policy.

For SPO/SharePoint Online we don’t have control over this timer jobs to restart rather need to wait till timer job executes and no other way and will run weekly mostly Monday or Tuesday and depends on timezone.

You can check the last execution date of these timer jobs using SharePoint Designer.

Open the root SharePoint Online site and check for dates for the below two properties from top Ribbon Site Options.

dlc_policyupdatelastrun

dlc_expirationlastrun

Site Options

As SharePoint Admin, what to do while SQL Server In Place Upgrade from 2005 to 2008 R2

Just wondering what to do with SharePoint while you are performing SQL Server Upgrade?

The purpose of this post is, As a SharePoint Admin/SharePoint stand, what to do while SQL is undergoing maintenance for upgrade.

Checklist to perform for SQL Server In Place Upgrade with in SharePoint & SQL Server:

  1. Backup the SharePoint Site, Content DB as a safe side.
  2. Log on to SharePoint Farm Servers and Stop all the SharePoint related services/applications from IIS Server.

SharePoint_StopApplicationPool

SharePoint_StopSites3. Perform  SQL Upgrade from Installation Media.

SharePoint_SQL_InPlaceUpgrade

Sharepoint_SQL_InPlaceUpgrade1

Sharepoint_SQL_InPlaceUpgrade2

SharePoint_SQL_InPlaceUpgrade3

SharePoint_SQL_InPlaceUpgrade4

SharePoint_SQL_InPlaceUpgrade5

Now go to SQL Server 2008 R2 from start menu. You will be asking for customized user settings options.

38

Choose Yes to import settings from previous version.

Sharepoint_SQL_InPlaceUpgrade64. Once Upgrade is complete, start the services and application pools related to SharePoint.

5. Validate the Site to check the upgrade process impact on SharePoint.

6. You may need to rerun the full crawl for SharePoint Search in order to properly work.

7. Verify SQL Server related services in Services.msc, Start Menu, Configuration Manager etc.

8. Verify all the Content DB and DBs are able to access with SQL Server 2008 R2.

I also prefer to refer Microsoft blogs for detailed SQL Server Upgrade Approaches and Supporting versions/editions etc.

Column ContentType does not exist.It may have been deleted by another user while adding/updating the list item

I have taken the list template from SharePoint 2007. Edited the Product version in order to use this template in SharePoint Online similar to this.

After creating the list from template, I tried to add edit list items and facing this error saying that column ContentType does not exist. It may have been deleted by another user while adding/updating the list item.

To overcome this,

I have created single line of text column with name “ContentType”.

After which, I’m able to add and edit the list items.

 

Microsoft SharePoint Foundation version 3 templates are not supported in this version of the product

This kind of error occurs when you try to create a list using a template which is taken from SharePoint 2007.

version 3 templates error As a workaround, you can still you the template in SharePoint Online but with few/limited settings.

Steps:

  1. Save the list as template from Source Site (2007) with name CustomList.stp
  2. Rename CustomList.stp to CustomList.cab.
  3. Extract the files using winrar to Physical Location e.g., D:\Temp\CustomList.
  4. Edit the manifest.xml with notepad and change the Product Version from <ProductVersion>3</ProductVersion> to <ProductVersion>4</ProductVersion>
  5. Open a command prompt and change to the directory that the manifest.xml and CustomList.cab files are located by using cd (D:\Temp\CustomList)
  6. Run the below command
  7. D:\Temp\CustomList>makecab manifest.xml CustomList.cab
  8. Rename it back to CustomList.stp
  9. Go to Destination Site – List Templates upload the CustomList and create the List from this template.

You may face editing or updating the list items that i will cover in other post.