Monday, June 30, 2014

Creating a SharePoint Workflow

I wrote two previous blog posts about creating workflows with SharePoint Designer:

What are SharePoint Workflows

and

SharePoint Workflows – first steps

This post follows on from those.

In this case we’ll create a simple workflow that sends an email when a document is added to the library.

clip_image002

Firstly give the workflow a name and a description and then select the platform type (which you normally leave set as SharePoint 2013 Workflow) and press the OK button to create the workflow.

SharePoint 2013 allows you to create either SharePoint 2010 or 2013 Workflows. Each has differences and the following:

What’s new in workflow in SharePoint 2013

Is the recommended place to start when it comes to understanding the differences between the versions. In most cases you will want to work with SharePoint 2013 Workflows.

clip_image004

This now takes you to a location where you can edit and create the workflow.

For a SharePoint 2013 Workflow you will see a stage box or “block” divided up into two sections. The upper box is for a set of Actions and the lower box (Transition to stage) which allows you to jump to other stages you may have created. This Transition to stage is a unique feature of SharePoint 2013 workflows and allows you to bypass code by ‘jumping’ to certain locations.

You should also see a blinking cursor under the top section as shown above. You position this cursor where you wish to insert a command in the workflow.

clip_image007

In the Ribbon Bar you should see a number of buttons contained in the Insert section as shown above. Press the Action button to insert an execute command.

clip_image010

When you press the Action button you will see a list of all the actions that can be taken, as shown above. Scroll through the list until you locate Send an Email and select it.

clip_image013

You should now see that command displayed in the workflow area below in the location where your cursor was as you can see above. The cursor now moves to the line just below what you inserted.

You will also note that the text these users is hyperlinked. This indicates that additional details are required for this command to complete. In this case you will need to specify the email address that you wish the email to be sent to. To do that simply press the hyperlinked text these users.

clip_image015

Now the additional settings for each Action will vary. In this case you should now see a dialog as shown above, basically asking you to complete the details for the email.

clip_image017

There are plenty of options that can be configured here (including data lookup) but we’ll keep this simple and plug in just an email address, subject and some text in the body.

When complete, press the OK button to save.

clip_image020

You should now see that the workflow action has updated with the email address you entered. You can modify these properties again at any time by simply clicking on the hyperlinked email address.

clip_image023

Although this is the only command that will be run by the workflow at this stage it is good practice to correctly terminate the workflow. To do this, click once in the Transition to stage area so the cursor appears there as shown above.

clip_image026

Select the Action button again from the Ribbon Menu. From the menu that appears select Go to a stage.

clip_image029

Once again, this will place the Action in the workflow window as shown above.

To complete the options for the Action select the hyperlinked text a stage.

clip_image032

From the drop down menu that appears select End of Workflow. Doing so will ensure that the workflow does not continue to run in the background consuming resources.

clip_image034

The completed workflow should now look like the above.

clip_image036

You now need to set the workflow so it runs whenever something new is added to the Document Library. To do this locate the Workflow Settings button in the Ribbon Menu in the Manage section and select it.

clip_image039

On the right hand side you will see a box called Start Options as shown above. Place a check in the Start workflow automatically when an item is created.

clip_image041

If you need to return to your workflow and edit it select the Edit Workflow button under the Edit section on the Ribbon Menu.

You can also Save your workflow if need be but in this case we are ready to Publish to the SharePoint site so we select the Publish button from the Ribbon Menu.

clip_image043

You should now see the workflow being Published to the SharePoint site. If there are any errors you will be notified and have to make changes.

If there are not errors, your workflow has been successfully Published to SharePoint.

You can check that your SharePoint element has a workflow attached to it by navigating to that location (in this case Documents).

clip_image046

If you then select the Library tab at the top of the page.

clip_image048

Then the Workflow Settings button on the very right of this.

clip_image051

You should then see the name of the Workflow you just created.

clip_image055

If you look closely at the SharePoint element that now has a workflow attached you will see an additional column has been added to the default view. This column is the same as the name of your workflow (in this case Send email workflow as shown above).

clip_image034[1]

When you trigger a workflow (in this case by uploading a new document) the new workflow column will report what stage the workflow is at. Remember, that each “block” of Actions and Transition to stage is designated by its name.

In this example, there is only one code “block” called Stage 1 as shown above. Thus, when the workflow is triggered by the addition of a new document to the element the workflow executes and start and ends on Stage 1. This status is then reported in the workflow column in the SharePoint element. This allows you to more easily debug your code since it allows you to easily see where a workflow is currently situated.

clip_image057

As you can see from the above, the workflow was completed and an email has been sent with the subject and text created in the workflow.

You can now return and edit the workflow and create additional Actions. You can create additional workflows for the same elements if you wish or you can create them for other elements.

Conclusions

