EndUserSharePoint 2010 » InfoPath http://www.endusersharepoint.com/EUSP2010 Just another WordPress weblog Tue, 26 Jun 2012 13:21:30 +0000 http://wordpress.org/?v=2.9.2 en hourly 1 Content Organizer in SharePoint 2010 http://www.endusersharepoint.com/EUSP2010/2010/05/28/content-organizer-in-sharepoint-2010/ http://www.endusersharepoint.com/EUSP2010/2010/05/28/content-organizer-in-sharepoint-2010/#comments Fri, 28 May 2010 14:00:03 +0000 Robert Bogue http://www.endusersharepoint.com/EUSP2010/?p=672 Guest Author: Robert Bogue

There are so many new features and enhancements in SharePoint 2010 that it’s hard to keep track of all of the great things going on. One of the interesting new enhancements is the Content Organizer. It started out its life in SharePoint 2007 as the records routing available only to records centers. However, In SharePoint 2010 it’s been set free for use in any type of site. There are a few unique ways that it can be used – and a few quirks you should be aware of if you want to leverage it in your environment.

The Content Organizer feature is a site feature. Once activated a new library – called the Drop Off Library – is created and two new links are added to the Site Settings menu – Content Organizer Settings and Content Organizer Rules. The settings allows you to restrict uploading to libraries that content organizer has rules for, controls whether content organizer rules can target other sites, controls additional folders being created once a specified number of items have been added to a folder, as well as some other settings. The content organizer rules is more interesting because it allows you to establish a set of rules as to where the content should go.

To start with you need to know that Content Organizer works with content types. That means you’ll need to create content types for the types of content that you want to route. Technically, you could use document but that’s not going to be very interesting. Once you have selected a rule in a new content organizer rule you can specify additional conditions. For instance, if you wanted to place expense reports that were for more than $10,000 in a different location (to drive a different workflow) you could specify that the total value is greater than $10,000 for the rule. The final part is to specify the target location and potentially the additional sub-folder based on the attributes. This is the powerful part, you can automatically route documents into folders based on the metadata in the item.

This feature can be leveraged to automatically route forms to the correct location based on content type – and a field in the content type. When you develop your forms in Microsoft Office client applications you can have fields from the document automatically populate columns of metadata in SharePoint – therefore providing the content organizer something to route on. You can learn more about how to create Office client templates that promote fields in my whitepaper written for SharePoint 2007 Managing Enterprise Metadata with Content Types. This shows you how to do this for Word documents. You can do similar things by promoting fields InfoPath forms. By doing this the user simply fills out the form and submits it. SharePoint does the work to move it into the right document library and folder.

One of the interesting side effects to this approach is that the documents aren’t moved immediately from the drop off library to their respective target. Somewhere along the way the process for providing the required metadata is skipped and as a result instead of an event receiver kicking off and moving the document, the system waits for a timer job to run which looks for items in the drop off libraries of the various sites that have been created and processes any of the items in the drop box – if possible. You can change the schedule – or force running of the Content Organizer Processing by going into Central Administration, selecting Monitoring, and Content Organizer processing. The default schedule of once a day may not be enough if you plan on heavily leveraging this feature.

You can also trigger processing of individual documents, if you were to go in and save the properties of the document, so it’s possible to get the content organizer to route an individual document immediately.

If you want to create a simple test case, that’s easy enough to do:

  1. Create a new content type built upon the document content type.
  2. Name the content type something like Office Document
  3. Add the ‘Author’ site column to the content type.
  4. Activate the Content Organizer feature
  5. Create a target library called ‘Documents’
  6. Add the Office Document content type you created to target library and to the DropOff library created by the content organizer.
  7. Remove the document content type from the DropOff library so uploaded documents default to the Office Document type you created.
  8. Create a content organizer rule (Site Actions-Site Settings-Content Organizer Rules) that routes Office Documents to the Documents library and creates folders by Author with the format of just %2.

Now when you upload word documents to the DropOff library, the author field will be automatically populated for you from what was in the document. The content organizer will see the content and route it to the ‘Documents’ library and create a sub-folder for the author’s name based on the rule you created.

