Charora's website  
Home arrow Technical Articles
Saturday, 04 September 2010
 
 
Technical Articles
Unable to search in SharePoint Portal Server 2003 PDF Print E-mail
Written by Hari Kishan Charora   
Friday, 13 October 2006
SYMPTOMS
Whatever you try to search for in SharePoint Portal Server 2003, You do not get any results, you may receive the following error message in the error log if you go to "Site Settings->Configure search and indexing->View errors and warnings on:" and click on "portal content" or "non portal content"

The address could not be found, (0x80041209 - Cannot Connect to the server. Please make sure the site is accessible. )

The address could not be found, (0x80041206 - A server error occurred. Check that the server is available. )

CAUSE
full-text search is not configured properly

WORKAROUND
To work around this problem, follow these steps.

1. Login as SharePoint Administrator Group Account
2. Go to SharePoint Central Administration
3. Click on Windows SharePoint Services from left navigation bar.
4. Click on Configure full-text search and uncheck and check "Enable full-text search and index component" under Search Settings and type "SharePoint Administrator Group Account" User ID and Password if prompted.
4. Open Enterprise Manager in SQL Server 2000 or SQL Server Management Studio in SQL Server 2005.
5. Go to the database server then open the "SITE" database
6. You should see Full-Text Catalog node, right click on the catalog icon to start full population. If you receive an error message then run this stored procedure. Make sure you are running the stored procedute in the "Site" database.

EXEC sp_fulltext_database 'enable'
GO

This should fix the problem

Write Comment
Last Updated ( Tuesday, 06 November 2007 )
 
Move "Save and Close" at the bottom of a survey PDF Print E-mail
Written by Administrator   
Thursday, 14 September 2006
Put the "Save and Close" Button at the Bottom of a Survey 

We created a survey in Sharepoint Portal Server 2003 and one of our internal client wants a submit button at the bottom instead of "Save and Close" button at the top menu. Is there a simple way to do this?

In order to insert the submit button, I opened the NewForm.aspx from the survey using Front Page 2003 and found I could not insert the button because the survey tool bar and the survey body are an integrated web part.

Note: assuming we are deploying a survey on a WSS site because I will change some default views of the survey list on WSS site template. To change SPS areas' survey list template will be similar. Look for the right location of the XML file in the in site template.


Step 1: Open Schema.xml for the survey template
For WSS:
Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\STS\LISTS\VOTING\Schema.xml

For My Site:
Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\SPSMSITE\LISTS\VOTING\Schema.xml
 
Similarly,
For SPSNEWS template:
Go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\SPSMSITE\LISTS\VOTING\Schema.xml

Schema.xml stores the views of different views of survey web parts.


Step 2: Moving the Button Tool Bar the Bottom of EditForm Page
The schema.xml stores the form views inside the <Forms> tag, e.g. the forms used by EditPage.aspx is stored in the tag <Form Type="EditForm" Url="EditForm.aspx" WebPartZoneID="Main">

The <Forms> tag has four child tags <ListFormOpening>, <ListFormButtons>,<ListFormBody>, and <ListFormClosing>. <ListFormOpening> stores the related javascript functions; <ListFormButtons> stores the tool bar buttons; <ListFormBody> stores the survey body view; and <ListFormClosing> stores the end content of the survey form.

1. Go to <ListFormButtons>,
2. Skip the <Switch> child tag of <ListFormButtons> ,
3. Copy the lines starting the tag of <HTML> and ending with </HTML> tag before the closing tag </ListFormButtons>,
4. Paste right next to the <ListFormClosing> tag

Step 3: Moving the Button Tool Bar the Bottom of NewForm Page
Locate the tag <Form Type="NewForm" Url="NewForm.aspx" WebPartZoneID="Main"> and then repeat steps 1-4 from the of Step 2

Step 4: Restart IIS
Restart the IIS Service
Go to the command prompt and type iisreset

How to change the Label Text of the "Save and Close" button and "Go back to survey" button?
In Schema.xml, look for the "Save and Close" and replace with text of your choice, i.e. "Save and Submit". Similarly, look for the "Go back to survey" and replace with "Cencel" and save Schema.xml file and restart the IIS Service

You are all set !!!


Write Comment (2 Comments)
Last Updated ( Tuesday, 06 November 2007 )
 
Export a DataSet to Microsoft Excel PDF Print E-mail
Written by Administrator   
Friday, 08 September 2006

This function takes in a DataSet and file name and writes the DataSet to an Excel worksheet.

This function creates an XML file and save as an XLS file. So it can be used as either file format. No more leading zero truncation on numbers that look like strings.

Example, if you made a tab delimited file and put a field such as "00045" (a field that looks like a number but should be regarded as a string), Microsoft Excel would truncate the leading zeros. This problem is solved with this method.

