SHAREPOINT ONLINE/OFFICE 365: HOW TO COPY EMAIL ATTACHMENTS TO SHAREPOINT DOCUMENT LIBRARY USING MICROSOFT FLOWS

In this article we will see how we can utilize Microsoft Flows to copy email attachments from Outlook Emails to SharePoint Document Library.

To continue with this demo we can start with adding a document library to SharePoint site, let’s call it “Outlook Attachments”

1

Now go to Microsoft Flow designer and start with adding a workflow

As I explained in my earlier articles we need to start with selecting a trigger for this workflow

Since we need to copy the email attachments to document library so we have two Cloud Services “Office 365 Outlook” and “SharePoint Online” to deal with

Select “Office 365 Outlook” as connector and “Office 365 Outlook – When a new email arrives” as trigger to kick off this workflow

2

Choose the Outlook folder or subfolder that you want to monitor. Here I am selecting “Inbox” as target folder. This means workflow will trigger only if the email arrives in Inbox folder and rest of the emails will be ignored.

3

Set “Has Attachment” = Yes, this settings will further filter out the incoming emails based on if they have attachments or not.

We are only monitoring only emails with attachments and that’s what these filter will achieve for us.

Set “Include Attachments” = Yes, this is required so that Workflow runtime include the binary information of each the attachments and make it available to be written to SharePoint Library.

4

Add another action with “SharePoint” as connector

Select “SharePoint – Create file” as trigger, this action will be responsible to write down the attachment binaries to SharePoint Library

5

Enter Site URL where we have “Outlook Attachments” document library sitting

Select document library name from the lookup in the Folder Path Field

6

Select “Name” property in the File Name field, this property represents the name of the attachment

7

Select “Content” in the File Content Field, this property will hold the binary data for the attachment being written to the SharePoint Document Libraries.

Here it is important to note that if we does not set the “Include Attachments” = Yes, then Content property will be null and will cause not write operations takes place

8

Add another action to the workflow, which will be responsible to send email after the attachment has been copied to the SharePoint Library

9

Select “Office 365 Outlook” as connector

Select “Office 365 Outlook – Send an email” as trigger, this trigger is responsible for sending emails

10

Choose or any valid email id in “To”, here I am just selecting the email of me

Specify Subject as applicable

Specify the Body content as required. This content can consist of dynamic tokens provided by Workflow runtime as shown below-

11

Saves the Workflow and complete it.

In the following screens we can see the complete workflow steps in one go-

Step-1

12

Step-2

13

Step-3

14

Now let’s test the workflow by sending an email with attachments to myself.

15

Once I received the email containing attachments in Inbox Folder, Workflow gets triggered

16

Just after that we can see workflow entered into the debug mode as shown below-

17

And as soon as it is completed we can see the completion notification email as shown below-

18

And we can also see the attachments copied to the “Outlook Attachments” SharePoint Library as shown below-

19

Hope you find it helpful.

Advertisements

SHAREPOINT ONLINE/OFFICE 365: HOW TO DEVELOP APPROVAL WORKFLOWS ON LIST ITEM UPDATE EVENT USING MICROSOFT FLOWS

In this article we will see how to deal with SharePoint Online List Item update event.

For the demo in this article I will consider a business scenario where on update of any Product in the Product list, an approval process will execute and an email is send to approver for the selection of Price Range for the Product just updated.

To start with a demo I have a Product List in SharePoint Online Site as shown below-

2

Go to “Flow” Menu and Click on “Create a Flow”

3

Here we have two choices either we can use any available workflow template that suites our requirements or we can create a new one from scratch

4

For this demo we will create a Flow using blank template

Go to Flow Site by clicking “See you flow” links

5

Click on “Create from blank” this will launch Workflow Designer

6

On the Workflow Designer, Select the Trigger

We can select trigger from the any of the available services as shown highlighted below-

7

Select SharePoint Online as target service & select for the Trigger “SharePoint-When an existing item is modified”

8

Provide the Title to the Workflow “Product Details Modification Approval Request”

9

Create SharePoint context by providing Site URL and List Name as shown-

10

You can optionally rename the Step by selecting “Rename” option as shown below-

11

Here I have changed the name of Step to “Get SharePoint Context”

12

Add another action to the workflow by clicking “Add an action” option

13

Send email by selecting “Office 365 Outlook” Service and “Office 365 Outlook-Send approval email” action

