Back for another installment of the Knowledge base site I’ve been putting together, now we’re on to Part IV, setting up the wiki for the site. Let’s just have a quick recap on the previous parts:
- Part I – Creating the tables needed for the Document library and the workflow to create new sections if required
- Part II – Adding validation to the list form field so that the user could not select both an existing section and also add a new one.
Part IV is going to be quite brief. We’re going to create the Wiki list and then you’re going to need to follow the same instructions from Part II and Part III to add the code in the correct places to do the same job. I’ll point out when and where as we go along. Firstly lets get a custom list built to the following specifications:
|Field Name||Field Type|
|Name||Single Line of Text|
|Wiki Content||Multiple lines of Text|
|Category||Lookup – Set the lookup to the Categories table|
|New Category||Single Line of Text|
|Tags||Single Line of Text|
So, as you can see we have a new custom list which has a lot in common with the Document Library we created back in Part I. Now what we need to do is create another workflow, this workflow is going to be very similiar to the one we created for the document library but the main difference is that it will not require the validation that the description be completed because we’re going to be adding the category information in before we create the list item (as opposed to the document library where the file is uploaded first).
Step 1: Open SharePoint Designer and then open the site which you have created.
Step 2: Create a new Workflow and attached the workflow to the Wiki list. Also select the workflow to automatically start when a new item is created and when an item is changed. As shown below:
Step 3: Add a condition which checks if New Category is not empty.
Step 4: Now we’re going set up the actions for the new category. The first action is to create a new list item is the Categories list. Take a look at the screenshot below, easy enough to follow.
Step 5: Once the new category list item has been created we need to update the current item, moving the value from New Category to Category. This is essentially done by setting Category to the object created in the previous action and then set New Section to blank.
Assuming that you Wiki List is called Wiki then the files should be in the following location:
Follow the process below for each of the files:
Right click on the file and Check Out the document and then open it. Now follow the steps like so:
- Select the Split view so that you can see both code and the visual representation
- On the visual representation click on the List Form Webpart, this will highlight the code that corresponds to this
- Scroll the code until you’re at the bottom of the highlighted code.
- On the code, directly after the closing WebPartPages:WebPartZone bracket add a couple of blank spaces.
- Save the file
- Return to the Wiki list from the internet browser and add a new item.
- The code will take the value stored in the tags field and create an array based of values using “;” as an indicator that the next index needs to be started
- Once the array is created the code will loop through each index and query the database to check if the String value in the index exists as a tag in the Tags list.
- If the String doesn’t exist then a soap request will be used to create a new list item for that tag, essentially adding the tag to the Tags list
You will need to take a look at Part III for details on adding this code as it is far too detailed to repeat on this post.
Now you should have a site containing the following:
- A document Library with Category validation and checks for tags and adds new items, if required, to the tags list
- A Wiki custom list with Category validation and checks for tags and adds new items, if required, to the tags list
- A workflow associated with the document Library which creates new categories if required
- A workflow associated with the wiki which creates new categories if required
- A Categories list
- A Tags List
The next step is going to be to create the visual aspect for the user interface, part V coming very soon…..