Preparing Developer Virtual Machine for SharePoint 2016 Preview

In anticipation for the SharePoint Server 2016 Preview release this month of August 2015, I have prepared a Hyper-V virtual machine for development and evaluation purposes.

System Requirements
http://blogs.technet.com/b/wbaer/archive/2015/05/12/what-s-new-in-sharepoint-server-2016-installation-and-deployment.aspx

Scenario Deployment type and scale Processor RAM Hard disk
Database server running a single SQL instance Development or evaluation installation with
the minimum recommended services
64-bit, 4 cores 12-16 GB 80 GB for system drive
100 GB for second drive

My setup:

Host
OS: Windows 10 Pro
Desktop
Intel Core i5 @ 2.67Ghz 4 Logical Processors
120GB Intel Solid State Drive for VM Disks only
16GB RAM

Hyper-V Virtual Machine
2 Logical processors
12GB RAM

Windows Server 2012R2 with Update
SQL Server 2014 with Service Pack 1
Visual Studio 2015
Chrome

My Software Preparation:

I recently upgraded to Windows 10 and I am enjoying it including the new Start Menu with Tiles and Cortana.

I installed the Hyper-V Manager feature
Control Panel > Programs and Features > Turn On windows features or off
Check off ‘Hyper-V’

Hyper-V

I ran Hyper-V Manager and create a new Virtual Machine and went through the wizard and allocated system resources such as 2 logical processors, location of the VM disk in my solid state drive, and 12 GB of ram. I highly recommend solid state drives for SharePoint VMs as I notice a big performance gain with much higher IOPS.

Note that according to minimum requirements of 4 processors, I will try to settle with only 2 logical processors but if needed I’ll bump up to 4 logical processors. I plan on saving VM system resources by turning off services in Central Administration ‘Services on Server’ such as SharePoint Server Search, Excel Calculation services, Access Services, Machine Translation Service until I want to use them.

I had installed the Windows Server 2012 R2 operating system through .ISO image file.

After installation is complete and booting up Windows Server, I ensured to add roles and features with
Active Directory Domain Services
Web role and app role.
Application Server role

Windows Server Add Role

Next, I installed SQL Server 2014. I just include all the features.

Next, I installed Visual Studio 2015 to develop SharePoint apps/add-ins. I noticed that the install options, you can choose Office Developer tools. Note that you shouldn’t expect it to support SharePoint 2016, but my guess it will to some extent such as simple web parts and list and library deployment.

To download Office Tools separately, visit https://www.visualstudio.com/features/office-tools-vs

Now wait for the SharePoint 2016 Preview download hopefully sometime this month of August.

WaitForCustomEvent 1

SharePoint 2013 Workflow Integration with the WaitForCustomEvent Activity

Implementing an integration scenario with SharePoint 2013 Workflows using WaitForCustomEvent Activity in Visual Studio 2012 Technical Requirement: Integrate a SharePoint workflow with another application to call into the application and wait for a response with data.

Applicable business scenarios

  • A document management approval workflow notifies a CRM system of a customer engagement and provides a reference number back to the workflow.
  • A SharePoint workflow assigns and emails an end user to do some work in another application. The end user goes to the other application to do this work and it notifies the workflow of completion and other application data. The SharePoint workflow continues.

The following is an implementation flow that is applied to the above business scenario.

  1. The workflow instance calls an external application through a RESTful service passing correlating information and the custom wait event name.
  2. Workflow is in a wait state by the WaitForCustomEvent.
  3. The external application executes its relevant business logic and is then ready to notify the workflow through the SharePoint API by passing correlating information, event name and any event args (e.g. data).
  4. The workflow custom wait event handles the call and continues execution with the given event args. At this point, the workflow status can be set.
WaitForCustomEvent 2

High level development

  1. In Visual Studio 2013
    • Create a Workflow Custom Activity project item.
    • Deploy solution to a site.
  2. In SharePoint Designer 2013
    • Create a SharePoint 2013 workflow. The deployed activity will apear in the Actions menu
    • Add the custom action to the workflow design surface.
    • Publish workflow