Of course, you can create more complicated scenarios where you’re using Quick Parts to capture data in your Word document and routing based on that information, but this is a quick way to leverage the content organizer.

Guest Author: Robert Bogue

Robert Bogue, MS MVP Microsoft Office SharePoint Server, MCSE, MCSA:Security, etc., has contributed to more than 100 book projects and numerous other publishing projects.  Robert’s latest book is The SharePoint Shepherd’s Guide for End Users.  You can find out more about the book at http://www.SharePointShepherd.com.  Robert blogs at http://www.thorprojects.com/blog You can reach Robert at [email protected].

]]>
http://www.endusersharepoint.com/EUSP2010/2010/05/28/content-organizer-in-sharepoint-2010/feed/ 0
Creating filtered lookups in SharePoint 2010 with InfoPath 2010 http://www.endusersharepoint.com/EUSP2010/2010/03/18/creating-filtered-lookups-in-sharepoint-2010-with-infopath-2010/ http://www.endusersharepoint.com/EUSP2010/2010/03/18/creating-filtered-lookups-in-sharepoint-2010-with-infopath-2010/#comments Thu, 18 Mar 2010 03:28:59 +0000 Toni Frankola http://www.endusersharepoint.com/EUSP2010/?p=85 Guest Author: Toni Frankola
SharePoint Use Cases

One of the usual challenges with SharePoint 2007 was to build a lookup field between two lists but also apply a custom filter to the values being displayed.

Let’s consider a simple scenario: You have two lists on your site: Projects and Project Tasks. You want to link each task in Project Tasks list with a project in Projects list. This was simple even in v2007, you only had to create a lookup column and you were good to go.

But what if you wanted to link tasks with only active Projects (each project has a Yes/No column indicating if it is active), that was a bit more challenging.

Let’s check how you can solve the problem with SharePoint 2010 (Enteprise edition only). Here is what you need to do:

  1. On a SharePoint site create one custom list Projects with two columns: Title and Active (Yes/No column). You can add additional columns if you need them.
  2. Use Tasks list list template and create a list Project Tasks. Add one additional Lookup column connected to the Projects list (do not select “allow multiple values”)

SharePoint is going to create all the required forms for you. The default form for Project Tasks will look like this. The problem is, it shows inactive projects.


To change this, follow these steps:

  1. Open your list. In the List Tasks > List Ribbon click Customize Form button. You must use IE to use the button. You will perform form customization with InfoPath 2010.

  2. In the InfoPath form designer right click on Project field and click on the Drop-Down list properties option.

  3. On the newly opened dialog click Add button

  4. You need to create new connection to receive data from the Projects list. Select Create a new connection to: Receive Data. Click Next >.

  5. Select SharePoint library or list as your source. Click Next >.

  6. Type in the URL of your SharePoint site. Click Next >.

  7. Select the Projects list you created before. Click Next >.

  8. From the fields list, select the following fields: Title, and Active. Select to sort by Title. Click Next >.

  9. Click theNext button a few times to finalize this wizard. Once completed you will be taken back to the properties dialog.

    Select ID field as value field. Click the button Next to Entries field, then Select a Field or Group dialog should appear.

  10. On the Select a Field or Group dialog click on the Filter Data… button

  11. On the filter dialog, create a filter as shown on the picture below. This will force the drop down to load only active projects.


Close all dialogs and save the changed form. When you go back and try to create a new item in your list, the projects dropdown will only show active projects.



Conclusion

This article describes how you can create a filtered lookup for SharePoint 2010. It is easy to use and no code is required to make it work. A pure end user solution. There are some limitations: it does not resolve the problem of updating old Tasks that have already been assigned to inactive projects. It also only works with Enterprise edition. In future blog posts I will try to create some alternatives for SharePoint foundation.

Guest Author: Toni Frankola
SharePoint Use Cases

