Aidan Garnish
MOSS 2007 and other Microsoft technologies

Hiding and showing optional sections in InfoPath 2007

August 22, 2008 14:36 by Aidan

It is possible to add logic to InfoPath forms so that certain fields are displayed based on the value of another field. For example - if a user fills in their age on a form as being 17 or greater then the question - Do you hold a full driving license? - becomes visible. In the UK this question is not relevant if the user is less than 17.

To do this using InfoPath 2007 you will need to create a form with the two questions - How old are you? and - Do you hold a current driving license? Add a two row, two column table to your form. Add the How old are you? question in the top left box. In the top right box add a text box that takes a whole number, call it Age and set it with a default of 0.

Next, merge the two cells in the bottom row and add an optional section control. Insert a table with one row and two columns to the optional control. Add the Do you hold a current driving license? question to the table. In the right hand table cell add a drop down list box that has options of select..., Yes and No.

Set the section properties to display the section by default. You should now have something that looks like this when previewed:

Next right click on the optional section and select 'Section properties...' Select 'Display' and then 'Conditional Formatting...'

Click Add - set the condition to be Age is less than or equal to 16 and check the 'Hide this control' option.

Preview the form again and you should see:

Enter an age greater than 17 to display the optional question:

Change the age to less than 17 and the question will be hidden again.


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories:
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Adding HTML to a rich text box in InfoPath using C#

August 13, 2008 14:24 by Aidan

A handy link that explains how to add html tags to your rich text boxes in InfoPath using C#.

 http://enterprise-solutions.ikreate.nl/blog/2008/07/how-do-i-get-html-tags-to-appear-as-html-and-not-as-plain-text-in-a-rich-text-box/


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories:
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Creating an InfoPath installer file with Visual Studio 2008

August 13, 2008 08:58 by Aidan

Having created an InfoPath form project using Visual Studio 2008 and adding some code behind to the form I wanted to deploy it to SharePoint. The easiest way to do this should have been to use the publishing wizard to create an installer file. However, there seems to be a bug in Visual Studio 2008 that prevents you from selecting this option in the wizard. The message displayed is that you need VS 2003 or 2005 installed to create the installer file.

There is a way around this by using the REGFORM.exe tool found in C:\Program Files\Microsoft Office\Office12. The tool allows you to create a .js file that marks the .xsn as fully trusted so that it can be added to the managed forms collection on your MOSS farm.

First you need to go to VS and the Publish option in the Build menu. Instead of selecting the create installer option publish to a network location and create the .xsn on your file system.

Next, open up a command prompt and navigate to C:\Program Files\Microsoft Office\Office12\regform.exe.

Supply the necessary parameters - these are, the /U the URN for the form which can be found in VS, File - Form Properties - ID, /T Yes to mark the form as fully trusted (this is necessary to deploy it to SharePoint) and finally the path to the .xsn file.

You should end up with something like - regform.exe /U urn:schemas-microsoft-com:office:infopath:MyForm:-myXSD-2008-08-07T13-36-16 /T Yes C:\Forms\MyForm

Running the command will create a .bak file and a .js file in the same folder as the .xsn. Run the .js file and then open SharePoint central administration. Go to the Applications tab and under the InfoPath forms services section select Manage Form Templates.

This Microsoft article explains the rest of the process to make the form available in a site collection in detail

If you run the .js in your development environment you will need to unregister the form before you will be able to open it again from Visual Studio. To do this open the .js file in Notepad and change var fInstall = true; to var fInstall = false; - Run the .js file again and this time the message prompts will tell you the form is being unregistered. You can now run the form from Visual Studio again.


Currently rated 3.0 by 1 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Customising the pages approval for MOSS 2007 web content management

June 15, 2008 20:28 by Aidan

When I first looked at MOSS WCM to assess whether it would meet the needs of my previous employers web content approval processes many moons ago I was pleasantly surprised to find out how much you could achieve out of the box. Recently I needed to revisit this topic for a new client and promptly forgot what I had discovered and charged off looking at custom workflows using SharePoint Designer or Visual Studio. Fortunately before I got too far down that road I reigned myself in and went digging through the workflow settings of a pages library. This is what I found out/reminded myself of:

  • Using the set up screens you can change the lists used to store the workflow tasks and workflow history
  • Start options can be changed although the standard settings - 'Start this workflow to approve publishing a major version of an item.' is the most appropriate for approving a page for an Internet or extranet site
  • It is possible to switch between serial and parallel approval - most useful if a web page has to go to more than one person or department for approval or the page needs to be approved by people in a specific order
  • There are options to allow the following - 'Reassign the task to another person' and 'Request a change before completing the task' - these can be turned on or off as appropriate
  • Default approvers can be entered into the workflow