Updating workflow custom activity and redeploy steps

  1. Create Workflow in SharePoint Designer 2013
    • Clear SP Designer website cache
  2. Create Workflow Activity in Visual Studio 2012
  3. Create external application to receive and publish the even back to the running workflow instance.

The WaitForCustomEvent Activity

This activity is part of the toolbox when you want to create a Custom Workflow Activity in Visual Studio 2012.

WaitForCustomEvent 3

When deployed to the SharePoint server, it will show up as a custom action in SharePoint Designer 2013. This activity has an input of EventName and an output of Result.

WaitForCustomEvent 12

SharePoint Client Side Object Model: WorkflowInstanceService.PublishCustomEvent

In the external application, leveraging the SharePoint Client Side Object Model, use the WorkflowInstanceService.PublishCustomEvent method to call to the waiting workflow instance to continue. This activity would handle the event is by a CSOM API call using the PublishCustomEvent method.

Parameter Description Type
instance The instance of a workflow that is running. WorkflowInstance
eventName The event name that would be declared in the WaitForCustomEvent activity String
payload Data that would be passed to the workflow. String

As you can see, the EventName input is associated to the eventName parameter and the Result output to the payload parameter. http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflowservices.workflowinstanceservice.publishcustomevent.aspx

WorkflowServicesManager workflowServiceManager = new WorkflowServicesManager(web);
var workflowInstanceService = workflowServiceManager.GetWorkflowInstanceService();
workflowInstanceService.PublishCustomEvent(workflowInstance, "CustomEventName", "Eventpayload:value;key:value");

Sample code on the use of this method is in  Sohel Blog post

Creating the Workflow Custom Activity in Visual Studio 2012

    1. Create new project SharePoint 2013 – Empty Project
    2. Right click on the project > Add new item > Select Workflow Custom ActivityWaitForCustomEvent 5
    3. Click on the xaml file and see the designer surface.
    4. Open the Toolbox pane
    5. Drag and drop the WaitForCustomEvent activity on to the designer surface. I have also added WriteToHistory activity for debugging/tracing purposes. WaitForCustomEvent 6
    6. Create arguments to make the design of this custom workflow activity dynamic and reusable in Sharepoint Designer workflows. At the bottom of the designer surface, click on the Arguments tab.WaitForCustomEvent 7

      Set “EventName” as an input argument and the “EventOuput” as the output argument. To give you an idea of what we are trying to achieve by “dynamic” here is a peak of how it will be used in SharePoint Designer workflow. The following blue text are placeholders for literal values or variables.

      WaitForCustomEvent 11 WaitForCustomEvent 9

    7. So now let’s get back to setting up these arguments in Visual Studio 2012. Click on the WaitForCustomEvent activity properties pane. Enter “EventName” argument for the EventName input Enter “EventOuput” argument for the Result ouput.WaitForCustomEvent 10
    8. Let’s surface these arguments to SharePoint Designer to look likeWaitForCustomEvent 8 Click on the .actions4 file. Setup as follows:
      <Action Name="WaitEventActivity" ClassName="WaitEvent.WaitEventActivity" Category="Custom" AppliesTo="all">
        <RuleDesigner Sentence="Wait Event Name %1 ( Event Args %2 )">
          <FieldBind Field="EventName" Text="Event Name" Id="1"
          DesignerType="TextBox"
          DisplayName="Event Name triggered from an external system" />
          <FieldBind Field="EventOutput" Text="Event Output" Id="2"
          DesignerType="TextBox" DisplayName="Event ouput from an external system"   />
        </RuleDesigner>
        <Parameters>
          <Parameter Name="EventName" Type="System.String, mscorlib" Direction="Optional"
          DesignerType="TextBox"
          Description="Event Name" />
          <Parameter Name="EventOuput" Type="System.String, mscorlib" Direction="Out"
          DesignerType="TextBox"
          Description="Event Output" />
        </Parameters>
      </Action>
      

