Monday, December 21, 2009

SYMPTOMS

You use Microsoft Office SharePoint Designer 2007 to add a Custom List Form Web Part on a Microsoft Windows SharePoint Services 3.0 site. Then, you try to attach a file by clicking Attach File in the custom form on the Web site. When you do this, you receive the following error message:
This form was customized not working with attachment.


RESOLUTION

To resolve this problem, follow these steps:
Apply hotfix 953749.For more information about how to do this, click the following article number to view the article in the Microsoft Knowledge Base:
953749 (http://support.microsoft.com/kb/953749/ ) Issues that are fixed in Windows SharePoint Services 3.0 by the Windows SharePoint Services 3.0 Infrastructure Update
Edit the XSL code in the .aspx page. To do this, follow these steps, as appropriate for your situation. Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. For custom edit item forms and for custom new item forms
In the XSL code block, locate the following code.

Replace the lines of code that you located in step 2a with the following lines of code.

ListForm













Note The XSLT code must have the ControlMode set to "New" for custom new item forms and to "Edit" for custom edit item forms.
Locate the following line of code.

Paste the following code above the line of code that you located in step 2c.








Note This code sample is for a custom edit item form. If you use a custom new item form, replace ControlMode=”Edit” with ControlMode=”New” in the code. Additionally, in the __designer:bind attribute, the first parameter for the ddwrtDataBind function should be "'i'" (insert) for a custom new item form and "'u'" (update) for a custom edit item form. For example, the code may resemble the following code.

Save the form.For display forms
Open the Custom List form.
Move the cursor to the table cell in the custom form control where you want the attachment to be displayed. Then, right-click the cell, point to Insert, and then click Row Below. A new table row that has two column cells is created.
Move the cursor to the left table cell of the new row, and then type Attachments.
Move the cursor to the right-side table cell of the new row, switch to Code view, and then enter the following code.

Save the form.Notes
If you make more changes to the page, SharePoint Designer 2007 may automatically add a unique ID to the attachment code that you added. For example, “” is changed to “.” This process may cause JavaScript errors on the page. If this issue occurs, delete the “{generate-id}” tags that are added automatically.
You may receive the following error message:
An unexpected error has occurredTo resolve this issue, move the Custom List form outside the Web Part zone.
You receive the following a JavaScript error message:
Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.If you receive this error message, make sure that the ListForm Web Part that is on the page by default is still there. Then, set the Layout to Hidden, and close the Web Part. To do this, follow these steps:
Right-click the List form Web Part in SharePoint Designer.
Click Web Part Properties, and then click Layout.
In the Layout dialog box, click to select Hidden, and then close the Web Part.




Customize the NewForm.aspx

To begin our modification journey let’s start by opening up a team site in the browser and taking a look at the default New Item page that we have to work with. Figure 1 shows the home page for the Technical issues team site that we will be modifying.

Figure 1: Technical Issues home page
By selecting the Add new announcement link we are presented with the standard Announcements: New Item page (Figure 2) for adding announcements to our list. Note the columns that are currently available for data entry: Title, body and Expires.

Figure 2: Announcements: New Item page
To modify this page we must open it in SharePoint Designer 2007 and then add a new custom List Form Web Part that displays only the fields that we wish our users to modify. Start Designer and then connect to the website that contains the list whose form you wish to modify, in our case that would be the Technical Issues Team site as shown in Figure 3.

Figure 3: Technical Issues site loaded into Designer 2007
Next we need to open up the relevant NewForm.aspx page. In the Folder List expand Lists and then expand the list you want to work with. Again, we are going to modify the Announcements list so expand Announcements and select NewForm.aspx.

Figure 4: NewForm.aspx in the Announcements list
As you can see in Figure 5, the Announcements: New Item page contains a customized List Form Web Part that will display the fields we noted earlier when we opened the page in the browser. While we can edit the properties of this particular web part, we cannot edit the contents, nor do we want to delete the web part from the page as this can break the NewForm.aspx page and cause it to error out when you try to actually use it in your site. Stick with me because we are going to cover how to deal with this as we go though this tutorial. For now, we want to add some space below the current web part so that we may add our own custom list form to do with as we like.

Figure 5: The default NewForm.aspx page
Select the area just below the current list form and press Enter twice to give yourself some room to work with. Next, to add our custom list form go to your tool bar and select Insert>SharePoint Controls>Custom List Form.. as shown in Figure 6.

Figure 6: Add a new Custom List Form
Selecting the Custom List Form will bring up the List or Document Library Form dialog shown in Figure 7 where we need to choose which list we are tying this new web part to as well as the type of form we want to create. In our example we are keeping the default Announcements list since we are creating a new Announcements form as well as selecting the New item form radio button because we want to use this web part to create new announcements for our site. If we were going to modify the web part for a different document library or list within our site we would need to choose that library or list from the drop down menu. If instead of creating a new item, we wanted to use this form to edit an already existing item; we would select the Edit item form radio button instead.

Figure 7: List or document library selection dialog
When finished you should have your new list form web part as displayed in Figure 8.

Figure 8: Newly added List Form web part
As mentioned earlier, the form we are using is pulling its data fields from the columns that are defined in the list or library that we are connecting the web part with. What if we want to create our own columns or collect information about items that are not currently part of the list or library? To do this we would need to add additional columns from already existing Site columns or simply create our own to suit our needs. To accomplish this task we must venture into the settings of the list or library that contain the items we want to collect or modify data from.
We’ll start by selecting the View All Site Content link at the top of our Quick Launch menu at the left hand side of the browser window. This will bring up the All Site Content screen as seen in Figure 9. Next we must select the list we are working with, in our case that would still be Announcements.

Figure 9: The All Site Content page
Once you are in the list or library that you want to add information to, select the Settings menu and then select List Settings, (Figure 10).

Figure 10: List Settings menu option
On the settings page for your list or library you will see a section titled Columns, (Figure 11). It is here that we can add columns from the already defined site columns in SharePoint or create a new column to collect whatever data we need for the items in our list.

Figure 11: Create or add new columns section
When you have defined the metadata types that you wish to collect on your list items, we need to make those columns available in our new List Form Web part. To do that, we’ll go back to SharePoint Designer 2007 and add the form elements into our new form.
In the Toolbox task pane you’ll notice a section labeled SharePoint Controls (Figure 12). If the Toolbox is not visible in your Designer, go to the Task Panes menu item and select Toolbox. Expand the SharePoint Controls and you’ll see the various elements that can be inserted into your form to allow you to collect the data that is relevant to your list items. These elements directly map to the column data types that are defined when you add or create a new column in any library or list within SharePoint.

Figure 12: SharePoint Controls in the Toolbox task pane
Select the data view control that maps to the type of field whose data you wish to collect and drag it from the toolbox and drop it into your new list form. This will bring up a control dialog in which you will map the control to the column in your list whose data you are interested in. You’ll notice in Figure 13 that we dropped a text box into our form and we are going to map it to the Modified By field in our Announcements list.

Figure 13: Mapping a list field to a data view control
Next we merely give our new control the proper label, (Figure 14) and then save our new NewForm.aspx page.

Figure 14: Adding the label for our control
Since we are modifying the default page you will receive a warning (Figure 15) that the page is being altered from the site definition. Select Yes to save the changes.

Figure 15: Site definition warning dialog
Now we can view our new New Item page in the browser and see just what we have done. As you can see in Figure 16 there are now two list form web parts on the page; our original web part with the default configuration of fields, and our new web part with its modified content.

Figure 16: New Item page with two list forms
Since we want to present only a single form for our users to fill out, with only the items we have selected for them to modify, we must hide the original web part on the page. To accomplish this we again return to Designer 2007 and the NewForm.aspx page we have been working with.
Select the original ListFormWebPart and hide it by right-clicking and selecting Web Part Properties from the popup menu. (Figure 17)

Figure 17: Selecting Web Part Properties popup
In the Announcements properties expand Layout and check the box for Hidden (Figure 18). Again, we don’t want to delete the default web part since this can break the page and cause it to error when trying to load within SharePoint. Remember to save the new page.

Figure 18: Hiding the default Announcements web part
We now have our Announcements: New Item page that only displays the elements that we want to expose to our users as seen in Figure 19.

Figure 19: The new Announcements: New Item page
Using the principles shown here you can create a form to display any of the content columns that are associated with your lists and libraries in your SharePoint deployment. But what about exposing different columns to different sets of users? By applying what we have learned here you can create separate web parts that expose only the columns you want exposed for each set of users and then apply audience filtering to make them accessible to the proper groups.
So what about removing elements from the Edit Item form so that metadata isn’t improperly changed when a user edits the properties of an existing document? Let’s take a quick look at the Edit item page for a document library where content types are enabled. Notice in Figure 20 in our Problem Reports library App Crash document properties there is a field to select the content type that is associated with this document. A misinformed user could potentially change the content type associated with this document and thereby change the metadata or even workflow’s attached with this document type.

Figure 20: Edit Item page showing Content Type selection box
To prevent this situation for occurring we need to modify the default EditForm.aspx page that is associated with this document library. To do that we need to use Designer, just as we did when modifying the NewForm.aspx page earlier.
Start by connecting to the site that contains the document library (our Technical issues site) and then locate the library you want to work with (Problem Reports in our case). Expand the library and you will see the associated forms as shown in Figure 21. This time we want to modify the EditForm.aspx page so open it with Designer.

Figure 21: Selecting the library to work with
Now just as we did with our previous NewForm.aspx page we need to add a new list form web part to the page and hide the existing default web part from our users. This time, however, when we insert our new web part we must be sure to connect it with the proper library (Problem Reports) as shown in Figure 22 and then select the proper form type (Edit item form) that we are creating as shown in Figure 23.

Figure 22: Connecting the form to the proper library

Figure 23: Configuring the List Form Web Part
From there it is simply a matter of configuring the field types, adding the proper SharePoint controls and saving our page. Figure 24 shows the modified Problem Reports library Edit Item page without a content type selection box.

Figure 24: Edit Item page without the Content Type selection box
So there you have it. You can now modify your default forms to display just the fields you want them to while hiding the ones you need to. I hope you have found this tutorial useful and if you should have questions or comments, please let us know. Till next time…

Customize the NewForm.aspx

To begin our modification journey let’s start by opening up a team site in the browser and taking a look at the default New Item page that we have to work with. Figure 1 shows the home page for the Technical issues team site that we will be modifying.

Figure 1: Technical Issues home page
By selecting the Add new announcement link we are presented with the standard Announcements: New Item page (Figure 2) for adding announcements to our list. Note the columns that are currently available for data entry: Title, body and Expires.

Figure 2: Announcements: New Item page
To modify this page we must open it in SharePoint Designer 2007 and then add a new custom List Form Web Part that displays only the fields that we wish our users to modify. Start Designer and then connect to the website that contains the list whose form you wish to modify, in our case that would be the Technical Issues Team site as shown in Figure 3.

Figure 3: Technical Issues site loaded into Designer 2007
Next we need to open up the relevant NewForm.aspx page. In the Folder List expand Lists and then expand the list you want to work with. Again, we are going to modify the Announcements list so expand Announcements and select NewForm.aspx.

Figure 4: NewForm.aspx in the Announcements list
As you can see in Figure 5, the Announcements: New Item page contains a customized List Form Web Part that will display the fields we noted earlier when we opened the page in the browser. While we can edit the properties of this particular web part, we cannot edit the contents, nor do we want to delete the web part from the page as this can break the NewForm.aspx page and cause it to error out when you try to actually use it in your site. Stick with me because we are going to cover how to deal with this as we go though this tutorial. For now, we want to add some space below the current web part so that we may add our own custom list form to do with as we like.

Figure 5: The default NewForm.aspx page
Select the area just below the current list form and press Enter twice to give yourself some room to work with. Next, to add our custom list form go to your tool bar and select Insert>SharePoint Controls>Custom List Form.. as shown in Figure 6.

Figure 6: Add a new Custom List Form
Selecting the Custom List Form will bring up the List or Document Library Form dialog shown in Figure 7 where we need to choose which list we are tying this new web part to as well as the type of form we want to create. In our example we are keeping the default Announcements list since we are creating a new Announcements form as well as selecting the New item form radio button because we want to use this web part to create new announcements for our site. If we were going to modify the web part for a different document library or list within our site we would need to choose that library or list from the drop down menu. If instead of creating a new item, we wanted to use this form to edit an already existing item; we would select the Edit item form radio button instead.

Figure 7: List or document library selection dialog
When finished you should have your new list form web part as displayed in Figure 8.

Figure 8: Newly added List Form web part
As mentioned earlier, the form we are using is pulling its data fields from the columns that are defined in the list or library that we are connecting the web part with. What if we want to create our own columns or collect information about items that are not currently part of the list or library? To do this we would need to add additional columns from already existing Site columns or simply create our own to suit our needs. To accomplish this task we must venture into the settings of the list or library that contain the items we want to collect or modify data from.
We’ll start by selecting the View All Site Content link at the top of our Quick Launch menu at the left hand side of the browser window. This will bring up the All Site Content screen as seen in Figure 9. Next we must select the list we are working with, in our case that would still be Announcements.

Figure 9: The All Site Content page
Once you are in the list or library that you want to add information to, select the Settings menu and then select List Settings, (Figure 10).

Figure 10: List Settings menu option
On the settings page for your list or library you will see a section titled Columns, (Figure 11). It is here that we can add columns from the already defined site columns in SharePoint or create a new column to collect whatever data we need for the items in our list.

Figure 11: Create or add new columns section
When you have defined the metadata types that you wish to collect on your list items, we need to make those columns available in our new List Form Web part. To do that, we’ll go back to SharePoint Designer 2007 and add the form elements into our new form.
In the Toolbox task pane you’ll notice a section labeled SharePoint Controls (Figure 12). If the Toolbox is not visible in your Designer, go to the Task Panes menu item and select Toolbox. Expand the SharePoint Controls and you’ll see the various elements that can be inserted into your form to allow you to collect the data that is relevant to your list items. These elements directly map to the column data types that are defined when you add or create a new column in any library or list within SharePoint.

Figure 12: SharePoint Controls in the Toolbox task pane
Select the data view control that maps to the type of field whose data you wish to collect and drag it from the toolbox and drop it into your new list form. This will bring up a control dialog in which you will map the control to the column in your list whose data you are interested in. You’ll notice in Figure 13 that we dropped a text box into our form and we are going to map it to the Modified By field in our Announcements list.

Figure 13: Mapping a list field to a data view control
Next we merely give our new control the proper label, (Figure 14) and then save our new NewForm.aspx page.

Figure 14: Adding the label for our control
Since we are modifying the default page you will receive a warning (Figure 15) that the page is being altered from the site definition. Select Yes to save the changes.

Figure 15: Site definition warning dialog
Now we can view our new New Item page in the browser and see just what we have done. As you can see in Figure 16 there are now two list form web parts on the page; our original web part with the default configuration of fields, and our new web part with its modified content.

Figure 16: New Item page with two list forms
Since we want to present only a single form for our users to fill out, with only the items we have selected for them to modify, we must hide the original web part on the page. To accomplish this we again return to Designer 2007 and the NewForm.aspx page we have been working with.
Select the original ListFormWebPart and hide it by right-clicking and selecting Web Part Properties from the popup menu. (Figure 17)

Figure 17: Selecting Web Part Properties popup
In the Announcements properties expand Layout and check the box for Hidden (Figure 18). Again, we don’t want to delete the default web part since this can break the page and cause it to error when trying to load within SharePoint. Remember to save the new page.

Figure 18: Hiding the default Announcements web part
We now have our Announcements: New Item page that only displays the elements that we want to expose to our users as seen in Figure 19.

Figure 19: The new Announcements: New Item page
Using the principles shown here you can create a form to display any of the content columns that are associated with your lists and libraries in your SharePoint deployment. But what about exposing different columns to different sets of users? By applying what we have learned here you can create separate web parts that expose only the columns you want exposed for each set of users and then apply audience filtering to make them accessible to the proper groups.
So what about removing elements from the Edit Item form so that metadata isn’t improperly changed when a user edits the properties of an existing document? Let’s take a quick look at the Edit item page for a document library where content types are enabled. Notice in Figure 20 in our Problem Reports library App Crash document properties there is a field to select the content type that is associated with this document. A misinformed user could potentially change the content type associated with this document and thereby change the metadata or even workflow’s attached with this document type.

Figure 20: Edit Item page showing Content Type selection box
To prevent this situation for occurring we need to modify the default EditForm.aspx page that is associated with this document library. To do that we need to use Designer, just as we did when modifying the NewForm.aspx page earlier.
Start by connecting to the site that contains the document library (our Technical issues site) and then locate the library you want to work with (Problem Reports in our case). Expand the library and you will see the associated forms as shown in Figure 21. This time we want to modify the EditForm.aspx page so open it with Designer.

Figure 21: Selecting the library to work with
Now just as we did with our previous NewForm.aspx page we need to add a new list form web part to the page and hide the existing default web part from our users. This time, however, when we insert our new web part we must be sure to connect it with the proper library (Problem Reports) as shown in Figure 22 and then select the proper form type (Edit item form) that we are creating as shown in Figure 23.

Figure 22: Connecting the form to the proper library

Figure 23: Configuring the List Form Web Part
From there it is simply a matter of configuring the field types, adding the proper SharePoint controls and saving our page. Figure 24 shows the modified Problem Reports library Edit Item page without a content type selection box.

Figure 24: Edit Item page without the Content Type selection box
So there you have it. You can now modify your default forms to display just the fields you want them to while hiding the ones you need to. I hope you have found this tutorial useful and if you should have questions or comments, please let us know. Till next time…

Error During Trace Log Creating WSS3.0

Diagnose
Windows SharePoint Services 3.0 could not create, or write to, the trace log. This trace log contains information that is useful in troubleshooting issues.

This error might be caused by one of the following conditions:

The account that Windows SharePoint Services 3.0 is using does not have sufficient rights to the trace log.

The hard disk or partition does not have enough room.

To find the location of the log file folder
In Central Administration, on the left navigation pane, click Operations.

In the Logging and Reporting section, click Diagnostic Logging.

On the Diagnostic Logging page, in the Trace Log section, the path to the log file is displayed in the Path box.

The account that Windows SharePoint Services 3.0 is using does not have sufficient rights to the trace log
To check the permissions assigned to the log file folder
If you do not know the location of the folder, see the "To find the location of the log file folder" procedure. By default, the location is "Program Files\Common Files\Microsoft Shared\web extensions\12\LOGS" but the location can be changed in Central Administration.

Navigate to the folder, right-click the folder, and then click Properties.

On the Security tab, the WSS_ADMIN_WPG Windows group should have Full Control and the WSS_WPG Windows group should have Read & Execute, List Folder Contents, and Read permissions or higher on the folder. If they do not, assign these permissions by using the procedure in the "Assign sufficient permissions" section.

The hard disk or partition does not have sufficient room
To check the space on the disk or partition
If you do not know the location of the folder, see the "To find the location of the log file folder" procedure. By default, the location is "Program Files\Common Files\Microsoft Shared\web extensions\12\LOGS" but the location can be changed in Central Administration.

Navigate to the disk or partition, right-click it, and then click Properties.

On the General tab, check the free space. The drive or partition should have at least 500 MB for the log files. Note: the space required for the log files depends upon the diagnostic logging settings. To see these settings, use the "To find the location of the log file folder" procedure.

Resolve
To resolve this issue, use the resolution that corresponds to the cause you identified in the Diagnose section. After performing the resolution, see the "Verify" section to confirm that the feature is operating properly.

Cause Resolution
The account that Windows SharePoint Services 3.0 is using does not have sufficient rights to the trace log
Assign sufficient permissions to the trace log

The hard disk or partition does not have enough room
Free up disk space or relocate the trace log


Assign sufficient permissions to the trace log
Windows SharePoint Services 3.0 could not write to the trace log because the account that Windows SharePoint Services 3.0 is using does not have sufficient permissions to the trace log or its parent directory. This trace log contains information that is useful in troubleshooting issues.

Ensure that the WSS_ADMIN_WPG Windows group has Full Control and the WSS_WPG Windows group has Read & Execute, List Folder Contents, and Read permissions or higher on the folder containing the trace log. To perform this procedure, you must be a member of the Administrators group on the local computer.

Free up disk space or relocate the trace log
Windows SharePoint Services 3.0 could not write to the trace log. This trace log contains information that is useful in troubleshooting issues.

You can free up space on the drive containing the trace log by removing unneeded files. To perform this procedure, you must be a member of the Administrators group on the local computer.

You can change the location of the trace log to a partition that has more drive space.

To change the location of the trace log file
In Central Administration, on the left navigation pane, click Operations.

On the Operations page, in the Logging and Reporting section, click Diagnostic logging.

On the Diagnostic Logging page, in the Trace Log section, type the new location for the trace log file in the Path box.

Click OK.