Monday, November 14, 2011

Transpose a DataTable using DataSet (C#)

DataSet ds = new DataSet();
OracleDataAdapter dataAdapter = new OracleDataAdapter();


DataTableCollection collection = ds.Tables;
                        DataTable table=new DataTable();
                        for (int i = 0; i < collection.Count; i++)
                            table = collection[i];
DataTabel transposeTable = GetTransposeTable(table);

private DataTable GetTransposeTable(DataTable dtOld)
            DataTable dtNew = new DataTable();

            dtNew.Columns.Add(new DataColumn("0", typeof(string)));
            for (int i = 0; i < dtOld.Columns.Count; i++)
                DataRow newRow = dtNew.NewRow();
                newRow[0] = dtOld.Columns[i].ColumnName;
                for (int j = 1; j <= dtOld.Rows.Count; j++)
                    if (dtNew.Columns.Count < dtOld.Rows.Count + 1)
                        dtNew.Columns.Add(new DataColumn(j.ToString(), typeof(string)));
                    newRow[j] = dtOld.Rows[j - 1][i];
            return dtNew;

Refer for additional information :

Friday, October 28, 2011

Auto-Generating SharePoint Filenames for InfoPath 2010 on Submit

SharePoint 2010 InfoPath - Auto Generating Filename on Submit Button

1. Create a filename field

Create a strFilename field (Text).  Do not set any conditional formatting, rules, or data validation on this.  Add it to the canvas for now and make it read-only (Fig 1).  This will be visible for testing purposes only. You can hide this if you need to But I left it on my form as I thought it was useful.


2. Create Submit Data Connection

Create a SUBMIT data connection in your form template that connects to the Form Library where the form resides.  Put in the URL of your Form Library for the “Document Library” field, and choose the strFilename data element for “File name” field by using the fx button.  Check the box for “Allow overwrite if file exists”

In Infopath 2010 this is done by navigating to the "Data" tab, Clicking on "Data Connections", and clicking "Add" as in (Fig 2).

 (fig 2)

then click next and select to submit your data "To a document library on a sharepoint site". Click Next again and specify the location of your sharepoint library where you want the form to be submitted to and also the name of the field that you are going to use as the document title in that library. It is important to remember to use the fx button to select the field to avoid errors see (fig 3).

(fig 3)

3. Disable Save options in the browser

Next the toolbar options for saving in the browser form must be disabled to force the user to use the submit button that we will be creating.
To do this in infopath 2010 the following must be done.

Click on the "Developer" tab, Click on the "language" button and then navigate to the "web browser" settings see (fig 4).

 (fig 4)

Uncheck Save, and Save As (Fig 4) Submit should be grayed since it has not been configured.  If it has been configured, be sure it is unchecked.  Update should be unchecked by default, so leave it.

4.Create the custom Submit button Drag a button control to your canvas and double-click it to get to its properties.  Change the display name to “Submit” or whatever you prefer. We are now going to add some rules to the button which will perform the save logic for us.

Once the button is in position and modified to your liking, ensure the button is selected and click on the "Manage Rules" menu item from within the "Home" tab. This will invoke the rules editor for your submit button.

Click on the "New" drop down box in the rules editor and select "Action"
Change the name of this first rule to "Edit" Click on the hyperlink under the condition label to change the conditions under which this rule will run and set it as per (fig 5)

(fig 5)

Now we need to add the actions that will happen if the conditions in theis rule are satidfied (i.e teh filename is not blank)
Click on the "Add" dropdown next to the "run these actions" label and choose to submit the form as in (fig 6). using the data connection that we created earlier which points to our document library

(fig 6)

Finally for this rule we need to add one last action in the same way except this time we will choose the "Close the form" option. On completion of this rule it should look like (fig 7).

 (fig 7)

In essence this rule will only run if the strFilename variable already has a value (A filename) and simply resubmit the form to the same library with the same name and close the form returning the user to the library Hence the name Edit. If the filename has no value the rule will be skipped.
The second and final rule we need to create is the one that will run if no filename is present (i.e the form is being submitted for the first time)

Create a new rule for the submit button in the same way as we did above except this time the Rule should be named "Submit" and the condition should be set to only fire if the strFilename variable is empty as per (fig 8).

 (fig 8)

we now need to add three actions as we did above but there is an additional action to add first which sets the value of teh strFilename variable to a unique name. Under actions click add, and select "Set A fields value" When the dialog box appears use the fx button to buuild whatever unique filename you like, and apply it to the strFilename variable as per (fig 10).

 (fig 10)

After this action add a submit and close form action as we did for the first rule. The rule should look like that shown in (fig 11) when it is complete.

(fig 11)

In essence this rule will only fire when no filename exists, create a unique filename and submit it to the document library with that filename. Subsequent edits of this form will cause the first rule to fire and resubmit it with its original filename.

If you open or create a form in your SP library now, you will now no longer be able to save using the browser controls, and the submit button will be the only way to do this.

Moss 2007 :

Submit Options:

Create  textbox on Infopath form and name it to "strFilename".

 Place the Button on Inforpath path and name it "Submit", click the properties

Click "Submit" on Rules window

Friday, October 21, 2011

Copy a SharePoint List Programmatically

I've been working with the SharePoint API lately. One of my tasks is to copy SharePoint lists from one site to another site. This can be done in code as long as the two sites are on the same machine. It's OK if they are in different web applications, but it can't be from one server to another. If you need to copy from one server to another, you either need to do an export/import, or find a way to save the settings and import them on the new machine. I believe you can use the SharePoint Web Services to accomplish this, though. I haven't worked with that yet.

Anyway, it took a lot of digging around to figure out all the things I needed to copy lists, so I thought I'd post the code that is working for me. This post is only going to cover copying a basic list. I am planning on several more posts to handle document libraries, wikis, and other special cases. Each has their own challenges.

The requirements for me are to copy the bulk of the lists of a large SharePoint site to a new site with a different structure. Therefore, content and deploy is not going to work. Also, they are redesiging the pages, so they really only wanted the lists. What I'm doing is creating a new list on the new site and copying all the properties, so any metadata, such as who last modified the list, is unfortunately lost.

Here's the code:

// Instantiate web instances
SPSite sourceSite = new SPSite(@"http://SharePointServer:31001");

SPWeb sourceWeb = sourceSite.RootWeb;
SPSite destSite = new SPSite(@"http://SharePointServer:31002");
SPWeb destWeb = destSite.RootWeb;

// Get a reference to the source list
SPList sourceList = sourceWeb.GetList("/Lists/Announcements");

// if the list exists on the destination site, delete it

   SPList temp = destWeb.Lists[sourceList.Title];
catch { }

// create new list on the destination web with same properties
Guid newListID = destWeb.Lists.Add(sourceList.Title, sourceList.Description,

SPList destList = destWeb.Lists[newListID];

// copy items
foreach (SPListItem item in announcements.Items)
   SPListItem newDestItem = destList.Items.Add();
   foreach (SPField field in sourceList.Fields)
      if (!field.ReadOnlyField)
      newDestItem[field.Id] = item[field.Id];

// set quicklaunch settings
destList.OnQuickLaunch = sourceList.OnQuickLaunch;

Thursday, October 20, 2011

Adding, Deleting, copying and downloading attachments in SPList using C#

using (SPSite oSPsite = new SPSite("http://website/ url/"))
using (SPWeb oSPWeb = oSPsite.OpenWeb())
            oSPWeb.AllowUnsafeUpdates = true;

            // Fetch the List
            SPList list = oSPWeb.Lists["MyList"];
            //Add a new item in the List
            SPListItem itemToAdd = list.Items.Add();
            itemToAdd["Title"] = "Test Title";
            itemToAdd["Description"] = "Test Description";

            // Get the Item ID
            listItemId = itemToAdd.ID;

            // Update the List item by ID
            SPListItem itemToUpdate = list.GetItemById(listItemId);
            itemToUpdate["Description"] = "Changed Description";

            // Delete List item
            // Delete List item
          for (int i = list.Items.Count - 1; i >= 0; i--)

            oSPWeb.AllowUnsafeUpdates = false;

Tuesday, September 20, 2011

Enable/Disable Fields using JQuery in NewForm and EditForm.aspx

Hide  fields
$("'Type or Location')").parent().hide();

<script type="text/javascript"
src="/root folder/customization/js/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var text = $("select[title$='Quotes Attached'] :selected").text();
if(text != "Yes")
$("input[value$='OK']").attr('disabled', true);

$("select[title$='Quotes Attached']").change(function()
var text = $("select[title$='Quotes Attached'] :selected").text();
if(text == "Yes")
//alert('Please attach the Quote by clicking Attach File option');
$("input[value$='OK']").attr('disabled', false);
$("input[value$='OK']").attr('disabled', true);


Please read the below Article

How to Enable/Disable Input element in JQuery

To disable input elements (checkbox, radio button, text box, button etc) in jquery, you need to set disabled attribute.
// check box
$("#check_box_id").attr("disabled", "disabled");
// radio button
$("#radio_btn_id").attr("disabled", "disabled");
// Text box
$("#text_box_id").attr("disabled", "disabled");
// button
$("#btn_id").attr("disabled", "disabled");
To Enable the input elements (checkbox, radio button, text box, button etc) , we need to remove disabled attribute. This can be done in the following way.
// check box
// radio button
// Text box
// button

May times there are requirements like we need to define a field as a required field in SharePoint. Yes, you will say what is new with that? This is built in feature of SharePoint.

Ok, what if I say that field should be mandatory while updating list item but not while inserting the list item. What if I say if value of one drop down in xyz, abc field becomes mandatory?

Well, in scenarios like this we can use jQuery. Yes, jQuery is the answer to this question. Let us put this in to a real scenario.

Ok, before getting into this, I would like to share some steps about this. First we need to handle the change event of drop down. Then we will check the value of the drop down, if the value is suspended, we will pop up one message saying that now because you have selected Suspend status, you must mention the reason for this and we will disable the button OK. We have to do this because there is no way we can stop user clicking ok button unless user writes the reason. Otherwise item will be updated which we do not want.

we also need to handle lost focus event of text area, and at the end we will count the number of characters in the text area. If total comes to zero, well then keep button disabled. If it is not zero and more than zero, then we will enable the button.

Or else we can ask user to select Status back to value which was earlier and enable the button.

Yes, this all steps are required. Try for yourself and you will realize that yes these all steps are required. It may look like some lengthy solution, But remember we did all this stuff right on browser. We never went to write down the code in event handler (this stuff really annoy the end user, as it takes to a different error page, or creating any custom field for this. This is what we wanted and this is the power of jQuery. Isn’t it.

Ok, let us see now in practical

First add the content editor web part above the New Form or Edit Form LVWP where ever you want to place the logic.

This is the layout of my editform.

Add the following code to the content editor web part. Do not forget to reference appropriate jquery file from your library.

<script type="text/javascript" src="{site URL}/Shared%20Documents/jquery-latest.js">

$(document).ready(function() {
//Below function makes sure that if the status is not suspended in edit mode, it disables the reason text //area
var text = $("select[title$='Status'] :selected").text();
if(text != "Suspended")
$("textarea[title$='Reason'] ").attr('disabled', true);


Below function makes sure that when the status drop down is changed to suspended status, reason textarea becomes enabling to write down the result and disabled the OK button unless user enters the reason. If suspend is not selected, again disable the reason field and enable the OK button.


var text = $("select[title$='Status'] :selected").text();

if(text == "Suspended")
alert('you must provide reason for suspending this order');
$("input[value$='OK']").attr('disabled', true);
$("textarea[title$='Reason'] ").attr('disabled', false);
$("input[value$='OK']").attr('disabled', false);
$("textarea[title$='Reason'] ").attr('disabled', true);


Finally below is the blur event of the reason field, which checks if anything is entered in reason field or not. If not keep the button OK disabled, or else if something is written enable the button.


var text = $("textarea[title$='Reason'] ").text();

if(text.length <= 0)
$("input[value$='OK']").attr('disabled', true);
$("input[value$='OK']").attr('disabled', false);




So here is the result of it.

See below image as status is not suspended I am not able to type in anything in reason field.

Below figure shows when I changed the status to Suspended, it pops up message and disabled the ok button after message is displayed.

After mentioning the reason, OK button enables.

That is it. You have just made required field validation without using any custom field or writing event handler.

Thursday, September 15, 2011

Custom Form – Edit Fields Based on Permission Levels in SharePoint (Screencast)

There are situations where certain fields in lists or libraries need to be hidden or displayed according to the permission level of the logged in user.  Since there is really no out-of-box way to assign permissions to fields, here's a way to do it using conditional formatting in SharePoint Designer.  This is my favorite SP Designer trick, that I discovered a few months ago.
See my reference (Ian's SharePoint Blog):
In this example, the field called "Priority" needs to be hidden from everyone except for those users who have rights as approvers on this custom list.  Also, there is a field called "Audit Date", that only approvers need to be able to edit, but other users (even those with edit rights) should not be able to edit this field, and everyone can see it.
Doing this entails creating custom forms for all three forms (NewForm, DispForm, and EditForm) in the list.
Here goes...
1.  To keep this simple, create a custom list called "Policies" on your site.  There are 4 fields: 
Policy Name (changed from the default Title field)
Priority - multiple choice
Notes - multiple lines of text
Audit Date - date/time

2.  Create a blank web part page in the same site collection as the Policies list.  It doesn't matter where you save it, since we'll be deleting it later.
3.  Open this web part page in SharePoint Designer.  Click on "Click here to insert a Web Part".  This is really just to make sure that you insert this web part into a web part zone, and not some random spot on the page.
4.  On the <Insert> menu, choose SharePoint Controls, then Custom List Form.
5.  Pick the Policies list, then choose New Item Form.  OK
6.  Select the entire table row that contains the Priority field.  This is the field that we want to hide from everyone except approvers.  On the <Data View> menu, choose Conditional Formatting.

7.  In the Conditional Formatting screen on the right, click <Create>, and choose <Show content>.  On the Condition Criteria screen, click <Advanced...>

8.  Select IfHasRights from the list of functions, and then put the number 16 in the parentheses.  To see where I got the number 16 (approver permissions), click on the link to Ian's blog above.  Click OK.  Click OK again.

9.  Next, the Audit field needs to be only editable by list approvers.  So, since this is the new item form, we'll just hide it from everyone else.  So, select the Audit Date row, and put the exact same condition on it with conditional formatting.
10.  Save this page.  It's okay to customize it from the site definition.
11.  At this point, it does help to have some data in your form, so go ahead and create a couple of list items.
Also, I'd like to note that when using custom forms like this, the Attachment button doesn't work anymore.  I think there are blogs somewhere about this bug, but I've never tried fixing it.
12.  Create a new, blank web part page in the same place you created the first one.  This will be the EditForm page.  Repeat steps 3 & 4.  Then, this time when inserting the Custom List form, select "Edit item form".
13.  Repeat steps 6, 7, and 8 on the priority row.
14.  Next, we essentially need to make two copies of the Audit Date field.  We want it to be editable to list approvers, and visible (not-editable) to anyone else.  Create a new row in the table.
15.  Put the text "Audit Date" in the left cell, and put the cursor in the right cell.  In the <Data Source Details> pane on the right, select the Audit Date field, then click Insert selected field as --> Formatted --> DateTime.  Then, you can opt to uncheck the Time check box, and click OK.
16.  Select the row of the editable audit date field.  For the conditional formatting, only show the content when IfHasRights(16).
17.  Select the row of the read-only date field (the one that was inserted in step 15), and create a conditional formatting rule to HIDE content when IfHasRights(16).
At this point, since you most likely have full control permissions on this list, this row will seem to disappear!  While you're doing this design work and showing/hiding fields, you can go to the Conditional Formatting pane, and click Set Visibility and choose All Formatting hidden.  This will let you see the field you just hid.  Be sure to set it back to default when you're done.
HANG in there, only one more form to go.
You know the drill... create another blank web part page...
When you insert the custom list form this time, choose "Display item form"
All we have to do on this one is create a conditional formatting rule that will show the content IfHasRights(16)
NOW, it's time to save each of these data views as web parts.  Go to the browser, and navigate to the library where you saved the 3 web part pages you just created.  Open each page export the web part.  Save the *.webpart files to your desktop or whatever.  In the filename, be sure to indicate whether it's New, Edit, or Display.
In your Policies list, create 3 new, standard views, and call them "New", "Edit", and "Disp".
On each of these new views:
- click <site actions> and <edit page>.  Delete the default list view web part.  Be sure to delete it, not just close it.
- Import the associated web part from your desktop.
- Exit Edit Mode
Now that there are 3 new forms in the Policies list, the last thing to do is associate them correctly. (I think that's the right terminology).  Anyway, go back to SharePoint Designer.
In the left pane, under the Lists folder, right click on the Policies list, and choose "Properties".
Click the "Supporting Files" tab.  Change the content type to Item.
Change each of the 3 supporting files to your new Edit, Display, and New aspx files.
Fun!  Now test it!
Once it's just the way you like it, then you can delete those 3 original web part pages that you exported from.  Check it out, we didn't leave anything unghosted!
Here's my screencast based on this blog:

Please use the Video :

Wednesday, September 14, 2011

SharePoint Server 2007 server farm topologies

Different type of SharePoint Server 2007 server farm topologies. (System Architecture)

This article discuss about understanding the different type of SharePoint server farm topologies.
The SharePoint Server 2007 server farm design vary based on the customer requirements, security perspective and size requirement. The topology designs can be created based on the size of the server farm namely small, medium, and large which can focus on either a single or multiple farm models.
Different type SharePoint Server Roles
Web Front End Server : A front-end server that provides the web services used to render applications (Presentation layer).
Application Server : A front-end server that provides applications services such as search and index (Services layer)
SQL Database Server : A dedicated server running either Microsoft SQL Server 2005. In large farms, this is typically a SQL Server clustered configuration with two or more servers.
Domain controller : Provide authorization and authentication service to Office SharePoint users.
Small server farm :
Small server farm which consist of two-server, one of the servers hosts the Web front end and the application services, while the second server hosts the SQL Server database. This provides a way to manage the database separately but adds complexity without adding scalability or availability.
This type of smallest deployment that is recommended for demonstration, training environment or very small organization or user group.
If you notice that architecture diagram has domain controller, either demonstration environment or very small group, I am sure that there will be existing domain controller server, you may consider re-use.
Small Farm System Architecture
Medium server farm :
Part of this article is to help you determine the minimum requirements which allow you design and achieve your customer goal.
To design high-availability solution, you must deploy a server farm. To decide you may need to discuss following items with your customer and analysis the outcome.
Question Yes No
Is your overall availability requirement below 99%?  
Is the availability of your data critical?  
Question 1 Is your availability requirement 99% or greater? If your customer response to “YES”, which means organization looking for high availability on Office SharePoint Server 2007.
I order to meet above requirement you need to design your Web Front End Server to the two-server deployment, which will gain scalability and availability by load-balancing requests so that if one server goes down, the system up and running.
Question 2 Is the availability of your data critical?, If your customer response to “YES”, which means organization is looking for high availability and gain scalability to safe from data loss, so your design need to be clustered or mirrored database server .
Medium Farm System Architecture
Large server farm :
Part of this article is to help you determine the Large server farm configuration which is suitable for an enterprise-level SharePoint environment:
To design enterprise-level SharePoint environment, you may need to discuss following point with your customer and analysis the outcome (This question are in-addition to medium farm server questions).
Application server role Service
Excel Calculation Services 
Index & Search (External System i.e. ERP, CRM, File share and Lotus Notes)  
Windows SharePoint Services 3.0 search 
Enterprise-level SharePoint environment :
_ Two or more load-balanced front-end web servers running Office SharePoint Server 2007
_ Two or more application servers running Office SharePoint Server 2007
_ One Index & Search servers running Office SharePoint Server 2007
_ Two or more clustered database servers running SQL Server 2000 or 2005
_ SAN Storage
The above architecture diagram shows Web Tier, Application Tier and DB Tier which design to serve different purposes, each of the servers provides specific SharePoint Server 2007 services such as Index Services or Excel Calculation Services, and the front-end servers provide web content services.
The servers in server farm (WFE server, Application server, Index server) must run with Office SharePoint Server 2007.
Database server which configure clustered or mirrored environment with SAN storages.
There is nothing special or difficult on above architect design, basically understanding the customer requirements (i.e. future user growth rate, storage capacity, system availability, security, and system performance requirements) put this pieces of information together and analysis and provide possible solutions architecture that meet your customer goal

Setup and Install SharePoint 2007 Server (MOSS) on Virtual PC


This article describes how to Setup and Install SharePoint 2007 Server (MOSS 2007) on Virtual PC


Microsoft Office SharePoint Server 2007 is a powerful technology which consists of Document management and collaboration websites.
Before you start installing, Make sure that you downloaded following software’s.
  1. .NET Framework 2.0
  2. .NET Framework 3.0
  3. Windows SharePoint Service 3.0
  4. Windows SharePoint Service 3.0 SP 1
  5. Virtual PC 2007 and
  6. Windows Sever 2003 R2.
The following process includes creating a new VM definition, adjusting the settings, and installing the operating system (OS) and .NET Frameworks. (Take note that this process will take about three hours.)

Setup Victual PC

1. Click New... and Click Next

2. Select Create a new virtual machine. Click Next.
3. Type the name and location. The default is New Virtual Machine. To create the VM on your external hard drive, enter the location and a name called WindowsEntServer2003BaseImage. and Click Next.


4. Select an operating system as Windows Server 2003 and Click Next.
5. Adjust the RAM. For this base image 1 GB or 1024 MB will suffice and Click Next.
6. Select A new virtual hard disk option and Click Next.
7. Create the hard disk in the same location that you selected in step 4. Adjust the virtual hard disk size 6 GB is a good start. You can resize the disk at any time and Click Next.
8. Click Next and Finish to completed the process.

Setup Loopback Adapter

Once the machine is created, add a second network adapter on the virtual machine to your host machine's Loopback Adapter.
1. Click Settings.
2. Click Networking.
3. Change the setting Number of network adapters to 2.
3. Incase if you do not know how to Install Microsoft Loopback Adapter. Go to this website and follow the steps to install (How to install the Microsoft Loopback adapter in Windows XP)
4. Change the setting Adapter 2 to Microsoft Loopback Adapter.
5. Click OK.

Install an operating system on Virtual PC.

1. Virtual PC, click Start
2. If you have a Windows Server 2003 Enterprise R2 CD or DVD, insert it in your host machine now. If you have a Windows Server 2003 Enterprise R2 ISO image file, Go to menu bar, click CD, then Capture an ISO Image, and browse to the location of your Windows Server 2003 Enterprise R2 ISO image. Open the image.
3. Follow the instructions to install the server operating system.
4. In the pop-up, select Notepad. Click OK.
5. Add the IP address and machine name of your virtual machine on a blank line.
6. Close the Window, and click Yes when prompted to save the changes.
Once everything done, then the OS need to activate and Windows Update is run to install all available service packs and patches.

Edit the HOSTS File

Since the virtual network will not going to be served by the same DNS server used by the host machine. You need to locate a virtual machine by name rather than IP address, To edit Host file follow the steps.
1. Got Run and enter C:\WINDOWS\system32\drivers\etc Right-click the HOSTS file and select Open.


2. In the pop-up, select Notepad. Click OK.
3. Add the IP address and machine name of your virtual machine on a blank line.
4. Close the Window, and click Yes when prompted to save the changes.

Install ASP.NET 2.0 and ASP.NET 3.0

ASP.NET and Windows Workflow Foundation (WF). Both are required by SharePoint. ASP.NET 3.0 package Include above items, So follow the steps to Install.
1. Copy .NET setup file to your VPC or Share folder and access form VPC
2. When you double click it prompted to Run, Open, or Cancel, click Run or Open.
3. Prerequisites will be checked and files will be copied.
4. Agree with the terms, accept the license and click Install.
5. When installation is complete, click Exit.

Allow ASP.NET 2.0 Web Service Extensions in IIS

1. Select Start - Administrative Tools - Internet Information Services (IIS) Manager
2. In the Internet Information Services management console, expand the server name in the left pane, then select Web Service Extensions:

3. In the right pane, select ASP.NET v2.0.50727, then click the Allow button:

Install Windows SharePoint Service 3.0 SP 1

1. Copy .NET setup file to your VPC or Share folder and access form VPC
2. When you double click it prompted to Run, Open, or Cancel, click Run or Open.
3. Agree with the terms, accept the license and click Install.
4. When installation is complete, click Exit.

Back Up Your Base Image

Congratulation... Now you have created a reusable base image. Start to make a backup this image. So that you can save time when creating servers in the future.
1. Click Start and Shut down your VM. Enter a reason of "Base Image Backup".
2. Once the files are backed up, you can create a new machine by moving or copying the VHD into another folder, renaming it according to purpose
3. Prerequisites will be checked and files will be copied.

Install SharePoint on Virtual Machine

1. Virtual PC, click Start
2. If you have a SharePoint 2007 Server with Service Pack 1 CD or DVD, insert it in your host machine now. If you have a SharePoint 2007 Server with Service Pack 1 ISO image file, Go to menu bar, click CD, then Capture an ISO Image, and browse to the location of your Windows Server 2003 Enterprise R2 ISO image. Open the image.
3. Follow the instructions to install the server operating system.
4. Insert the MOSS 2007 installation media, start the installation, enter the Standard / Enterprise product key, then click the Continue button:
5. Select I accept the terms of this agreement checkbox, then click the Continue button:
6. On the Select the installation you want screen, click the Advanced button:
7. Server Type tab, select the Complete option and then click the Install Now button:
8. Once the installation is complete, select the Run the SharePoint Products and Technologies Configuration Wizard now checkbox, then click the Close button
9. Run and SharePoint Configuration Wizard
10. On the Welcome to SharePoint Products and Technologies screen, click the Next button:
11. In the services may have to be started or reset dialog box, click the Yes button:
12 On the Connect to a server farm screen, select the No, I want to create a new server farm option, then click the Next button:
13. SharePoint Setup will complete 1of10 steps to auto configure
14. Congratulation.. You installed and configured MOSS 2007 application running inside the virtual machine.

Monday, August 29, 2011

Display “Append Changes to Existing Text” Fields in a Custom List Form Web Part

I want to thank Brian Hunsaker for pointing this out to me. I've posted several times about the difficulties I've had in the past with displaying text fields in custom web parts where the "Append Changes to Existing Text" option is turned on. An example of this is the comments field in the test issues list:

I still don't know how to get this to show up in a custom Data View Web Part, but at least, with Brian's help, I've found a line of code that will allow you to display comments with a custom list form. Here's how you add a custom list form and display the comments field within SharePoint Designer 2007. I created a blank Web Part Page as my starting point.
  1. After selecting the correct web part zone, go to Insert > SharePoint Controls > Custom List Form:

  2. For this example, I'm going to use the following options:

  3. Find the line of code that references your Comments field (the text field with "Append Changes to Existing Text" turned on). If you're viewing your site in split mode, all you have to do is click on the comments field in the design area of your site.

  4. Replace the line that begins <xsl:value-of … and replace it with the following line of code:
    <SharePoint:AppendOnlyHistory runat="server" FieldName="V3Comments" ControlMode="Display"/>
    FieldName is the name of your field and ControlMode is the type of mode you're using to display the data (so if your form is in edit mode, you may want to use "Edit.").
Now you will see this history of this field with user and date/time stamped!
Here's a link to an MSDN article that explains some of this (although I had trouble understanding it):