Note: you can find more examples in the workflow15.actions4 file. These are all the out of the box actions. They are located at C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\1033\Workflow

    1. Deploy the solution to your SharePoint site.
      This is deployed as a farm solution and activate the feature at the web scope.
    2.  Open SharePoint Designer 2013 and open the site where you had activated the feature with the WaitForCustomEvent activity.
    3. Create a new Workflow in 2013 workflow platform
    4. In the ribbon, click Action > Add the Call HTTP Web Service to make a call to the external application through a RESTful service such that the necessary business logic will be executed.
      Pass correlating information and custom event name as query. This will be used to by the external application to call back to the workflow.
    5. In the ribbon, click Action and you should see in the Custom group as defined in .actions4 file.
      WaitForCustomEvent 12
    6. Create the following workflow with using the actions Set Workflow Status, Log to History List WaitForCustomEvent 13 

Creating a Mock External Application

This application will serve as a mock external system or application noted as “3” in the diagram above. This application will serve two purposes:

  • Self-hosted RESTful services that wraps the business logic of which the workflow can call into. You may to choose to host in IIS web server.
  • This business logic will make a call to publish a custom event notification to the running workflow instance using the SharePoint .NET Client Side Object Model.

Reference:
How to create Self-Host a Web API
http://www.asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api

  1. Add New Project
  2. Select Console Application
  3. Right-click the Project > Manage NuGet Packages
  4. Install Microsoft ASP.NET Web API Self Host
  5. Add assembly references > browse C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\
    • Microsoft.SharePoint.Client.WorkflowServices
    • Microsoft.SharePoint.Client.Workflow
    • Microsoft.SharePoint.Client.Runtime
    • Create a class and method
  6. Create a business class with the method
    PublishCustomWorkflowEvent(string url, string listTitle, string documentTitle, string eventName, string eventArgs)
    {
      using (ClientContext ctx = new ClientContext(url))
      {
        ctx.Credentials = new NetworkCredential("\\ ", "");
        // Best practice: retrive credentials in a secured credentials store.
    
        Microsoft.SharePoint.Client.WorkflowServices.WorkflowServicesManager workflowServiceManager = new Microsoft.SharePoint.Client.WorkflowServices.WorkflowServicesManager(ctx, ctx.Web);
        var workflowInstanceService = workflowServiceManager.GetWorkflowInstanceService();
    
        List list = ctx.Web.Lists.GetByTitle(listTitle);
        int itemId = 1;
    
        CamlQuery query = new CamlQuery();
        query.ViewXml =@""
        + documentTitle
        + "";
    
        ctx.Load(list);
        ctx.ExecuteQuery();
    
        ListItemCollection listItems = list.GetItems(query);
        ctx.Load(listItems);
        ctx.ExecuteQuery();
        if (listItems.Count > 0)
          itemId = listItems[0].Id;
    
        var workflowInstances = workflowInstanceService.EnumerateInstancesForListItem(list.Id, itemId);
    
        ctx.Load(workflowInstances);
        ctx.ExecuteQuery();
    
        // Once we get the workflow Instance, we can get the instance properties as shown below. Any properties in Workflow Initiation form will also be available:
        if (workflowInstances.Count > 0)
        {
        foreach (WorkflowInstance instance in workflowInstances)
        {
          WorkflowStatus status = instance.Status;
          if (instance.Properties.Count > 0)
          {
            var itemUrl = instance.Properties["Microsoft.SharePoint.ActivationProperties.CurrentItemUrl"];
    
            Console.WriteLine("Internal Status: " + instance.Status);
            Console.WriteLine(" Item Url: " + itemUrl);
            Console.WriteLine(" Workflow User Status: " + instance.UserStatus);
            string userStatus = instance.UserStatus;
            var propertyValue = instance.Properties["Microsoft.SharePoint.ActivationProperties.ItemId"];
    
            workflowInstanceService.PublishCustomEvent(instance, eventName, eventArgs);
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.WriteLine("Event Args: " + eventArgs);
         }
        } // end foreach workflowInstances
      }
    }
    
    
  7. Create a RESTful method in a controller class inherited from the APIController.
    [HttpGet]
    public string DoSomeWork(string url, string listTitle, string documentTitle, string eventName)
    {
      string output = string.Emptyy;
      // DO SOME WORK
    
      // publish custom event to running workflow instance
      PublishCustomWorkflowEvent(url, listTitle, documentTitle, eventName, eventArgs);
     return output;</pre>
    }
    
WorkflowManagerLogo

Workflow Manager 1.0 Setup and Validation on a Development Environment

Sharing my approach and knowledge of setting up a SharePoint 2013 development server with Workflow Manager 1.0. There are many step by step guides on installing and configuring Workflow Manager 1.0; however, this is from a topology point of view as well as areas of validating the setup.

My favourite SharePoint 2013 resource of the week

Out of all the resources posted on many blogs and on technet, I find the following link the best to kick off the learning curve:

SharePoint 2013 training for IT pros
http://technet.microsoft.com/en-us/sharepoint/fp123606

These videos are great because

  • Talk mostly net new features/functionality
  • Great starter for experienced SharePoint professionals
  • Good depth of overview on new features and functionality
  • Beneficial to site administrators/owners/contributors and not just for IT Pros
  • 14 Modules with about 2-7 videos each

Passed SharePoint 2010 Configuring (70-667) and Administrator (70-668) Certification Exams

Image

As the new version of SharePoint 2013 is approaching, I though I’d finish all 4 SharePoint 2010 exams.

Main topics: Upgrading, Farm topology, Search, Backup and Restore, Performance, Availability, Farm and Sandbox solutions, SharePoint features

Hardest type of questions where one has to select 3 steps out 6 and put in order, so such type of questions really test hands on experience in configuration.

Below is a summary of all SharePoint 2010 certifications

Image

Microsoft SharePoint Server Certifications
http://www.microsoft.com/learning/en/us/certification/cert-sharepoint-server.aspx

Networking for Application Developers

This post is about IT Networking. Having been in Web Application Development all of my career, I spent a couple of months learning about computer systems networking. My belief in being that well-rounded technology architect, basic networking knowledge is fundamental. More than just knowing how to use ‘ping’ and ‘ipconfig’ command line tools, I wanted to know more.

I wondered about the following:

  • Networking hardware in-depth
  • Network protocols
  • How to troubleshoot extensively
  • Other command line networking tools
  • DNS, DHCP, Firewall
My Sample Network Diagram

My Sample Network Diagram

And so for those of you in any type of application development, especially SharePoint, I highly encourage understanding the many basics elements of networking and server software.
 
The key benefits in doing so are
  • Interface with IT administrators and IT architects
    • Know how to ask the right questions
    • Understand their designs and implementation that they provide
  • Understand the infrastructure of your development machine, testing environments and production environments
    • As a result, troubleshoot problems and escalate to IT
    • Fix your own networking problems
  • Become a well-rounded Technology Architect
    • Design architecture with IT touch points in mind.
 
Understanding networking and system administration involves a different mind set and I can appreciate the skill and breadth of knowledge of a competent IT administrator. For example, IT must understand the relationships and dependencies of all layers of hardware, server software, networking protocols and configuration. Whereas a software developers’ troubleshooting process is simpler with the use of debuggers and custom error/exception logging. IT must rely on multiple tools with a methodical mindset in troubleshooting issues.
 
So invest in learning networking and troubleshooting issues, and you’ll impress the IT folks when you hand them root cause analysis and perhaps a recommendation to the solution 😉
 
And so to wrap up my knowledge and my notes, I have assembled a powerpoint presentation deck. There are some notes and resource links in the Notes section of each slide. I have presented to my colleagues and plan to speak at technology user groups and conferences.
 

Content Organizer Feature for Large Site Hierarchies

The Situation

A typical content management model that most end users are most familiar with are hierarchical in nature. For example, “Windows Explorer”  is hierarchical to manage files. A hierarchical structure has the characteristics to support a simple and natural feel to create classification scheme through folders, finding content and moving content.

However, the challenges and limitations from this simple hierarchical model is as follows:

  • Difficult to organize not knowing where documents should go.
  • Files lost or buried in deep file hierarchies.
  • Duplicated files in across different folders
  • Misplaced files
  • Files in flux tend to be stored in many “temp” folder.

Basic attributes of a content management system

  • Browsing/Navigation
  • Search
  • Maintainability
  • Content Metadata properties
  • Taxonomy Structure (Classification)

The SharePoint 2010 Content Organizer Feature

This feature helps alleviate the limitations, challenges and gaps of a simple hierarchiical content  management model. This feature provides the following value:

  • —Automated placement of content based on content metadata.
  • Avoid duplicate content by use of the versioning capability
  • Avoid misplaced content based on rules.
  • A centralized source drop-off location of content
  • Support Governance policies and processes to guide and control how the organization uses the technologies to accomplish content organization goals
  • Increase ease of use of content management for content authors
  • Contribute to overall information architecture effectiveness.
  • Scalable to Enterprise structure with many libraries.

The Content Organizer Feature use in large site hierarchies

A significant attribute of the content organizer feature is its scalability to accommodate a large site hierarchy with great breadth and depth of sites and document libraries.

The following diagram depicts a scenario where a word document being routed to a target document library.

  1. User uploads a document to a drop off library to the root site. Also populates the metadata properties of the documents
  2. A content organizer rule in this site matches against the values of the metadata properties and is set to be routed to a drop off library to a sub-site.
  3. A content organizer rule in this sub-site matches against the values of the metadata properties and is set to be routed to a drop off library to a sub-site.
  4. A content organizer rule in this sub-site matches against the values of the metadata properties and is set to be routed to a document library within this sub-site.

Note: Routing are not limited to sub site as it is in the diagram below, but can directly to any site within a SharePoint farm.

All in all, based on content organizer rules matching, documents can be routed to a drop off library to another site or to a document library within its site.  Note that a content organizer rule can not route documents from a drop off library of a given site directly to a document library of another site.

Routing documents from one site to any site in the site hierarchy. That is, to child sites, to sibling sites, to parent sites.

  • Analogous to a postal service – just drop the it in the “mail box”

Routing Rules from one site to another

Routing rules are configurable
Based on metadata properties including managed metadata (Taxonomy structures)
Configure versioning, library folder creation, alerts,

Trade-off in automated routing: Managing routing rules

Content Organizer Routing Rules manager must understand site hierarchy, overall information architecture, hold communication and processes with each organizational unit behind a site

Example scenarios

  • Submit documents to HR regarding certain policies
    Submit by uploading to sender’s site Drop Off Library with a Routing Rule to targeted to the HR site’s drop off library. There would be a rule that HR team would maintain to send document’s to appropriate document library within their HR site.

One Rules Manager

  • Manages all routing rules for all sites between site drop off library to another site’s drop off library; between a site’s drop off library to a site’s document library
  • Must have permissions to all sites.
  • Knowledge and skill is centralized to one person
  • One point of failure. Hit by a bus problem
  • A layer of process between site team and central rules manager

Many Site Rules Manager

  • Self-service model
  • More power and control
  • Faster cycle of updating routing rules
  • Broader training and knowledge to designated site rule manager
  • This person may be a business analyst on the team.

Roles in maintaining the information architecture

Content Author – The many content authors who create and edit documents in respective document libraries

Content Organizer Rules Administrator – The overseer and supervisor of keeping up to date the CO rules within the site hierarchy
Site Owner. Needs to engage with content authors and group leads to be aware of changes in the overall information architecture. Maintenance responsibilities are transferred to this role.  In smaller site hierarchies, a content author can take upon this role as a champion for the other content authors.

Governance Body – Business stake holders, content supervisors/leads, IT, architects to take part in the overall governance of operational and system effectiveness. Content organization and management should definitely be a governance agenda.

Conclusion

The new SharePoint 2010 content organizer feature supports for a much versatile and scalable information architecture. This includes the capability of automated routing given content organizer rules. Content organization can scale to large site hierarchies with much depth and breadth. As each site is abstracted with one and only one document drop off library, scalability is endorsed by rules from one site’s drop off library to another site’s drop off library. As content routing automation is liberated from many content author’s, note that manual administration is centralized to a content rules administrator for all or group of sites. The overall net effect of manual labour is reduced and higher level of information architecture effectiveness is achieved.

By Roy Kim
roykimtoronto@gmail.com
SharePoint Consultant