Toni started his Web adventure in late 90’s and has been working with various web technologies ever since. These days his main focus is SharePoint technology. He is active in the SharePoint community via his SharePoint blog at http://www.sharepointusecases.com/ and Twitter http://twitter.com/tonifrankola, and also speaks about SharePoint at various SharePoint conferences. Toni runs his own company Acceleratio Ltd., that specializes in SharePoint consulting and developing software products, and leads the Croatian SharePoint User Group. 

]]>
http://www.endusersharepoint.com/EUSP2010/2010/03/18/creating-filtered-lookups-in-sharepoint-2010-with-infopath-2010/feed/ 4
How To: Use default SharePoint approve/reject InfoPath task form in custom Visual Studio workflows http://www.endusersharepoint.com/EUSP2010/2010/03/15/how-to-use-default-sharepoint-approvereject-infopath-task-form-in-custom-visual-studio-workflows/ http://www.endusersharepoint.com/EUSP2010/2010/03/15/how-to-use-default-sharepoint-approvereject-infopath-task-form-in-custom-visual-studio-workflows/#comments Mon, 15 Mar 2010 02:17:09 +0000 Eugene Rosenfeld http://www.endusersharepoint.com/EUSP2010/?p=35 Editor’s Note: In a new series of articles, I will be introducing you to some of the speakers who will be presenting at the SharePoint Evolutions Conference in London next month, pointing you to articles on their sites, offering downloads of white papers, and publishing articles on their subjects of expertise. — Mark Miller

Eugene Rosenfeld
Things that Should be Easy

I needed to write a customized approval workflow. I know I could use InfoPath to create custom approval task forms, and I saw many posts showing how this is done. But if I could use the SharePoint Approval Workflow task forms, I could save a lot of development time and deployment effort.

This post focuses on how I was able to use the out of the box InfoPath approval approve/reject task forms forms in my custom Visual Studio SharePoint workflow.If you’re looking for a general how-to post on creating SharePoint workflows with Visual Studio, this is not the post for you. I would instead point you to Serge Luca’s excellent 20-part series on creating SharePoint workflows with Visual Studio.

Creating the task

Here’s the skinny on what you need to do in order to use the default Microsoft Office SharePoint Server 2007 (MOSS) approve/reject InfoPath form in a custom Visual Studio workflow.

1. Create a SharePoint workflow project

There are many ways to do this, so I won’t go into details here. My personal favorite way is by using the WSP Builder Visual Studio workflow template project. Just make sure that your workflow class inherits from System.Workflow.Activities.SequentialWorkflowActivity or from System.Workflow.Activities.StateMachineWorkflowActivity.

2. Set the TaskListContentTypeId attribute

Edit the elements.xml file in your workflow feature definition. Set the TaskListContentTypeId attribute value to use the MOSS workflow task content type id:

<Elements>
    <Workflow
        Name="MyWorkflow"
        Description="This is my custom workflow."
        …
        TaskListContentTypeId="0x01080100C9C9515DE4E24001905074F980F93160"
        >
        …
    </Workflow>
    …
</Elements>

3. Add the Task_FormURN and ExtendedStatusColumnValues elements

Continue to edit the elements.xml file in your workflow feature definition. Add the following MetaData element under the Workflow element:

  <Elements>
    <Workflow …>
        <MetaData>
          <Task0_FormURN>urn:schemas-microsoft-com:office:infopath:workflow:ReviewRouting-Review:$Subst:LCID;</Task0_FormURN>
          <Task1_FormURN>urn:schemas-microsoft-com:office:infopath:workflow:ReviewRouting-Review:$Subst:LCID;</Task1_FormURN>
          <Task2_FormURN>urn:schemas-microsoft-com:office:infopath:workflow:ReviewRouting-Review:$Subst:LCID;</Task2_FormURN> 

          <ExtendedStatusColumnValues>
            <StatusColumnValue>$Resources:ReviewFeedback_CanceledStatus</StatusColumnValue>
            <StatusColumnValue>$Resources:ReviewFeedback_ApprovedStatus</StatusColumnValue>
            <StatusColumnValue>$Resources:ReviewFeedback_RejectedStatus</StatusColumnValue>
          </ExtendedStatusColumnValues>
        </MetaData> 

        …
    </Workflow>
    …
  </Elements>
  