SharePoint workflows provide the ability to automate processed in SharePoint. However, workflows are not like pure coding, they are more like constructing a flow chart. They are great for simple and straight forward processes but become quite cumbersome and difficult to create when the task gets complex or involved.

Best practice is always to map out your workflow prior to developing with SharePoint Designer. Keep your code as simple as possible and make sure you maintain good documentation elsewhere about what you have created because SharePoint Designer doesn’t provide for adding comments to your code.

If you ever need to debug a workflow, break it down and look at the stages that are reported in the SharePoint element to which the workflow is attached. Also, don’t overlook the workflow start conditions. If you set a workflow to commence when something changes, that means when ANYTHING changes. That may mean you have multiple workflows running at the same time causing confusion. That is why it is so important that you programmatically terminate your workflow upon completion, rather than simply letting the process end.

Use correctly, SharePoint Designer and workflow can be huge source of productivity improvements. Use incorrectly or poorly implemented they can be a huge source of frustration. Remember, SharePoint Designer is not the only tool that you can use to create workflows. You can use Visual Studio for far greater control, but for that there is a much greater investment in both time, material and knowledge. SharePoint Designer allows a balance to be struck and be used by people who aren’t software developers.

Thursday, June 26, 2014

Sharing files with External users using OneDrive for Business

One of the great things about OneDrive for Business is that it easily allows you to share files. You might not appreciate that you can also share files with people who don’t have an Office 365 login. As long as they have an email address you can send them a link to the file you wish to share.

i have wrapped all that up into the video you see above. It will show you how to share a document with an external user who already has a free Microsoft account. It will also show you how to share a file with people so they don;t need to login but can simply click on a link your send them.

OneDrive for Business is a much better option than sending attachments and hopefully the above video will show you how easy it is.

Smarter help when editing with Office Online

Here’s something I just learnt that I think is really, really helpful.

image

Click on a Microsoft Office document somewhere in SharePoint Online (Team Site or OneDrive for Business). It will then open that document in a browser using Office Online. If you then elect to edit that document in a browser you’ll see the familiar ribbon as shown above.

image

See that box at the top of the ribbon that says ‘Tell me what to do’?

image

If I type ‘create table’, as you can see that menu option immediately becomes available, allowing me to select and create a table.

image

If I instead type in the box ‘create grid’, Office Online works out that I probably mean table and again shows me the appropriate menu command right there so I can create my table.

This is very powerful as it allows people to find what they are after much quicker and reduces the needs for lots and lots of menus and buttons.

Use it, love it.

Office 365 email attachments into OneDrive

A little while ago I noted in a blog post how the ability to select an attachment that was already in your OneDrive for Business was being rolled out.

image

After watching the latest Garage Series video I note that you can elect to upload a file from your desktop machine and attach it to an email as you used to BUT NOW you can also upload it directly into your OneDrive for Business as you see with the top button above!

image

It then displays the file in the email as you see above but that is simply a pointer to the location in OneDive for Business where the file actually lives.

However, even better than that, all the people you send the email with the attachment to automatically have the appropriate rights set in OneDrive for Business. All the external sharing business is ‘automagically’ taken care of! Impressive.

It seems that this is only available via Outlook Web Access. It would be nice if it was also available via Outlook on the desktop but I wouldn’t expect that initially. Down the track? Yes, probably but for now whata great addition.

https://www.youtube.com/watch?v=SP_H4TUfzjg

As always, I recommend you watch the latest Garage Series video to learn about everything that is happening with Office 365.

Tuesday, June 24, 2014

Sharing files with OneDrive for Business

So here is another attempted video on the Surface with Windows Azure virtual machines.

It shows you the basics of document sharing with OneDrive for Business.

It is still a little blurry for my liking which probably has to do with the high resolution of the Surface machine.

I’ll need to do more testing.

Uploading documents to OneDrive for Business

Now that I have ditched my tower and am looking to also ditch the laptop I’m trying to find the best way to record videos on my Surface using the Microsoft Azure desktop virtual machines.

I have therefore created the above video that shows you the different methods of getting documents into OneDrive for Business.

The resolution is a bit small because I can’t find how to improve that with the desktop virtual machine. I’m sure I’m not looking hard enough.

However, enjoy the video and let me know what else you would like to see.

Thursday, June 19, 2014

Self Organizing Learning Environments

I found this video very inspiring, thought provoking and I commend everyone to take the time to watch it. The premise is that perhaps we don’t need schools to educate people. Perhaps all we need is a connection to the Internet. The results can be truly amazing.

Where I originally came across Sugata Mitra was in a Microsoft Surface video. He teams up with another passionate educator, Adam Braun (another inspiring story – Pencils of Promise, that I also commend you to watch), to discuss education needs based on Mitra’s research.