14

Rename the name of Step to “Request Approval”

15

Choose or approver’s email in “To”, here I am just selecting the email of the person who has originally created the Product in list by choosing “Created By Email” field

Specify Subject as applicable

Specify User Options that allows approver to select the approval options from within the mail

Specify the Body content as required. This content can consist of dynamic tokens provided by Workflow runtime as shown below-

16

Update List Item by selecting “SharePoint Online” Service and “SharePoint-Update item” action

17

Rename the step to “Update item”

Specify Site URL & List Name

In Id field select “ID” token provided by workflow runtime. This token represents the List item Id of the item that triggered this workflow to execute.

It is important to note that values to all mandatory fields in the list must be provided. If you don’t want to change the values you can choose same values again.

18

For Title field we have selected “Title” token that represent current value present in list for the Title field of this item

19

In “Product Price Range” field choose “SelectedOption” token that will hold the value selected by the approver from within the mail

20

Once all the Steps are configure as required we can save the workflow by clicking “Save flow”

21

Click “Done” to return back to the workflow dashboard

22

On the workflow dashboard we can see the details of services used with in this workflow

23

Now modify and the Product in Product List and notice the “Product Price Range” field which is currently set to “Low”

24

Once the Product details has been changed, this will trigger the workflow that we have developed

25

On execution the workflow we can see a new email hitting the inbox of the approver

26

Let’s consider the approver submitted “High” as approval option

27

This action will update the “Product Price Range” field for the list item to “High” as shown below-

28

Hope you find it helpful.

SharePoint 2013 : How to migrate SharePoint 2010 Style Workflows – Part 4

In the previous article SharePoint 2013 : How to migrate SharePoint 2010 Style Workflows – Part 3 of this series on the Workflow migration Process we saw the execution of Steps 5 & 6 for the process.

In this article we are going to see the execution of Steps 7 & 8 and for the sake of quick review I am putting up the process diagram again in here.

Process Diagram

1

Step 7: Destination Site – Provision Workflow Export File

Once we are done successfully with the deployment of Content Type in Destination Site “Site002” then next move is to provision the Workflow export file that we have got from “Step 5” earlier

Here we will be using PowerShell Commands to get it deployed. We will be making use of “Add-SPSolution” & “Install-SPSolution” Cmdlets as shown below-

40

And that’s all. We are all done with the export process and now it time to finally test it in Destination Site “Site002”

Step 8: Destination Site – Test Workflow

In order the functioning of the Workflow do as follows-

  • Launch SharePoint Designer 2013
  • Connect to Destination Site “Site002”
  • Click on “Workflow” link in the left navigation

There we can see the “CustomerLogs” workflow under “Reusable Workflow” list

41

Now visit “CustomerCT” using Site Settings > Site Content Types

42

  • Click on the Content Type
  • Click on Workflow Settings

43

Click “Add a workflow” link to choose the workflow to associate with the content type

44

From the list of available workflows choose “CustomerLogs” and give it a logical name of your choice

45

That is how we get the workflow associated with the content type.

46

Now we need to create a list and add this content type to the list as we did it earlier

And finally you can create the item based on this content type

47Add some values and save the item

49

Once the item is created we can start the workflow as shown in the following steps-

Click on “Workflows” link

50

Start the “Log Customers” Workflow on the item

51

52

Once completed see for the status of the Workflow and the message logged by it in the history log

53

54

And we got the Workflow export process working like a charm.

That is all for this demo.

Hope you find it helpful.

 

SharePoint 2013 : How to migrate SharePoint 2010 Style Workflows – Part 3

In the previous article SharePoint 2013 : How to migrate SharePoint 2010 Style Workflows – Part 2 of this series on the Workflow migration Process we saw the execution of Steps 3 & 4 for the process.

In this article we are going to see the execution of Steps 5 & 6 and for the sake of quick review I am putting up the process diagram again in here.

Process Diagram

1

Step 5: Source Site – Export Workflow

So up till now we have tested the workflow and seem it is working all fine

Now finally it is time to move it out of Source Site “Site001”

  • Launch the SharePoint Designer 2013
  • Click on the Workflow in left navigation
  • Select “CustomerLogs” Workflow
  • Click on “Save as Template” from the Ribbon Control

33

This will export the workflow as .WSP file at the selected drive location