Here is the source code

  public void Export_To_Excel(System.Data.DataSet Source, string FileName)
  {
   System.IO.StreamWriter ExcelDoc;
   ExcelDoc = new System.IO.StreamWriter(FileName);
   const string startExcelXML = "<xml version>\r\n<Workbook " +
       "xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"\r\n" +
       " xmlns:o=\"urn:schemas-microsoft-com:office:office\"\r\n " +
       "xmlns:x=\"urn:schemas-    microsoft-com:office:" +
       "excel\"\r\n xmlns:ss=\"urn:schemas-microsoft-com:" +
       "office:spreadsheet\">\r\n <Styles>\r\n " +
       "<Style ss:ID=\"Default\" ss:Name=\"Normal\">\r\n " +
       "<Alignment ss:Vertical=\"Bottom\"/>\r\n <Borders/>" +
       "\r\n <Font/>\r\n <Interior/>\r\n <NumberFormat/>" +
       "\r\n <Protection/>\r\n </Style>\r\n " +
       "<Style ss:ID=\"BoldColumn\">\r\n <Font " +
       "x:Family=\"Swiss\" ss:Bold=\"1\"/>\r\n </Style>\r\n " +
       "<Style     ss:ID=\"StringLiteral\">\r\n <NumberFormat" +
       " ss:Format=\"@\"/>\r\n </Style>\r\n <Style " +
       "ss:ID=\"Decimal\">\r\n <NumberFormat " +
       "ss:Format=\"0.0000\"/>\r\n </Style>\r\n " +
       "<Style ss:ID=\"Integer\">\r\n <NumberFormat " +
       "ss:Format=\"0\"/>\r\n </Style>\r\n <Style " +
       "ss:ID=\"DateLiteral\">\r\n <NumberFormat " +
       "ss:Format=\"mm/dd/yyyy;@\"/>\r\n </Style>\r\n " +
       "</Styles>\r\n ";
   const string endExcelXML = "</Workbook>";

   int RowCount = 0;
   int SheetCount = 1;
   ExcelDoc.Write(startExcelXML);
   ExcelDoc.Write("<Worksheet ss:Name=\"Sheet" + SheetCount + "\">");
   ExcelDoc.Write("<Table>");
   ExcelDoc.Write("<Row>");
   for(int x = 0; x < Source.Tables[0].Columns.Count; x++)
   {
    ExcelDoc.Write("<Cell ss:StyleID=\"BoldColumn\"><Data ss:Type=\"String\">");
    ExcelDoc.Write(Source.Tables[0].Columns[x].ColumnName);
    ExcelDoc.Write("</Data></Cell>");
   }
   ExcelDoc.Write("</Row>");
   foreach(DataRow x in Source.Tables[0].Rows)
   {
    RowCount++;
    //if the number of rows is > 64000 create a new page to continue output
    if(RowCount==64000)
    {
     RowCount = 0;
     SheetCount++;
     ExcelDoc.Write("</Table>");
     ExcelDoc.Write(" </Worksheet>");
     ExcelDoc.Write("<Worksheet ss:Name=\"Sheet" + SheetCount + "\">");
     ExcelDoc.Write("<Table>");
    }
    ExcelDoc.Write("<Row>"); //ID=" + RowCount + "
    for(int y = 0; y < Source.Tables[0].Columns.Count; y++)
    {
     System.Type rowType;
     rowType = x[y].GetType();
     switch(rowType.ToString())
     {
      case "System.String":
       string XMLstring = x[y].ToString();
       XMLstring = XMLstring.Trim();
       XMLstring = XMLstring.Replace("&","&");
       XMLstring = XMLstring.Replace(">",">");
       XMLstring = XMLstring.Replace("<","<");
       ExcelDoc.Write("<Cell ss:StyleID=\"StringLiteral\">" +
        "<Data ss:Type=\"String\">");
       ExcelDoc.Write(XMLstring);
       ExcelDoc.Write("</Data></Cell>");
       break;
      case "System.DateTime":
       //Excel has a specific Date Format of YYYY-MM-DD followed by 
       //the letter 'T' then hh:mm:sss.lll Example 2005-01-31T24:01:21.000
       //The Following Code puts the date stored in XMLDate
       //to the format above
       DateTime XMLDate = (DateTime)x[y];
       string XMLDatetoString = ""; //Excel Converted Date
       XMLDatetoString = XMLDate.Year.ToString() +
        "-" +
        (XMLDate.Month < 10 ? "0" +
        XMLDate.Month.ToString() : XMLDate.Month.ToString()) +
        "-" +
        (XMLDate.Day < 10 ? "0" +
        XMLDate.Day.ToString() : XMLDate.Day.ToString()) +
        "T" +
        (XMLDate.Hour < 10 ? "0" +
        XMLDate.Hour.ToString() : XMLDate.Hour.ToString()) +
        ":" +
        (XMLDate.Minute < 10 ? "0" +
        XMLDate.Minute.ToString() : XMLDate.Minute.ToString()) +
        ":" +
        (XMLDate.Second < 10 ? "0" +
        XMLDate.Second.ToString() : XMLDate.Second.ToString()) +
        ".000";
       ExcelDoc.Write("<Cell ss:StyleID=\"DateLiteral\">" +
        "<Data ss:Type=\"DateTime\">");
       ExcelDoc.Write(XMLDatetoString);
       ExcelDoc.Write("</Data></Cell>");
       break;
      case "System.Boolean":
       ExcelDoc.Write("<Cell ss:StyleID=\"StringLiteral\">" +
        "<Data ss:Type=\"String\">");
       ExcelDoc.Write(x[y].ToString());
       ExcelDoc.Write("</Data></Cell>");
       break;
      case "System.Int16":
      case "System.Int32":
      case "System.Int64":
      case "System.Byte":
       ExcelDoc.Write("<Cell ss:StyleID=\"Integer\">" +
        "<Data ss:Type=\"Number\">");
       ExcelDoc.Write(x[y].ToString());
       ExcelDoc.Write("</Data></Cell>");
       break;
      case "System.Decimal":
      case "System.Double":
       ExcelDoc.Write("<Cell ss:StyleID=\"Decimal\">" +
        "<Data ss:Type=\"Number\">");
       ExcelDoc.Write(x[y].ToString());
       ExcelDoc.Write("</Data></Cell>");
       break;
      case "System.DBNull":
       ExcelDoc.Write("<Cell ss:StyleID=\"StringLiteral\">" +
        "<Data ss:Type=\"String\">");
       ExcelDoc.Write("");
       ExcelDoc.Write("</Data></Cell>");
       break;
      default:
       throw(new Exception(rowType.ToString() + " not handled."));
     }
    }
    ExcelDoc.Write("</Row>");
   }
   ExcelDoc.Write("</Table>");
   ExcelDoc.Write(" </Worksheet>");
   ExcelDoc.Write(endExcelXML);
   ExcelDoc.Close();
  }