The Work Wonders Project video above demonstrates how Mitra’s concept of Self Organizing Learning Enterprises (SOLE) can work in a normal school. It is really amazing at how engaging it can be for the students and how well it works.

Technology and the web obviously play a big part in SOLE but for all the bad stuff and commercialization we see with technology, I think this SOLE concept shows real promise not only in schools but anywhere.

In that respect, I think businesses could use SOLE to greatly increase their productivity and employee engagement. I urge you to take a look at these two video and ask yourself whether the SOLE concept could be applied somewhere in you life?

Wednesday, June 18, 2014

Resolving OneDrive for Business file conflicts

In a recent post:

Working with OneDrive for Business offline

I highlighted a scenario where if a user edited files synced with OneDrive for Business desktop app offline while another user edited those same files online, when the first user tried to sync, after coming back online, they would get an error. This could also potentially result the loss of one of the copies of the changed document.

I believe I have a solution to solve that issue so let me run through it here. So here’s the scenario first.

image

Robert is using OneDrive for Business in Office 365 and has a number of files as you can see above stored in there and accessible via a browser.

image

He has shared a document ‘cloud qualification worksheet’ with user Lewis Collins directly from his OneDrive for Business, as you can see above. Robert has also allowed Lewis the ability to edit this document.

image

Robert has also synced his OneDrive for Business to his local laptop using the free desktop app and all the files are up to date as you can now see from the above screen shot.

image

Lewis can work with the document in Word or using Office Online.

image

Robert can do the same and because both are online any changes get replicated to both users and to Robert’s desktop.

Ensuring that all his OneDrive for Business documents are synced and up to date Robert gets on a plane and goes offline.

image

While offline, Robert opens the file from his desktop and makes the changes you see above. This means the file in his desktop version of OneDrive from Business is different from the original.

image

While Robert is offline, Lewis also goes into the same file and changes it as shown above. Because he remained online, this version now becomes the one that is saved into Office 365.

So now we have 2 different versions of the same file. One is in Office 365 and one is on an offline notebook.

Robert completes his travel and goes back online.

image

At the next sync, the desktop app now indicates an error, because the file in Office 365 has been edited by someone else and so has the local copy. It therefore displays a sync error on that file as shown above, indicated by a red icon on the file on Robert’s notebook.

image

If Robert now right mouse clicks on the file with the error and selects the OneDrive for Business option and the View sync problems option from there he sees:

image

At this point you need to be careful of what you do to retain both copies of the file so you can manually merge the changes.

Step 1 – Copy the original offline edited file

On his laptop Robert need’s to take a copy of the file that is displaying the error and allow it to sync back to Office 365.

image

As you can see, now on his local machine he now has the original file with the error and a copy of it synced to Office 365.

image

If he now navigates to his OneDrive for Business via the browser he sees this new file is also in the cloud.

Step 2 – Delete the original offline file

Returning to his laptop, Robert now deletes the file with the error from the OneDrive for Business location on his laptop. Remember, he has already made a copy of this file before deleting it.

image

His laptop now looks like the above with no errors and all files synced.

image

As expected, when he refreshes his browser he see exactly the same thing in his OneDrive for Business in Office 365.

image

If he opens the copy of the file he made, Robert sees that it has all the changes he made while offline as shown above. The original file is now not in either location, that is why you need to copy the offline edited version first and allow it to sync.

Step 3 – Restore the deleted file from the Recycle Bin via the browser

image

From OneDrive for Business in the browser Robert selects the Recycle Bin link on the left.

image

From the Recycle Bin Robert selects the file he just deleted in his desktop and then selects Restore Selection.

image

He confirms the restore by pressing OK.

image

If Robert then returns to his OneDrive for Business by selecting the My Documents link on the top left he will see that the original file has not only been restored but it is also still shared!

image

If Robert now views that file in a browser he sees that it contains the edits that Lewis made online as shown above.

image

In a matter of moments that restored file synced to his desktop using the desktop sync app as shown above.

image

He can now open the file from his desktop and merge the changes with his original (which is saved as a copy here as well) and then update the original back to Office 365, while retaining all the user sharing he enabled earlier.

Summary

So if you get a conflict with a file that has been changed in the cloud and on a synced desktop performed the following:

1. Create a copy of the desktop file saved to OneDrive for Business.

2. Delete the desktop file from the local machine.

3. Restore the file from the recycle bin via the browser and OneDrive for Business online.

That process will allow you to retain a copy of both files as well as the original OneDrive for Business sharing.

I am sure there are other ways of doing this but this worked for me. It is important to follow the process in that order and from the right locations, otherwise you risk losing one of these files.

Hopefully, an upcoming iteration of OneDrive for Business will do this auto-magically for you, however until then this should do the trick for those occasional times when two people edited the same file while one of them was offline.