34

With this last action we are all done with the Source Site “Site001”

Please note that we have performed all the above steps just to simulate a proper business case where someone already created a Workflow and now we need to move it to some other SharePoint Site. In case if you already have a workflow created then you can always skip the steps above

Step 6: Destination Site – Provision Content Type

In order to move the Workflow based on the content type we need to first deploy the Content Type Solution to the Destination Site “Site002”

You should deploy it using PowerShell; in here I am making use of Visual Studio to get it deployed as shown below-

35

36

Once the Content Type Solution deployed successfully we should enable the feature to provision the Content Type

37

In order to verify if the Content Type has been provisioned correctly we should go as follows:

  • Go to Site Settings
  • Click on “Site Content Types” link

38

We can filter the list of available Content Types by “Custom Content Types” Group

And there we can see the “CustomerCT” content type provisioned correctly

39

 

That is all for this demo.

We will be looking for Step 7 & 8 in Part 4 of this Series.

SHAREPOINT 2013 : HOW TO MIGRATE SHAREPOINT 2010 STYLE WORKFLOWS – PART 4

So guys just stay tuned 🙂

 

SharePoint 2013 : How to migrate SharePoint 2010 Style Workflows – Part 2

In the first article SharePoint 2013 : How to migrate SharePoint 2010 Style Workflows – Part 1 of this series on the Workflow migration Process we saw the execution of Steps 1 & 2 for the process.

In this article we are going to see the execution of Steps 3 & 4 and for the sake of quick review I am putting up the process diagram again in here.

Process Diagram

1

Step 3: Source Site – Create Workflow

  • Launch the SharePoint 2013 Designer
  • Connect to the Source Site “Site001”
  • Click on the Workflows section on the left
  • Click on the “Reusable Workflow” Ribbon Control

9

  •  Specify the Workflow Name “CustomerLogs”
  • Select “CustomerCT” content type that we had provisioned in the earlier steps
  • And since this demo is to show how to export SharePoint 2010 Style Workflows so we should choose the Platform Type as “SharePoint 2010 Workflow”
  • Click OK to save the Workflow

10

We can see the new workflow created under “Reusable Workflow” Category

11

Step 4: Source Site – Test Workflow

Now we have to associate “CustomerLogs” workflow with Content Type “CustomerCT”

To add the association go to Site Settings > Site Content Types

12

Filter the content types by group “Custom Content Types”

We can see the “CustomerCT” Content Type available in the Site Content Types List

Click on “CustomerCT” Content Type and edit it

13

Under Settings section click on the “Work Settings”

14

Click on “Add a Workflow” Link

15

Under the Workflow Section you should see the “CustomerLogs” workflow list in Workflow Template list and specify a suitable name as “Customer Logging” in this case

Save the Workflow Settings

16

Now we can see new instance of “CustomerLogs” workflow associated with “CustomerCT” content type

17Now lets’ create a Test SharePoint List to verify the Workflow is working fine in association with Content Type

  • Go to Site Contents
  • Select “Custom List” list template to create a list

18

Let us call this list as “Customers” and click “Create”

19

We can see the “Customers” List created a successfully

20

Now we need to add “CustomerCT” content type to the “Customers” list

  • Go to List Settings
  • Click on the “Advanced Settings” link

21

  • Select “Yes” under “Content Types” Section
  • Save the settings

22

Click on the “Add from existing content types” link and select the “CustomerCT” content type

23

24

Now create a new item based on “CustomerCT” content type

25

  • Add suitable values to the fields

26Since we did not configured the “CustomerLogs” Workflow to start automatically on “Item Added” or “Item Updated” so we need to manually start it

27

Now lets’ review the workflow status

Click Ellipsis and select “Workflows” to get the Workflow Start Page

28

Click on the “Customer Logging” workflow to start

29

  • Click on “Start” button

30

And we got the workflow started & completed

31

We can verify the Workflow Status and also the message logged by it to the history log

32

That is all for this demo.

We will be looking for Step 5 & 6 in Part 3 of this Series.

SHAREPOINT 2013 : HOW TO MIGRATE SHAREPOINT 2010 STYLE WORKFLOWS – PART 3

So guys just stay tuned 🙂

SharePoint 2013 : How to migrate SharePoint 2010 Style Workflows – Part 1