Write Comment
Last Updated ( Tuesday, 06 November 2007 )
 
Setting A NULL Field In Enterprise Manager PDF Print E-mail
Written by Administrator   
Friday, 08 September 2006
SQL Server's Enterprise Manager provides a simple results view to show the data contained in a table. With this view, it is possible to edit the data in the table but there is no obvious method of to set a nullable field to Null.

To set a Null value to the field, PRESS CTRL + 0 (Control + Zero) key combination.

Write Comment
Last Updated ( Tuesday, 06 November 2007 )
 
Make a table of words from a sentance PDF Print E-mail
Written by Administrator   
Thursday, 07 September 2006
This function is very useful if you have a CSV string and you want to make a table of all the values or you have a sentance and you want to make a table of words.

Open Query Analyzer
Login as sa
Copy the code and paste into the Query Analyzer
Click on Query->Execute or Press F5

Test the function
SELECT * FROM dbo.MakeTable('Hari Kishan Charora', ' ')

CREATE FUNCTION MakeTable (@LongText varchar(8000), @Delimiter char(1))
RETURNS @RetResult TABLE (ID int IDENTITY (1, 1) NOT NULL, Value varchar(20))
AS
BEGIN
declare @Value varchar(10)
SET @Value = ''
while PATINDEX('%'+@Delimiter+'%', @LongText) > 0
begin
SET @Value = LTRim(SUBSTRING(@LongText, 1, PATINDEX('%'+@Delimiter+'%', @LongText)-1))
INSERT INTO @RetResult (Value) VALUES (@Value)
SET @LongText = LTRim(SUBSTRING(@LongText, PATINDEX('%'+@Delimiter+'%', @LongText)+1, LEN(@LongText)-PATINDEX('%'+@Delimiter+'%', @LongText)))
end
SET @Value = LTrim(@LongText)
INSERT INTO @RetResult (Value) VALUES (@Value)
RETURN
END


Write Comment
Last Updated ( Tuesday, 06 November 2007 )
 
<< Start < Prev 1 2 3 Next > End >>

Results 1 - 9 of 22
Google





Lost Password?
No account yet? Register
Archive
Newsflash

The six most important words:
"I admit I made a mistake."
The five most important words:
"You did a good job."
The four most important words:
"What is your opinion."
The three most important words:
"If you please."
The two most important words:
"Thank you,"
The one most important word:
"We"
The least most important word:
"I"
-
Author unknown

 
Related Items
Sections
 
Top! Top!