Thursday, 21 February 2013

CreateTaskWithContentType (03)



  • Create a Workflow Project (part 01)
  • Create Custom Task List (part 02)
  • Create a Custom InfoPath form (part 03)
  • Create a Workflow utilizing the CreateTaskWithContentType (part 04)
  • Set up your workflow to work (part 05)

  • Build a Custom InfoPath Form

    1.) Create a blank form that looks like the following:
    there really only is two controls on it, that's a text box and a button. Make sure you pick blank form on the file tab.

    2.) give your field a very descriptive name like kiwimango; goto the Data Tab and hit show fields
    this will bring up a tree view for your fields, rename the default value to something descriptive, don't use kiwimango...
    You probably should change your group name to something other than myFields, but hey do as I say not as I do.

    3.) let's set up that Go button, right click on it and hit Button Properties.

    click submit options, This will bring up the submit options dialogue box.

    check off  "Allow users to submit this form", select hosting environment from the drop down. Add a main submit.

    4.) Go to to File->Info->Form Options (Advanced form options)

    5.) Once The Form Options dialogue pops up, select Security and Trust, remove the check from "Form template requires the following level of trust from the user:", now I Change it to full trust, but it should work with domain (and is probably a better practice).

    5.)Save the form like you would any regular document in MS office, but choose the name wisely. Pick something that's descriptive but not what you're going to want in your visual studio project.

    6.) Once you've saved your document, publish it to a network location, File-> Publish, click Network Location.

    7.) This will start your publishing wizard, the first two steps are:

    • pick a network location to publish to. (where the file is saved locally) 
    • give your form a template name. 


    8.) Next you're going to be given the path to your file you just published, just clear that sucker out and leave it blank, then hit next. (no image for this step provided)

    9.) If you followed instructions you should get the following

    If you didn't get something along these lines, go back and remove that path in step two, otherwise hit publish, then close.

    10.) Now you have to add your published form to your Visual Studio Project. Right click your workflow item and add existing item.
    11.) After the form is added you have to change the deployment type of the InfoPath form to ElementFile, just click on your form and hit the F4 key on your keyboard.


    12.) With that complete, make sure your workflow1 (or whatever you've named it) is included in the feature, while you're in that neighbourhood, there are two buttons at the bottom Left of that screen, Design and Manifest, hit the manifest one. in the manifest click the edit options, below is more or less what you should see.

    in the edit window you're going to paste the following

    <?xml version="1.0" encoding="utf-8" ?>
    <Feature xmlns="http://schemas.microsoft.com/sharepoint/" ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver">
      <Properties>
        <Property Key="GloballyAvailable" Value="true" />
        <Property Key="RegisterForms" Value="Workflow1\*.xsn" />
      </Properties>
    </Feature>
    
    
    Make sure that your RegisterForms property has the correct path, if you changed it from the default Workflow1 make sure you reflect that change here. also I remind you this is for share point 2010, if you're dealing with 2007 change the version to 12.0.0.0 and there may be something else i wouldn't know cause I've only recently jumped on the SharePoint band wagon. and I think it's 15.0.0.0 for SP2013

    One thing to note, is that if you have a Custom feature receiver it will no longer work.

    Deploy your project, and continued in my next post.

    Continued