4. Add a CreateTask activity to your workflow

Add a CreateTask activity to your workflow. Make sure to set the TaskType property on the TaskProperties of the CreateTask activity to 1. This will tell the workflow runtime to create the task using the Form Urn corresponding to the inner text in the Task1_FormURN element. The CreateTask activity’s MethodInvoking event is a good place to set the property.

private void createTask1_MethodInvoking(object sender, EventArgs e)
{
    //initialize task infrastructure data
    this.createTask1_TaskId1 = Guid.NewGuid();
    this.createTask1_TaskProperties1 = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();
    this.createTask1_TaskProperties1.TaskType = 1;

    //set task remaining properties
    //...
}

Processing a workflow task

Now that you’ve created a workflow task that uses the default approval form, you will want to your workflow to do something useful when a user approves or rejects the task. Here is how to detect when a user approves or rejects the workflow task.

5. Detect task change with OnTaskChanged

This is fairly straight forward: add an OnTaskChanged activity to your workflow. Set the task ID and correlation token to correspond to the ones used when creating the task in the previous section. See Serge Luca’s SharePoint workflow series for details.

6. Task approved or rejected

Here’s the interesting part. Whether a user approves, rejects, reassigns, or requests a change in the task form, the task is always marked as Complete. The actual value that corresponds to what the user selected is stored in the TaskStatus in the ExtendedProperties collection of the SPWorkflowTaskProperties class. The following is a table that correlates the user’s approval action to the value of the TaskStatus extended property:



User Action
TaskStatus Value
Approve
“#”
Reject
“@”
Cancel
[no change]

Here’s a sample helper method that checks whether a particular workflow task was approved:

public static bool IsTaskApproved(SPWorkflowTaskProperties TaskProperties)
{
    return TaskProperties.ExtendedProperties["TaskStatus"] != null
        && TaskProperties.ExtendedProperties["TaskStatus"] as string == "#";
}

Anything else?

That’s it. There is surprisingly little work involved in using the default MOSS approvals forms in your own custom SharePoint Visual Studio workflows, once you know what to look for that is. I’d like to wrap us this post with the benefits to this approach and a few things you should keep in mind when working with the default workflow forms.

Some benefits to this approach

Here are just some of the benefits you get when you reuse the existing MOSS approval task forms rather than creating your own customs InfoPath task forms:

  • No InfoPath forms development
  • No InfoPath forms deployment
  • Out of the box user interface for:
    • Approve
    • Reject
    • Cancel
    • Reassign Task
    • Request a change
    • Instructions to approver
    • Capture approver comments
  • Out of the box multi-language user interface with appropriate MOSS language packs. Notice the references to “$Resources:”.

A few things you should know

  • Any action in default task forms except Cancel marks the task “Complete”. Your workflow must then create a new task with the desired action from the completed task. For example: If a user re-assigns the task to a new user, the task for the user is marked complete. Your workflow must create a new task and assign it to the new user.
  • The MOSS task forms derive most of their data from fields in the ExtendedProperties of the task, not the main task properties.

Guest Author: Eugene Rosenfeld
Things that Should be Easy

Eugene Rosenfeld is the CTO of Black Blade Associates. He started his IT career as a database programmer and soon moved into enterprise application integration (EAI) and portal systems. Eugene holds a strong belief that all systems should have the innate ability to intelligently communicate with one another. Most recently he has been heavily involved with distributed systems architecture, Services Oriented Architected (SOA), peer-to-peer systems, and cloud computing.

Eugene has been recognized for his community involvement by Microsoft through their prestigious MVP program. His MVP profile is available at https://mvp.support.microsoft.com/profile/Eugene.Rosenfeld.

]]>
http://www.endusersharepoint.com/EUSP2010/2010/03/15/how-to-use-default-sharepoint-approvereject-infopath-task-form-in-custom-visual-studio-workflows/feed/ 33