Friday, February 27, 2015

Arctic SharePoint Challenge Notes

I’m in Oslo at the 5th annual Arctic SharePoint Challenge. This is quite an event. As far as I know, it’s the only hackathon focused purely on SharePoint in the world.


A few stats:




There are also Internet-connected red buttons, a star system map with live Tie Fighter positioning updates, more Web services than you can shake an alien from Alderaan’s finger at, one lynx named Dexter, and so much more I couldn’t possibly list it all. As you can tell from the logo, the theme this year is Star Wars, and everyone is taking it to an extreme in the best possible ways.


2015-02-27_19-20-11


Check out the live blogging that’s going on, the leaderboard so far (new badges soon!), and all of the badges teams can get.


I was honored to be invited to be a judge on the jury as well as to give the opening keynote presentation. I decided to talk about Building JavaScript to Stand the Test of Time. Here’s the presentation on SlideShare.






by Marc D Anderson via Marc D Anderson's Blog

Wednesday, February 25, 2015

Organizations Report Gap Between SharePoint Reality and Expectations

Many SharePoint shops report a gap between reality and expectations, but they are loathe to give up the SharePoint ghost, according to research conducted by management firm AIIM.


read more




by via SharePoint Pro

Monday, February 23, 2015

How to send periodic expiration email notifications in Office 365 and SharePoint 2013 Workflows

Introduction


In this article, I want to cover very common scenario of any business system it is alert notification or reporting subsystem. Usually that functional is responsible to notify end users about new events, overdue tasks and sending summary reports via e-mail. I want to review a couple of simple cases. Which I hope, you can manually customize and implement in your environment. All cases I created are use SharePoint Online with installed Plumsail Workflow Actions Pack, but you can implement it in OnPremise environment as well.




Personal Item/Task/Document expiration reminders


The first case which I want to describe has quite simple simple goal: a user wants to track status of sent Item/Task/Document. It could be application form for business trip, day off request, assigned task or something else. It depends on your business process, but core idea is the same. You have an item with specific due date and a person responsible for this item. You need to send notification message to the user when due date will come and of course you can customize the message template. Using SharePoint Designer you can create a site level workflow which will select all list items by specific query and process each item. As an example, it could generate email by template and send it.




Out of the box workflow actions don’t allow to query list items by CAML or generate email messages by templates. That is why I used some workflow actions from Workflow Actions Pack to extend out of the box functionality.




Below I showed the configured workflow:






I used the following CAML query to get all list items that expire in two days in Get Items by query workflow action:



<View>
<ViewFields>
<FieldRef Name='ID' />
<FieldRef Name='Title' />
<FieldRef Name='DueDate' />
<FieldRef Name='AssignedTo' />
</ViewFields>
<Where>
<And>
<Neq>
<FieldRef Name='Status' />
<Value Type='Choice'>Completed</Value>
</Neq>
<Lt>
<FieldRef Name='DueDate' />
<Value Type='DateTime'><Today OffsetDays='2' /></Value>
</Lt>
</And>
</Where>
</View>




Send email workflow action configuration (to simplify the process I designed the email template inside):



Hello [%Variable: userField%] <br /><br />
Have you had time to look into this? <br /><br />

<a href=”http://ift.tt/1w1zwvX Tasks/DispForm.aspx?ID=[%Variable:ListItemID%]”>[%Variable:ListItemTitle%]</a><br />
The Due Date is [%Variable: DueDate%]

<br /><br />
Kind Regards, <br />
SharePoint Notification System




You can see the sceenshot below as result:








Daily/Weekly/Mounthly aggregated expiration reports by email




The second example which I want to show is based on the same algorithm, but you need to get aggregated summary report instead of sending notifications to each user. To do this you can get all data and use Render Template workflow action to build complete email by predefined template.


Below I implemented the workflow for typical case when an administrator wants to get a summary report with a list of all checked out documents ordered by user.


At the figure below you can see the configured workflow, I split it on two stages to simplify configuration and copying to other document libraries.






The first step is just configuration section.

Next, I got all list items where the field CheckoutUser is not null, I used the following CAML query for this:


<View Scope="RecursiveAll"> <ViewFields>
<FieldRef Name="CheckoutUser"/>
<FieldRef Name="FileRef"/>
<FieldRef Name="FileLeafRef"/>
</ViewFields>
<Query>
<Where>
<IsNotNull>
<FieldRef Name="CheckoutUser"/>
</IsNotNull>
</Where>
<OrderBy>
<FieldRef Name="CheckoutUser"/>
<FieldRef Name="FileLeafRef"/>
</OrderBy>
</Query>
</View>




After it, I prepared data for the Render Text Template workflow action. I used the following template:



Please review the list of documents which was checked out: <br /><br /><table>
<thead>
<td><strong>User Name</strong></td><td><strong>Document</strong></td>
</thead>
<tbody>
{{#each Documents}}
<tr>
<td>{{FieldValues.CheckoutUser}}</td>
<td><a href="{{SiteUrl}}{{FieldValues.FileRef}}">{{FieldValues.FileLeafRef}}</a></td>
</tr>
{{/each}}
</tbody>
</table><br /><br />

Thank you, <br />
SharePoint Notification System. <br />




Before sending the message I used Regular Expression Replace workflow action to replace values in the User’s field from value like 24#;John Martin to 24 – John Martin.


And at the final step I sent complete email report to an administrator








Conclusion


In this article I wanted to describe some common cases which can be used for alerting or reminding purposes. I hope it was clear enough and it will not be difficult to repeat it or customize to your own requirements. Please feel free to comment the article.




Origianl posted at How to send periodic expiration email notifications in Office 365 and SharePoint 2013 Workflows

by Roman Rylov via Everyone's Blog Posts - SharePoint Community

Friday, February 20, 2015

Top 3 Ignite Sessions for Getting the Lowdown on SharePoint 2016

Microsoft Ignite promises to provide a plethora of information, announcements, meetings, opportunities, thought leadership … Wow, that’s a lot to absorb in a week. Fortunately for those focused on what’s coming in SharePoint 2016, Microsoft’s Bill Baer has provided some recommendations for sessions that will provide the most bang for your conference time buck.


read more




by via SharePoint Pro

Wednesday, February 18, 2015

YouTube at 10: How We Got from Bieber to SharePoint to Office 365 Video

While YouTube was once the domain of cat videos, it’s now a platform for everything from breaking news to exclusive presidential interviews (and, yes, still cat videos). In short, YouTube is legit. So is video in the workplace. Here's where it's going.


read more




by via SharePoint Pro

Panopto Aims to Fill SharePoint's Video-Shaped Holes

As companies continue to increase their use of video—for training, marketing and other purposes—the process of managing that video can be daunting. Panopto has released a new app for SharePoint that is designed to fill some of the collaboration platform's video-shaped holes and make it easier and more efficient for users to store and find video content.


read more




by via SharePoint Pro

How to Start SharePoint 2013 Workflows on Selected Items

This blog post appeared as an email response to one of our clients, he described very common use case where you have two libraries of documents, the first library where the users works with draft documents and the other library which is stored the final versions of documents. In this case, users want to be able to select finished documents and move it in one click. Oblivious solution for this is to use a workflow that will move documents to the final document library. But there is one question how we can start the workflow on selected list items? When I was thinking about the answer to that question - I realized that is not as trivial as it seems, because list level workflow can be started only on singl document. How to start multiple workflows on selected documents? In the article, I will describe how you can implement such solution.


I divided this article into three main parts:



  • Get selected items via JavaScript;

  • Start SharePoint 2013 workflow from JavaScript;

  • Add custom button to the list ribbon




Before we start, I want to show what we will get in result. On the figure below you can see the custom button on the ribbon, which will launch a workflows on selected documents.








How to get selected elements via JavaScript


Firstly I will describe how you can get selected List items from SharePoint list. To do this, you can use special JavaScript function getSelectedItems. Please see example below:



var ctx = SP.ClientContext.get_current();var selectedItems = SP.ListOperation.Selection.getSelectedItems(ctx);

for (item in selectedItems)
{
var itemId = selectedItems[item].id;
console.log(itemId);
}




As result of execution, this snippet of code you should see the IDs of selected list items in the console log.




How to start workflow


Since SharePoint 2013 Microsoft has added a new workflow engine. The new JavaScript API for manipulation with workflows also became available. In this article, I will not describe it, but if you are interested, you can find more information from the Andrei Markeev’s blog post. I will show you ready to use JavaScript snippet, which can run workflow on a single list item.



function startWorkflow(itemID, subID) { var context = SP.ClientContext.get_current();
var web = context.get_web();
var wfServiceManager = SP.WorkflowServices.WorkflowServicesManager.newObject(context, web);
var subscription = wfServiceManager.getWorkflowSubscriptionService().getSubscription(subID);

context.load(subscription);
context.executeQueryAsync(
function(sender, args){
console.log("Subscription load success. Attempting to start workflow.");
var inputParameters = {};
wfServiceManager.getWorkflowInstanceService().startWorkflowOnListItem(subscription, itemID, inputParameters);

context.executeQueryAsync(
function(sender, args){ console.log("Successfully starting workflow."); },
function(sender, args){
console.log("Failed to start workflow.");
console.log("Error: " + args.get_message() + "\n" + args.get_stackTrace());
}
);
},
function(sender,args){
console.log("Failed to load subscription.");
console.log("Error: " + args.get_message() + "\n" + args.get_stackTrace());
}
);
}




This simple JavaScript function launches a workflow on a list item. The workflow subscription is specified by SubID argument. To identify the subscription ID of your workflow you can navigate to the workflows start page and see the URL in your browser, it should look like this (the bold GUID it is workflow subscription ID): “javascript:StartWorkflow4('6eb43e78-6e6c-486a-9147-3e3870f3a44e', '19', '{FA41C64B-42CD-4A3F-A1AF-CF674AB35C57}')”






How to Add a Button to the SharePoint Ribbon


Very important part is how a user will interact with our system, I believe that the user experience is very important for any system. In our case we plan that the user will select the documents and click on the ribbon button which will move them to another document library.


There are various ways to add a button on the ribbon, but in this article, I want to describe the simplest. We will use SharePoint Designer to do this. When we use SharePoint Designer we have some limitation for example we cannot add new ribbon tab or hide any existing button, but from other point of view if we need just to add button to the ribbon it will take five minutes of our time and it doesn't require programming skills.


Please open the SharePoint Designer, navigate to “List and Libraries” and choose your document library.






To add a ribbon button please click inside the “Custom Actions” area and choose on the ribbon “Custom Actions” – “View Ribbon”.


When you fill in the all fields, you should see something like on the figure below in your list.






Please pay attention at the property “Navigate URL”, I filled it with following text: javascript:PlumsailDemo.WFPack.API.StartListWorkflowOnSelectedItems("{6eb43e78-6e6c-486a-9147-3e3870f3a44e}");




This is a call of our function with argument “Subscription ID” of our workflow.




Join all of it together


OK, we almost did it. All we need to do it is combine and place the JavaScript in SharePoint. To add our JavaScript on the page we will use the ScriptEditor Web part. To do this you need to enter to edit page mode, click on “Add a Web Part” and select “Script Editor” in “Media and Content” group.




I changed the JavaScript file little bit to simplify using



<script type="text/javascript">// <![CDATA[var PlumsailDemo = PlumsailDemo || {};
PlumsailDemo.WFPack = PlumsailDemo.WFPack || {};

PlumsailDemo.WFPack.API = (function() {
var self = this;
self.Context = null,
self.WFManager = null;

SP.SOD.executeFunc("sp.js", "SP.ClientContext" , function(){
SP.SOD.registerSod('sp.workflowservices.js', SP.Utilities.Utility.getLayoutsPageUrl('sp.workflowservices.js'));
SP.SOD.executeFunc('sp.workflowservices.js', "SP.WorkflowServices.WorkflowServicesManager",
function() {
self.Context = SP.ClientContext.get_current();
var web = self.Context.get_web();
self.WFManager = SP.WorkflowServices.WorkflowServicesManager.newObject(self.Context, web);
});
});

StartListWorkflowOnSelectedItems = function(subID) {
var selectedItems = SP.ListOperation.Selection.getSelectedItems(self.Context);

for (item in selectedItems)
{
var itemId = selectedItems[item].id;
self.StartListWorkflow(itemId, subID);
}
};

StartListWorkflow = function(itemID, subID) {
var subscription = self.WFManager.getWorkflowSubscriptionService().getSubscription(subID);

self.Context.load(subscription);
self.Context.executeQueryAsync(
function(sender, args){
var inputParameters = {};

self.WFManager.getWorkflowInstanceService().startWorkflowOnListItem(subscription, itemID, inputParameters);

self.Context.executeQueryAsync(
function(sender, args){
var message = "The workflow " + subscription.get_name() + " was started on item with ID " + itemID;
SP.UI.Notify.addNotification(message, false);
},
function(sender, args){
var message = "Failed to start workflow " + subscription.get_name() + " on item with ID " + itemID;
SP.UI.Notify.addNotification(message, false);
console.log("Failed to start workflow.");
console.log("Error: " + args.get_message() + "\n" + args.get_stackTrace());
}
);
},
function(sender,args){
var message = "Failed to load subscription " + subID;
SP.UI.Notify.addNotification(message, false);
console.log("Failed to load subscription.");
console.log("Error: " + args.get_message() + "\n" + args.get_stackTrace());
}
);

};

return {
StartListWorkflow: StartListWorkflow
, StartListWorkflowOnSelectedItems: StartListWorkflowOnSelectedItems
};
})();
// ]]></script>




Conclusion


In the article, we reviewed the way how you can start multiple workflows on the selected list items. As conclusion, I want to mention about one little detail, in such approach very difficult to monitor the status and errors of the workflows because it works on multiple list items. But you can extend my simple JavaScript with some workflow tracking logic if you have enough JavaScript/SharePoint skills.




You have to understand what will be the load for the system, for small systems this is an acceptable approach, but for highly loaded systems this is not so good. You can consider other approaches for moving documents like single site level workflow or custom coded solution.


As alternative of this approach, you can start a site level workflow and pass to it the selected IDs, but this is the theme of another article.




Please feel free to comment, I will be happy to answer to your questions.




Original article available at our blog

by Roman Rylov via Everyone's Blog Posts - SharePoint Community