In this article we are going to learn the steps that are involved in moving SharePoint 2010 style reusable workflows from one site to another and I must say this a bit of tricky process all around.

The whole process of exporting SharePoint 2010 Style Workflow involves 8 steps as showing below in Process flow diagram which I will be going to deliver as a series of four articles-

Process Diagram

1

So we can see that we got to go a long way in order to accomplish the task of moving workflow from one location to another so let’s hit the floor

Step 1: Create Site Collections

In order to setup this demo we need to first create two Sites lets’ call them “Site001” (Source) & “Site002” (Destination)

So the task is to move a reusable SharePoint 2010 Workflow from Source Site to Destination Site.

So we created both Source & Destination Sites as per usual process as shown below:

2

3Step 2: Source Site – Provision Content Type

In order to develop a reusable workflow in the Source site we would be needing a Content Type to be provisioned first based on that we can be able to create the require reusable workflow

In order to provision the Content Type lets create a solution and add a content type based on our business requirements.

Here for the sake of this demo I have added a Content Type called Customers with just two fields “Work Address” & “Company Name”

4

Lets’ name the feature associated with this content type as “Enable Customer Logging”

5

In order to provision the Content Type we need to deploy the solution and activate the “Enable Customer Logging” feature

6

In order to verify if the Content Type is provisioned we can go to Site Settings > Site Content Types

7

Filter the content types by group “Custom Content Types”

We can see the “CustomerCT” Content Type available in the Site Content Types List

8

That is all for this demo.

We will be looking for Step 3 & 4 in Part 2 of this Series.

SHAREPOINT 2013 : HOW TO MIGRATE SHAREPOINT 2010 STYLE WORKFLOWS – PART 2

So guys just stay tuned 🙂

 

SharePoint 2013 : How to Start Workflow on a List Item using Workflow Instance Service

We are here in the Fourth and Final Post in the Series of Four articles on Workflow Services.

Last three posts in this series can be reached out at the below links:

  1. SharePoint 2013 : Introduction to Workflow Services API
  2. SharePoint 2013 : How to Copy Reusable Workflows from one site to another using Deployment Service
  3. SharePoint 2013 : How to Add Workflow Associations to a List using Workflow Subscription Service

This article will take you through to the automation steps of another more common requirement i.e. “Starting a Workflow on any List Item Programmatically”.

In order to automate this task we can leverage Work Instance Service.

Assuming that you are following me all along the previous three articles of this series, and you are already aware of that we have a List with the name “Workflow Testing” in the Child Site which we had created in one of the earlier posts of this series.

We also got a Workflow Definition “Workflow on Orders in Parent Site” Copied to this Child Site and published in context of “Workflow Testing” List.

Now let see how we can start the workflow on any desired list item programmatically using “Workflow Instance Services”.

For this demo lets consider a target item “Test Item 3” in “Workflow Testing” List on which we need to start the workflow, as shown below:

1

In order to trigger the Workflow Start process, we have got a super simple UI with one HTML button “Start Workflow” as shown below:

2

Now next thing is to get into the code line by line to understand the logic behind this implementation:

1.Specify the Workflow Definition ID which needs to be started on the list item

2.Specify the List ID to which this workflow is associated

3

3.Instantiate the List Object by calling “getById” method

4.Instantiate the List Item Object by calling “getItemById” method

5.Instantiate Service Manager Object as earlier

6.Query all the available Subscriptions for the Workflow Definition based on Definition ID specified in Step 1 using Workflow Subscription Service

4

7.For a specific Subscription call “startWorkflowOnListItem” function of Workflow Subscription Service by passing following parameters to it:

  1. Workflow Subscription Object
  2. List Item ID
  3. Initiation Parameters: This is applicable only when the Workflow is expecting any Initializing Parameters in the Workflow Definition, else we can pass an empty object to the function as shown below.

5

With this we are done with code development.

Now click on the HTML Button to test the code and if the code execution succeed you will get an Alert saying “Workflow Started” as shown below:

6

In order to test the implementation from UI, we need to browse the “Workflow Testing” list and look for the target item which is “Test Item 3” in our case.

Look for the Workflow Status column for this item to see if the Workflow status has been updated as shown below:

7

Click on the workflow status to see full history of workflow execution to ensure that all operations are executed as expected.

8

Hope you enjoy this series on Workflow Services.

Please share your feedback if you find it helpful.