With all these options available it is possible to accomodate the vast majority of scenarios for approving web pages without having to resort to SharePoint Designer or Visual Studio. Even scenarios that involve several people or departments in the process can easily be catered for and using the 'Request change before completing the task' option even allows the page to be sent back for changes before approval is given. 

The moral of the story here is a common one when developing with SharePoint - don't try to reinvent the wheel, the SharePoint development team got there first!


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Creating MOSS 2007 features - a reference

May 20, 2008 10:03 by Aidan

Some useful links for creating MOSS 2007 features that I have found helpful:

Creating Features

Deploying Features

Removing Features


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: MOSS 2007
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Creating new site permissions

May 6, 2008 18:57 by Aidan

When using SPS 2003 some of the business coordinators requested a way to allow users to manage permissions whilst not being able to create a new sub-site. This was not possible out of the box as the administrator role allowed the user to create new sub-sites as well as manage permissions.

 In MOSS 2007 this is now possible by ceating a new site permission.

   1. Go to Site Action Menu.
   2. On that menu, go to Site Settings.
   3. Choose People and Groups
   4. On the quick launch bar, there is a link to Site Permissions.
   5. On the Settings menu, select Permission Levels.
   6. On the Permission Level page, select new to create a new permission level.
   7. Add the permission that you want (in this case, Manage Permissions but not Create Subsites).
   8. Name it Permissions Manager
   9. You can now assign users to that permission level 

 


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories:
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Retrieving items from a MOSS 2007 list using web services

April 15, 2008 13:32 by aidan

A quick code snippet to remind me how to access a list using the in built web services: 

                MOSSWebRef.Lists lists = new MOSSWebRef.Lists();
               
                lists.Credentials = new System.Net.NetworkCredential("username", "password");

                string exportList = "NameOfList";

                XmlNode node = lists.GetListItems(
                    exportList,                   
                    string.Empty,
                    null,
                    null,
                    ConfigurationManager.AppSettings["MaxRecords"].ToString(),
                    null);

                XmlTextReader xr = new XmlTextReader(node.OuterXml, XmlNodeType.Element, null);          
                string strValue = "";
                while (xr.Read())
                {
                    if (xr.ReadToFollowing("z:row"))
                    {
                         if (xr["ows_nodeName"] != null)
                        {
                           strValue = xr["ows_nodeName"].ToString();
                        }

                    }

               }


Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: MOSS 2007
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

MOSS 2007 Content Deployment

March 4, 2008 08:28 by Aidan

MOSS 2007 provides a mechanism to deploy content from one farm to another. This is most useful when you are using the publishing site template to produce Internet sites and allows you to set up deployment schedules for the content that web editors are producing.

First you need to set up a path that tells MOSS what to deploy and where to deploy it to. A job is then created that uses the path and allows you to select specific content and how often it should be deployed.

The first time I ran a job I got an error saying that some lists and libraries already existed and the job failed. This is because you have to deploy to a site collection that was created using the blank site template ie. it has no template at all.

After a site has been deployed for the first time if a site column is removed from a content type then the same column on the destination site collection will also need to be removed otherwise the following error is reported and the deployment fails:

Site columns which are included in content types or on lists cannot be deleted. Please remove all instances of this site column prior to deleting it.

For a more comprehensive list of potential issues see - http://soerennielsen.wordpress.com/2007/06/19/the-long-path-to-content-deployment/

Also see: http://www.sharepointnutsandbolts.com/2008/04/recipe-for-successful-use-of-content.html


Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Assigning url and description to a hyperlink column

January 22, 2008 15:39 by aidan

item["HyperlinkColumn"] = strUrl + ", " + strDescription;

It is important that there is a space between the comma and the description.


Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: MOSS 2007
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Space in column names

January 22, 2008 13:50 by aidan

When referencing columns programatically or in CAML that have a space in the name replace the spaces with _x0020_

For example "End Use" becomes "End_x0020_Use"

The format required to access non-alphanumeric column titles is this (IN LOWER CASE):

_x00[the hex code]_

Here are a few more examples:

Char         Code 

[space]      20      i.e. _x0020_
<            3C      i.e. _x003c_
>            3E
#            23
%            25
{            7B
}            7D
|            7C
\            5C
^            5E
~            7E
[            5B
]            5D
`            60
;            3B
/            2F
?            3F
:            3A
@            40
=            3D
&            26
$            24

To reference a column called “e-mail” you would need e_x002d_mail.

This page has a list of all the Hex Codes of some other symbols:http://www.asciitable.com/

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: MOSS 2007
Actions: E-mail | Permalink | Comments (4) | Comment RSSRSS comment feed