SharePoint Articles





by kevin on 6/22/07
This is because the presentation uses the msorun.cab file that is downloaded from a unsecured Microsoft site when the presentation is loaded thus alerting the user that a component of the web page is coming from an unsecured site. Fix:
  1. Download the cab file here.
  2. Edit the frame.htm file and chnage the path of the cabfile. Note: For some crazy reason the folder that contains the files for your html published PowerPoint presentation is hidden when you are running it from a SharePoint site. Thus you must open the original .ppt file and 'Save As' the PowerPoint presentation in .htm to your DESKTOP and then edit the "frame.htm" file in the folder that it creates. In the frame.htm search for:
    http://download.microsoft.com/download/PowerPoint2002/Install/10.0.2609/WIN98MeXP/EN-US/msorun.cab#version=11,0,0,1
    and change it to:
    msorun.cab#version=11,0,0,1
    This will make the path to the cab file the same as all the other files (secured) and relative to the frame.htm document.
  3. Place the cab file in the PowerPoint folder that is on your desktop.
  4. Upload the whole thing (xxxx.htm, and the PowerPoint folder) to your sharepoint site.


PS-The msorun.cab file is used for PowerPoint animations.

by kevin on 6/27/07
C# using Visual Studio 2005...
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    // How many rows when the page initially loads.
    static int tDefaultRow_Count = 10;
    // Max number of rows.
    static int tMaxRows = 50;

    // Do not modify the following.
    private int tUserAddedRowCount = 0;
    static TextBox[] TextBox_Item = new TextBox[tMaxRows];
    static TextBox[] TextBox_Desc = new TextBox[tMaxRows];
    static TextBox[] TextBox_Quantity = new TextBox[tMaxRows];
    static TextBox[] TextBox_Price = new TextBox[tMaxRows];
    static TextBox[] TextBox_Total = new TextBox[tMaxRows];

    protected void Page_Load(object sender, EventArgs e)
    {
        tUserAddedRowCount = (ViewState["tUserAddedRowCount"] != null) ? int.Parse(ViewState["tUserAddedRowCount"].ToString()) : 0;
        //Response.Write("User Rows: " + tUserAddedRowCount + "\r\n");

        // Recreate the extra rows created by the user on postback
        // events (required to maintain state).
        Add_Table_Rows(tUserAddedRowCount + tDefaultRow_Count);
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
            // User clicked "add a row" button.

            Add_Table_Rows(1);
            ViewState["tUserAddedRowCount"] = ++tUserAddedRowCount;
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        // User clicked "Submit" button.

        for (int x = 0; x < tDefaultRow_Count + tUserAddedRowCount; x++)
        {
            
            if (TextBox_Item[x].Text.ToString().Length > 0) 
            { 
                Response.Write(TextBox_Item[x].Text.ToString());
                Response.Write(TextBox_Desc[x].Text.ToString());
                Response.Write(TextBox_Quantity[x].Text.ToString());
                Response.Write(TextBox_Price[x].Text.ToString());
                Response.Write(TextBox_Total[x].Text.ToString());
            }
        }
    }

    private void Add_Table_Rows(int NumberOfRows)
    {
        for (int x = 0; x < NumberOfRows; x++)
        {
            TableRow myRow = new TableRow();
            Table1.Rows.Add(myRow);

            TableCell myCell0 = new TableCell();
            myRow.Cells.Add(myCell0);
            TextBox myTextbox0 = new TextBox();
            TextBox_Item[x] = myTextbox0;
            myCell0.Controls.Add(TextBox_Item[x]);

            TableCell myCell1 = new TableCell();
            myRow.Cells.Add(myCell1);
            TextBox myTextbox1 = new TextBox();
            TextBox_Desc[x] = myTextbox1;
            myCell1.Controls.Add(TextBox_Desc[x]);

            TableCell myCell2 = new TableCell();
            myRow.Cells.Add(myCell2);
            TextBox myTextbox2 = new TextBox();
            TextBox_Quantity[x] = myTextbox2;
            myCell2.Controls.Add(TextBox_Quantity[x]);

            TableCell myCell3 = new TableCell();
            myRow.Cells.Add(myCell3);
            TextBox myTextbox3 = new TextBox();
            TextBox_Price[x] = myTextbox3;
            myCell3.Controls.Add(TextBox_Price[x]);

            TableCell myCell4 = new TableCell();
            myRow.Cells.Add(myCell4);
            TextBox myTextbox4 = new TextBox();
            TextBox_Total[x] = myTextbox4;
            myCell4.Controls.Add(TextBox_Total[x]);

        }
    }
}

by Kevin on 7/9/07

Make sure to add your .NET reference to Windows SharePoint Services dll. This is a simple console app...

 

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;
namespace UserNameListTester
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                SPSite siteCollection = new SPSite("http://localhost");
                SPWeb mySite = siteCollection.OpenWeb("/");
                SPListItemCollection listItems = mySite.Lists["UserNameListTester"].Items;
                Console.WriteLine("Read in the existing values****************************");
                for (int i = 0; i < listItems.Count; i++)
                {
                    SPListItem item = listItems[i];
                    Console.WriteLine(item["PersonOrGroupColumn"].ToString());
                }
                Console.WriteLine("Writing new values**************************************");
                for (int i = 0; i < listItems.Count; i++)
                {
                    SPListItem listItem = listItems[i];
                    //listItem["Created By"] = mySite.Users["domain\\cornwell"];
                    // get the current logged on user
                    string currentUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
                    listItem["Created By"] = mySite.Users[currentUser];
                    listItem.Update();
                }
                Console.WriteLine("Read out changed values*******************************");
                for (int i = 0; i < listItems.Count; i++)
                {
                    SPListItem item = listItems[i];
                    Console.WriteLine(item["PersonOrGroupColumn"].ToString());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Shit: " + ex.Message.ToString() + ex.Source.ToString() + ex.ToString());
            }
            finally
            {
                string foo = Console.ReadLine();
            }
        }
    }
}

  



by Kevin on 7/12/07

How to enable debugging in WSS 3.0 Renaud Comte has a great tip on how to get the full ASP.NET errors appearing in WSS 3.0. The detail is to add the following item to your Web.Config (C:\Inetpub\wwwroot\wss\VirtualDirectories\80):

 

<SafeMode MaxControls="200" CallStack="false" ...>
<!-- Becomes -->
<SafeMode MaxControls="200" CallStack="true" ...>
 
<customErrors mode="On" />
<!-- Becomes -->
<customErrors mode="Off" />
 
<compilation batch="false" debug="false">
<!-- Becomes -->
<compilation batch="true" debug="true">


by Kevin on 7/20/07

I found this blog on how to do it.

Here is the basic idea..

 

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
    private PeopleEditor objEditor;
    protected void Page_Load(object sender, EventArgs e)
    {
        objEditor = new PeopleEditor();
        objEditor.AutoPostBack = true;
        objEditor.PlaceButtonsUnderEntityEditor = true;
        objEditor.ID = "pplEditor";
        objEditor.AllowEmpty = false;
        objEditor.SelectionSet = "User,SecGroup,SPGroup";
        objEditor.MultiSelect = false;
        Panel1.Controls.Add(objEditor);
    }
    private string GetAccountName()
    {
        string strAccountName = String.Empty;
        for (int i = 0; i < objEditor.ResolvedEntities.Count; i++)
        {
            PickerEntity objEntity = (PickerEntity)objEditor.ResolvedEntities[i];
            SPUserInfo objInfo = new SPUserInfo();
            objInfo.LoginName = objEntity.Key;
            strAccountName = objInfo.LoginName;
            // to return a sharepoint people group formatted string use...
            // strAccountName = objEntity.EntityData["SPUserID"].ToString() + ";#" + objEntity.DisplayText.ToString();
        }
        return strAccountName;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string strAccountName = GetAccountName();
        Label1.Text = "account name: " + strAccountName;
    }
}


Or via HTML:

<SharePoint:PeopleEditor runat="server" ID="pplEditor"
        AutoPostBack="true" AllowEmpty="false" SelectionSet="User,SecGroup,SPGroup"
        BorderWidth="1" Width="200px" PlaceButtonsUnderEntityEditor="false" Rows="1" />

 

For this code to work you must publish it to a SharePoint website. You cannot run it from the Visual Studio debugger. 

Here is the MSDN class reference.


by Kevin on 8/14/07

Add the following line to the post build command list. It will publish the dll to the SharePoint site, reset IIS (clearing the cached object), and open IE.

 


xcopy "*.dll" "C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin\" /y
iisreset
"C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://localhost/mydevsite/


 

Edit as needed.

by Kevin on 9/27/07

In order for a user to perform tasks on a SharePoint site that require higher permissions than they have, you can use "RunWithElevateedPrivileges" method of the SPSecurity object. The account used is assumed to be the "system account".

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    // CODE TO RUN WITH ELEVATED PRIVILEGES GOES HERE //
    SPSite siteCollection = new SPSite("https://foobar.com");
    SPWeb mySite = siteCollection.AllWebs["tpms/review"];
    mySite.AllowUnsafeUpdates = true;
    SPWeb rootSite = siteCollection.OpenWeb("/");
    SPListItemCollection myList = mySite.Lists["Performance Improvement Notice Tasking"].Items;
    SPListItem updateItem = myList.GetItemById((int)globalIdNumber);
    updateItem["Title"] = "Foobar";
    updateItem.Update();
    mySite.Dispose();
    rootSite.Dispose();
    // END ELEVATED CODE BLOCK //
});

This mean no more .credentials auth crap.


by Kevin on 10/23/07

By default when you click Actions --> E-Mail Users, you are limited by characters count in the mailto: property. If you have a large number of users in in a SharePoint Group and you want to email them the action will die without a message. I wrote a bit of Javascript to capture the emails (when the user clicks "E-Mail Users") and copy them to the clipboard if IE or display a div if FF. This way you can start your email client and paste all the addresses in appropriate field. Backup then Edit:

C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/LAYOUTS/people.aspx



Find (~line # 78):

function BtnEmailClick(viewId){
    var emails = GetSelectedUsers(viewId, "email", ";");
    if (emails.length == 0)
    {
            alert(noUserEmailSelectedMsg);
            return false;
    }
    emails = "mailto:" + escapeProperly(emails);
    window.location = emails;
    return false;
}

 

Replace with:

/*             POPUP Email Addresses to DIV or Clipboard.               */

// OLD METHOD
// function BtnEmailClick(viewId)
// {
// var emails = GetSelectedUsers(viewId, "email", ";");
// if (emails.length == 0)
// {
// alert(noUserEmailSelectedMsg);
// return false;
// }
// emails = "mailto:" + escapeProperly(emails);
// window.location = emails;
// return false;
// }


// NEW METHOD
function BtnEmailClick(viewId)
{
    var emails = GetSelectedUsers(viewId, "email", ";");
    if (emails.length == 0)
    {
        alert(noUserEmailSelectedMsg);
        return false;
    }
    emails = escapeProperly(emails);
    emails = unescape(emails);
    // get rid of the anchor mailto:
    emails = emails.replace(emails.substring(emails.indexOf('<'), emails.indexOf('>', emails.indexOf('<')) + 1), "");
    var regEx = /;/g;
    // alert(emails);
    // Post the string to the clipboard if IE.
    if (ClipBoard(emails))
    {
        alert( countNeedles(";", emails) + " email addresses have been copied to your clipboard.");
    } else { // Pop the email in a div.
        emails = emails.replace(regEx, ";\n");
        // make pretty for div
        document.getElementById('popEmailTextArea').innerHTML = unescape(emails);
        popup(document.getElementById('popEmailDiv'));
    }
    return false;
}
function popup( obj )
{
    with( obj.style )
    {
        display = "inline"; position = "relative";
    }
}
function unpop( obj )
{
    obj.style.display = "none";
}
function ClipBoard(s)
{
    if (!document.all)
        return false;
    // IE only
    var holdtext = document.getElementById('holdtext');
    holdtext.innerText = s; Copied = holdtext.createTextRange();
    Copied.execCommand("Copy");
    return true;
}
function countNeedles(needle, haystack)
{
    count = 1;
    pos = haystack.indexOf(needle);
    while ( pos != -1 )
    {
        count++;
        pos = haystack.indexOf(needle, pos+1);
    }
    return count;
}
/*       END: POPUP Email Addresses to DIV or Clipboard.        */

 


Find this:

<body>

And paste below:

<div id="popEmailDiv" style="margin: 10px; display: none">
    <p style="border: 1px solid red; margin: 3px; padding: 3px; color: red; background-color: pink; text-align: center">
        &nbsp;
        <span style="font-weight: bold; font-size: 16px; color: red">Copy and paste email addresses:</span>
    </p>
</div>

 

 

Save and test. Summary: Mailto links are limited to 2,083 characters in IE. SharePoint performs a redirect to a "mailto" link which would normally open your email client. If the length of the URL (mailto) is longer than this nothing happens and the redirect is ignored. You can read more about the IE limitation here: http://support.microsoft.com/default.aspx?scid=KB;en-us;q208427

 


by Kevin on 10/25/07

Cannot get the list schema column property from the SharePoint List

You will get this popup alert (error message) when you try to export list to a spreadsheet (owssvr.iqy) when the column of a "Date and Time" feild is corrupted. The only fix I have found is to covert the "Date and Time" field to a "Single line of text" then back to a "Date and Time" field. Microsoft, please fix this.


by kevin on 7/9/07
Make sure to add your .NET reference to Windows SharePoint Services dll. This is a simple console app...
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Utilities;

namespace UserNameListTester
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                SPSite siteCollection = new SPSite("http://localhost");
                SPWeb mySite = siteCollection.OpenWeb("/");                
                SPListItemCollection listItems = mySite.Lists["UserNameListTester"].Items;

                Console.WriteLine("Read in the existing values****************************");

                for (int i = 0; i < listItems.Count; i++)
                {
                    SPListItem item = listItems[i];
                    Console.WriteLine(item["PersonOrGroupColumn"].ToString());
                }

                Console.WriteLine("Writing new values**************************************");

                for (int i = 0; i < listItems.Count; i++)
                {
                    SPListItem listItem = listItems[i];

                    //listItem["Created By"] = mySite.Users["domain\\cornwell"];

                    // get the current logged on user
                    string currentUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); 
                    listItem["Created By"] = mySite.Users[currentUser];

                    listItem.Update();
                }

                Console.WriteLine("Read out changed values*******************************");

                for (int i = 0; i < listItems.Count; i++)
                {
                    SPListItem item = listItems[i];
                    Console.WriteLine(item["PersonOrGroupColumn"].ToString());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Shit: " + ex.Message.ToString() + ex.Source.ToString() + ex.ToString());
            }
            finally
            {
                string foo = Console.ReadLine();
            }
        }
    }
}


by Kevin on 7/12/07

How to enable debugging in WSS 3.0 Renaud Comte has a great tip on how to get the full ASP.NET errors appearing in WSS 3.0. The detail is to add the following item to your Web.Config (C:\Inetpub\wwwroot\wss\VirtualDirectories\80):

 

<SafeMode MaxControls="200" CallStack="false" ...>
<!-- Becomes -->
<SafeMode MaxControls="200" CallStack="true" ...>
 
<customErrors mode="On" />
<!-- Becomes -->
<customErrors mode="Off" />
 
<compilation batch="false" debug="false">
<!-- Becomes -->
<compilation batch="true" debug="true">


by Kevin on 7/20/07

I found this blog on how to do it.

Here is the basic idea..

 

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
    private PeopleEditor objEditor;
    protected void Page_Load(object sender, EventArgs e)
    {
        objEditor = new PeopleEditor();
        objEditor.AutoPostBack = true;
        objEditor.PlaceButtonsUnderEntityEditor = true;
        objEditor.ID = "pplEditor";
        objEditor.AllowEmpty = false;
        objEditor.SelectionSet = "User,SecGroup,SPGroup";
        objEditor.MultiSelect = false;
        Panel1.Controls.Add(objEditor);
    }
    private string GetAccountName()
    {
        string strAccountName = String.Empty;
        for (int i = 0; i < objEditor.ResolvedEntities.Count; i++)
        {
            PickerEntity objEntity = (PickerEntity)objEditor.ResolvedEntities[i];
            SPUserInfo objInfo = new SPUserInfo();
            objInfo.LoginName = objEntity.Key;
            strAccountName = objInfo.LoginName;
            // to return a sharepoint people group formatted string use...
            // strAccountName = objEntity.EntityData["SPUserID"].ToString() + ";#" + objEntity.DisplayText.ToString();
        }
        return strAccountName;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string strAccountName = GetAccountName();
        Label1.Text = "account name: " + strAccountName;
    }
}


Or via HTML:

<SharePoint:PeopleEditor runat="server" ID="pplEditor"
        AutoPostBack="true" AllowEmpty="false" SelectionSet="User,SecGroup,SPGroup"
        BorderWidth="1" Width="200px" PlaceButtonsUnderEntityEditor="false" Rows="1" />

 

For this code to work you must publish it to a SharePoint website. You cannot run it from the Visual Studio debugger. 

Here is the MSDN class reference.


by Kevin on 8/14/07

Add the following line to the post build command list. It will publish the dll to the SharePoint site, reset IIS (clearing the cached object), and open IE.

 


xcopy "*.dll" "C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin\" /y
iisreset
"C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://localhost/mydevsite/


 

Edit as needed.

by Kevin on 9/27/07

In order for a user to perform tasks on a SharePoint site that require higher permissions than they have, you can use "RunWithElevateedPrivileges" method of the SPSecurity object. The account used is assumed to be the "system account".

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    // CODE TO RUN WITH ELEVATED PRIVILEGES GOES HERE //
    SPSite siteCollection = new SPSite("https://foobar.com");
    SPWeb mySite = siteCollection.AllWebs["tpms/review"];
    mySite.AllowUnsafeUpdates = true;
    SPWeb rootSite = siteCollection.OpenWeb("/");
    SPListItemCollection myList = mySite.Lists["Performance Improvement Notice Tasking"].Items;
    SPListItem updateItem = myList.GetItemById((int)globalIdNumber);
    updateItem["Title"] = "Foobar";
    updateItem.Update();
    mySite.Dispose();
    rootSite.Dispose();
    // END ELEVATED CODE BLOCK //
});

This mean no more .credentials auth crap.


by Kevin on 10/23/07

By default when you click Actions --> E-Mail Users, you are limited by characters count in the mailto: property. If you have a large number of users in in a SharePoint Group and you want to email them the action will die without a message. I wrote a bit of Javascript to capture the emails (when the user clicks "E-Mail Users") and copy them to the clipboard if IE or display a div if FF. This way you can start your email client and paste all the addresses in appropriate field. Backup then Edit:

C:/Program Files/Common Files/Microsoft Shared/web server extensions/12/TEMPLATE/LAYOUTS/people.aspx



Find (~line # 78):

function BtnEmailClick(viewId){
    var emails = GetSelectedUsers(viewId, "email", ";");
    if (emails.length == 0)
    {
            alert(noUserEmailSelectedMsg);
            return false;
    }
    emails = "mailto:" + escapeProperly(emails);
    window.location = emails;
    return false;
}

 

Replace with:

/*             POPUP Email Addresses to DIV or Clipboard.               */

// OLD METHOD
// function BtnEmailClick(viewId)
// {
// var emails = GetSelectedUsers(viewId, "email", ";");
// if (emails.length == 0)
// {
// alert(noUserEmailSelectedMsg);
// return false;
// }
// emails = "mailto:" + escapeProperly(emails);
// window.location = emails;
// return false;
// }


// NEW METHOD
function BtnEmailClick(viewId)
{
    var emails = GetSelectedUsers(viewId, "email", ";");
    if (emails.length == 0)
    {
        alert(noUserEmailSelectedMsg);
        return false;
    }
    emails = escapeProperly(emails);
    emails = unescape(emails);
    // get rid of the anchor mailto:
    emails = emails.replace(emails.substring(emails.indexOf('<'), emails.indexOf('>', emails.indexOf('<')) + 1), "");
    var regEx = /;/g;
    // alert(emails);
    // Post the string to the clipboard if IE.
    if (ClipBoard(emails))
    {
        alert( countNeedles(";", emails) + " email addresses have been copied to your clipboard.");
    } else { // Pop the email in a div.
        emails = emails.replace(regEx, ";\n");
        // make pretty for div
        document.getElementById('popEmailTextArea').innerHTML = unescape(emails);
        popup(document.getElementById('popEmailDiv'));
    }
    return false;
}
function popup( obj )
{
    with( obj.style )
    {
        display = "inline"; position = "relative";
    }
}
function unpop( obj )
{
    obj.style.display = "none";
}
function ClipBoard(s)
{
    if (!document.all)
        return false;
    // IE only
    var holdtext = document.getElementById('holdtext');
    holdtext.innerText = s; Copied = holdtext.createTextRange();
    Copied.execCommand("Copy");
    return true;
}
function countNeedles(needle, haystack)
{
    count = 1;
    pos = haystack.indexOf(needle);
    while ( pos != -1 )
    {
        count++;
        pos = haystack.indexOf(needle, pos+1);
    }
    return count;
}
/*       END: POPUP Email Addresses to DIV or Clipboard.        */

 


Find this:

<body>

And paste below:

<div id="popEmailDiv" style="margin: 10px; display: none">
    <p style="border: 1px solid red; margin: 3px; padding: 3px; color: red; background-color: pink; text-align: center">
        &nbsp;
        <span style="font-weight: bold; font-size: 16px; color: red">Copy and paste email addresses:</span>
    </p>
</div>

 

 

Save and test. Summary: Mailto links are limited to 2,083 characters in IE. SharePoint performs a redirect to a "mailto" link which would normally open your email client. If the length of the URL (mailto) is longer than this nothing happens and the redirect is ignored. You can read more about the IE limitation here: http://support.microsoft.com/default.aspx?scid=KB;en-us;q208427

 


by Kevin on 10/25/07

Cannot get the list schema column property from the SharePoint List

You will get this popup alert (error message) when you try to export list to a spreadsheet (owssvr.iqy) when the column of a "Date and Time" feild is corrupted. The only fix I have found is to covert the "Date and Time" field to a "Single line of text" then back to a "Date and Time" field. Microsoft, please fix this.


by Kevin on 11/19/07

I have moved my SharePoint blog from www.kevincornwell.com/blog to this site.  Some of the formatting during the migration is broken and will be fixed soon. 

 Thanks,

Kevin Cornwell


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 1/9/08
  1. Open your site in SharePoint Designer.
  2. Browse to your list and open the 'NewForm.aspx' web form.
  3. Go File -> Save As... and give the form a new name such as 'NewForm2.aspx'.
  4. Hide the default List Form Web Part from the page (do not delete it!!).
    1. Right click the List Form Web Part -> Web Part Properties -> expand Layout -> check Hidden.
  5. Go Insert > SharePoint Controls -> Custom List Form.
  6. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
  7. Click OK and a new Data Form Web Part is added with controls representing all the fields from the list (in my environment all the controls show "Error Rendering Control" but this does not affect the final result).
  8. In the newly added Data Form Web Part, delete the rows containing fields not to be shown to the user (ensure that fields being removed are not required fields without default values as this would prevent the user from submitting the form).
  9. At this point, you can do other customisation such as rearranging the fields if you wish.
  10. Save the site.

To make the new form the default form:

    1. Open the site in SharePoint Designer.
    2. Right click the list in the Folder List and select Properties.
    3. Go to the Supporting Files tab.
    4. Use the Browse button to enter the path to your new Edit item form.

Note: To redirect after the form is submitted, use the following syntax in your misc links that point to the new form...

http://portal.example.com/Lists/YourList/NewForm2.aspx?Source=http://portal.example.com/redirectpage.htm

 


Credit:

http://kalsing.blogspot.com/2006/11/create-custom-list-form-for-sharepoint.html

http://office.microsoft.com/en-us/sharepointdesigner/HA101191111033.aspx 

  

Problems: ("Invalid page URL"), see these articles:

http://support.microsoft.com/kb/935504

 

Gotchas:

  • Do not delete the default List Form Web Part from the page, "Hide" it!  You will get "Invalid page URL" errors if you delete it from your modified newform.aspx.
  • I have discovered that if you create a new item (that uses your modified NewForm.aspx) in a folder of a list, the new item is placed at the root of the list rather than the folder your created the item in.  I have an open Microsoft Support Ticket on this and will update this blog when it resolved.  Update: The have now issued a known bug and put it on their "fix list".  No word on when it will be patched (probably next service release).

 


by Kevin on 1/9/08
  1. Open your site in SharePoint Designer.
  2. Browse to your list and open the 'NewForm.aspx' web form.
  3. Go File -> Save As... and give the form a new name such as 'NewForm2.aspx'.
  4. Hide the default List Form Web Part from the page (do not delete it!!).
    1. Right click the List Form Web Part -> Web Part Properties -> expand Layout -> check Hidden.
  5. Go Insert > SharePoint Controls -> Custom List Form.
  6. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
  7. Click OK and a new Data Form Web Part is added with controls representing all the fields from the list (in my environment all the controls show "Error Rendering Control" but this does not affect the final result).
  8. In the newly added Data Form Web Part, delete the rows containing fields not to be shown to the user (ensure that fields being removed are not required fields without default values as this would prevent the user from submitting the form).
  9. At this point, you can do other customisation such as rearranging the fields if you wish.
  10. Save the site.

To make the new form the default form:

    1. Open the site in SharePoint Designer.
    2. Right click the list in the Folder List and select Properties.
    3. Go to the Supporting Files tab.
    4. Use the Browse button to enter the path to your new Edit item form.

Note: To redirect after the form is submitted, use the following syntax in your misc links that point to the new form...

http://portal.example.com/Lists/YourList/NewForm2.aspx?Source=http://portal.example.com/redirectpage.htm

 


Credit:

http://kalsing.blogspot.com/2006/11/create-custom-list-form-for-sharepoint.html

http://office.microsoft.com/en-us/sharepointdesigner/HA101191111033.aspx 

  

Problems: ("Invalid page URL"), see these articles:

http://support.microsoft.com/kb/935504

 

Gotchas:

  • Do not delete the default List Form Web Part from the page, "Hide" it!  You will get "Invalid page URL" errors if you delete it from your modified newform.aspx.
  • I have discovered that if you create a new item (that uses your modified NewForm.aspx) in a folder of a list, the new item is placed at the root of the list rather than the folder your created the item in.  I have an open Microsoft Support Ticket on this and will update this blog when it resolved.  Update: The have now issued a known bug and put it on their "fix list".  No word on when it will be patched (probably next service release).

 


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 1/29/08

Ran into a problem when I was writing script to add a new entry to a column (using XML web services). I could not get the column names the same as the were name. Like my "e-mail" column. So for that one I had to type for the id in the script e_x002d_mail.

Blank space: _x0020_
Underscore: _x002d_
Dash: _x0027_

Here is the Format:

_x00[the escape code]_


Char         Code 

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

 


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 1/29/08

You may see this error:

An error occurred during the processing of /test.aspx. Code blocks are not allowed in this file.

Reason:  SharePoint does not allow server side code to execute in aspx pages contained in the SharePoint site.

Fix:  Edit the web.config (I.E. C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config) file:

<PageParserPaths>
        <!-- To allow a single file: -->
        <PageParserPath VirtualPath="/test.aspx" CompilationMode="Always" AllowServerSideScript="true" />
        <!-- To allow global: -->
        <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" />
        <!-- To allow global within a subsite: -->
        <PageParserPath VirtualPath="/websitefoobar/*" CompilationMode="Always" AllowServerSideScript="true" />
</PageParserPaths>

by Kevin on 1/29/08

Ran into a problem when I was writing script to add a new entry to a column (using XML web services). I could not get the column names the same as the were name. Like my "e-mail" column. So for that one I had to type for the id in the script e_x002d_mail.

Blank space: _x0020_
Underscore: _x002d_
Dash: _x0027_

Here is the Format:

_x00[the escape code]_


Char         Code 

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

 


by Kevin on 1/29/08

You may see this error:

An error occurred during the processing of /test.aspx. Code blocks are not allowed in this file.

Reason:  SharePoint does not allow server side code to execute in aspx pages contained in the SharePoint site.

Fix:  Edit the web.config (I.E. C:\Inetpub\wwwroot\wss\VirtualDirectories\80\web.config) file:

<PageParserPaths>
        <!-- To allow a single file: -->
        <PageParserPath VirtualPath="/test.aspx" CompilationMode="Always" AllowServerSideScript="true" />
        <!-- To allow global: -->
        <PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" />
        <!-- To allow global within a subsite: -->
        <PageParserPath VirtualPath="/websitefoobar/*" CompilationMode="Always" AllowServerSideScript="true" />
</PageParserPaths>

by Kevin on 3/13/08

PROBLEM: If you are trying to deploy a webpart from a Visual Studio solution and get this error... 

Unable to add selected web part(s).

Assemblies that implement ASP.NET Web Parts and are installed into a partially trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedCallers set for import to succeed.

 

FIX: Add the following to your AssemblyInfo.cs and recompile.

using System.Runtime.InteropServices; 

[assembly: AllowPartiallyTrustedCallers] 

 


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 3/13/08

PROBLEM: If you are trying to deploy a webpart from a Visual Studio solution and get this error... 

Unable to add selected web part(s).

Assemblies that implement ASP.NET Web Parts and are installed into a partially trusted location, such as the bin directory, must be compiled with the AllowPartiallyTrustedCallers set for import to succeed.

 

FIX: Add the following to your AssemblyInfo.cs and recompile.

using System.Runtime.InteropServices; 

[assembly: AllowPartiallyTrustedCallers] 

 


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 1/29/08

[Today] The current date.

[Me] Current User of the site.

[Modified] Date item was last modified.

 

Filter Expression Examples: 

[Modified]+7  A week after the last modification.

DATE(YEAR(Modified),MONTH(Modified),DAY(Modified)+5)  5 Days after the last modification. 

 

 
Formulas and Functions:

http://office.microsoft.com/en-us/sharepointtechnology/CH100650061033.aspx


by Kevin on 1/29/08

[Today] The current date.

[Me] Current User of the site.

[Modified] Date item was last modified.

 

Filter Expression Examples: 

[Modified]+7  A week after the last modification.

DATE(YEAR(Modified),MONTH(Modified),DAY(Modified)+5)  5 Days after the last modification. 

 

 
Formulas and Functions:

http://office.microsoft.com/en-us/sharepointtechnology/CH100650061033.aspx


by mysharepointblog.nospam@nospam.kevincornwell.com (John) on 4/18/08

If you are trying to consume a Sharepoint web service - from a Windows Application - on a server that is configured for both SSL and Require Client Certificate, you need to do the following:

  1. First, export the client certifiate to a file following the directions in the section titled: "Step 1: Export the Client Certificate to a File" at this link: http://msdn2.microsoft.com/en-us/library/aa302408.aspx.
  2. Next you need to tell the web service to use that certificate like this: lists.ClientCertificates.Add(X509Certificate.CreateFromCertFile("C:\file_where_certificate_is_stored_from_above_step");
  3. Finally (and this is the part that Microsoft left out of their instructions) you need to authenticate to the web service using ONE of the following methods:
    • lists.Credentials = CredentialCache.DefaultNetworkCredentials; <-- This uses the credentials of the logged on user.
    • CredentialCache cache = new System.Net.CredentialCache(); cache.Add(new Uri(lists.Url), "Basic", new NetworkCredential(UserID, Password, Domain)); lists.Credentials = cache;

 

 


by John on 4/18/08

If you are trying to consume a Sharepoint web service - from a Windows Application - on a server that is configured for both SSL and Require Client Certificate, you need to do the following:

  1. First, export the client certifiate to a file following the directions in the section titled: "Step 1: Export the Client Certificate to a File" at this link: http://msdn2.microsoft.com/en-us/library/aa302408.aspx.
  2. Next you need to tell the web service to use that certificate like this: lists.ClientCertificates.Add(X509Certificate.CreateFromCertFile("C:\file_where_certificate_is_stored_from_above_step");
  3. Finally (and this is the part that Microsoft left out of their instructions) you need to authenticate to the web service using ONE of the following methods:
    • lists.Credentials = CredentialCache.DefaultNetworkCredentials; <-- This uses the credentials of the logged on user.
    • CredentialCache cache = new System.Net.CredentialCache(); cache.Add(new Uri(lists.Url), "Basic", new NetworkCredential(UserID, Password, Domain)); lists.Credentials = cache;

 

 


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 4/29/08

Boss sent me to DevConnecitons again and it was great!

Here are my notes for the SharePoint classes I sat in on.

 

  • Pre Conference Work shop: SharePoint Workflows HPR201 by Rober Bogue.
    • SharePoint Designer workflows pros/cons:
      • Not truely "portable" becuase of list GUID's in XAML and must be associated with an item.
      • No code needed.
      • GUI based.
    • Visual Studio workflows pros/cons:
      • Complete control.
      • Require strong development skills.
      • Requires more time to develop.
    • SharePoint Designer Workflows can be extened with Visual Studio.
    • Required for Visual Studio Dev:
      • Visual Studio Extensions for Workflow Foundation.
      • VSeWSS
    • Workflow Types:
      • Sequential (think SharePoint Designer workflows)
      • State Machine.
    • Can run a WorkFlow on a content type.
    • Note: Pauses in SP Designer WorkFlows are averaged out to ~5 minutes due to the SP timer trigger interval.
    • WorkFlow DLL must be deployed to the GAC.
    • When building a VSworkflow, it becomes a workflow type availible in the List settings -> Workflow.  YEA!
    • Set a fault handler to catch all faults in your VS Workflow type (see Robert Bogue's Blog).
    • Tip: Restart WSS timer every 4 hours due to memory leaks.
    • Errors are logged here = 12\logs\.
    • Get log viewer utiltiy from CodePlex here.
    • .wsp files is a special cab file.
    • Brackets for GUID's are allowed and only allowed in the ContentType.xml.  It is the only place in sharepoint.
    • DisplaceOnUpgrage="TRUE" required inContentTypes.xml.  This is becuase any new changes will not upgrade by default.
    • Included in this zip is a nice LDAP class.  200804SPConn-Workflow.zip (4.28 mb)
    • Here is a nice web debugging utitlity (HTTP debugger proxy): http://www.fiddlertool.com/fiddler/
  • More to come soon.



by Kevin on 4/29/08

Boss sent me to DevConnecitons again and it was great!

Here are my notes for the SharePoint classes I sat in on.

 

  • Pre Conference Work shop: SharePoint Workflows HPR201 by Rober Bogue.
    • SharePoint Designer workflows pros/cons:
      • Not truely "portable" becuase of list GUID's in XAML and must be associated with an item.
      • No code needed.
      • GUI based.
    • Visual Studio workflows pros/cons:
      • Complete control.
      • Require strong development skills.
      • Requires more time to develop.
    • SharePoint Designer Workflows can be extened with Visual Studio.
    • Required for Visual Studio Dev:
      • Visual Studio Extensions for Workflow Foundation.
      • VSeWSS
    • Workflow Types:
      • Sequential (think SharePoint Designer workflows)
      • State Machine.
    • Can run a WorkFlow on a content type.
    • Note: Pauses in SP Designer WorkFlows are averaged out to ~5 minutes due to the SP timer trigger interval.
    • WorkFlow DLL must be deployed to the GAC.
    • When building a VSworkflow, it becomes a workflow type availible in the List settings -> Workflow.  YEA!
    • Set a fault handler to catch all faults in your VS Workflow type (see Robert Bogue's Blog).
    • Tip: Restart WSS timer every 4 hours due to memory leaks.
    • Errors are logged here = 12\logs\.
    • Get log viewer utiltiy from CodePlex here.
    • .wsp files is a special cab file.
    • Brackets for GUID's are allowed and only allowed in the ContentType.xml.  It is the only place in sharepoint.
    • DisplaceOnUpgrage="TRUE" required inContentTypes.xml.  This is becuase any new changes will not upgrade by default.
    • Included in this zip is a nice LDAP class.  200804SPConn-Workflow.zip (4.28 mb)
    • Here is a nice web debugging utitlity (HTTP debugger proxy): http://www.fiddlertool.com/fiddler/
  • More to come soon.



by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 5/9/08

For example, the LastItemModifiedDate property of a SPList is not local time, it is UTC.  So just use the SPWeb object to convert it to local time.

DateTime myDT = mySPWeb.RegionalSettings.TimeZone.UTCToLocalTime(mySPList.LastItemModifiedDate)


by Kevin on 5/9/08

For example, the LastItemModifiedDate property of a SPList is not local time, it is UTC.  So just use the SPWeb object to convert it to local time.

DateTime myDT = mySPWeb.RegionalSettings.TimeZone.UTCToLocalTime(mySPList.LastItemModifiedDate)


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 9/26/08

Looking for a way to iterate a SharePoint list item (SPListItem) for all attachments and render them on your page?  Here is a nice example....

private String x_renderAttachmentData(SPListItem listItem)
{
    String strAttachmentData = String.Empty;

    try
    {

        if (listItem.Attachments.Count > 0)
        {

            foreach (string fileName in listItem.Attachments)
            {
                SPFile spFile = listItem.ParentList.ParentWeb.GetFile(listItem.Attachments.UrlPrefix + fileName);
                int fileSize = (int)spFile.Length / 1000;
                strAttachmentData += "<div class='attachment'>"
                                   + "<img src='_layouts/images/" + spFile.IconUrl + "'> "
                                   + "<a target='_blank' href='" + URL_ROOT + "/" + spFile.Url + "'>"
                                   + spFile.Name + "</a> &nbsp; (" + fileSize + " KB)"
                                   + "<div class='hr'></div>Attachment version: " + spFile.UIVersionLabel
                                   + "<br/>Created at " + spFile.TimeCreated.ToString() + " by "
                                   + spFile.Author.ToString().Substring(spFile.Author.ToString().IndexOf('\\') + 1)
                                   + "<br/>Last modified at " + spFile.TimeLastModified.ToString() + " by "
                                   + spFile.ModifiedBy.ToString().Substring(spFile.ModifiedBy.ToString().IndexOf('\\') + 1)
                                   + "</div><div style='clear:left;'></div>";  // just call me a css genius.
               
            }
        }
        return strAttachmentData;

    }
    catch (Exception exp)
    {
        // handle exp.
    }
}

 

 

Output for this function looks like this... 

 

 

Here is the css if you are interested....

.attachment
{
 color:#999999;
 font-size:9px;
 margin-bottom:0px;
 float:left;
}
.attachment img{margin-bottom:-2px;}
.attachment .hr
{
 border-top:1px solid #bbbbbb;
 margin-top:2px;
}
.attachment a:link,
.attachment a:visited,
.attachment a:hover
{
 font-size:14px;
 line-height:18px;
}

 

 


by Kevin on 9/26/08

Looking for a way to iterate a SharePoint list item (SPListItem) for all attachments and render them on your page?  Here is a nice example....

private String x_renderAttachmentData(SPListItem listItem)
{
    String strAttachmentData = String.Empty;

    try
    {

        if (listItem.Attachments.Count > 0)
        {

            foreach (string fileName in listItem.Attachments)
            {
                SPFile spFile = listItem.ParentList.ParentWeb.GetFile(listItem.Attachments.UrlPrefix + fileName);
                int fileSize = (int)spFile.Length / 1000;
                strAttachmentData += "<div class='attachment'>"
                                   + "<img src='_layouts/images/" + spFile.IconUrl + "'> "
                                   + "<a target='_blank' href='" + URL_ROOT + "/" + spFile.Url + "'>"
                                   + spFile.Name + "</a> &nbsp; (" + fileSize + " KB)"
                                   + "<div class='hr'></div>Attachment version: " + spFile.UIVersionLabel
                                   + "<br/>Created at " + spFile.TimeCreated.ToString() + " by "
                                   + spFile.Author.ToString().Substring(spFile.Author.ToString().IndexOf('\\') + 1)
                                   + "<br/>Last modified at " + spFile.TimeLastModified.ToString() + " by "
                                   + spFile.ModifiedBy.ToString().Substring(spFile.ModifiedBy.ToString().IndexOf('\\') + 1)
                                   + "</div><div style='clear:left;'></div>";  // just call me a css genius.
               
            }
        }
        return strAttachmentData;

    }
    catch (Exception exp)
    {
        // handle exp.
    }
}

 

 

Output for this function looks like this... 

 

 

Here is the css if you are interested....

.attachment
{
 color:#999999;
 font-size:9px;
 margin-bottom:0px;
 float:left;
}
.attachment img{margin-bottom:-2px;}
.attachment .hr
{
 border-top:1px solid #bbbbbb;
 margin-top:2px;
}
.attachment a:link,
.attachment a:visited,
.attachment a:hover
{
 font-size:14px;
 line-height:18px;
}

 

 


by Kevin on 10/8/08

The following procedures step you through the process of configuring Office SharePoint Server 2007 search services, creating a Web application for the SSP, creating the SSP, and configuring indexing settings.

 

Start and configure the Search service

  1. On the SharePoint Central Administration home page, click the Operations tab on the top navigation bar.
  2. On the Operations page, in Topology and Services, click Servers in farm.
  3. On the Servers in Farm page, click the server on which you want to configure the search service.
  4. Click Start next to Office SharePoint Server Search.
  5. On the Office SharePoint Server Search Settings page, in the Query and Indexing section, make sure that the Use this server for indexing content and Use this server for serving search queries check boxes are selected.
  6. In the Default Catalog Location section, type a path to a physical folder to store the index files, or use the default location that is specified.
  7. In the Contact E-Mail Address section, specify a valid e-mail address.
  8. In the Service Account section, click Configurable, and in User name and Password, type the user name and password for the user account under which you want the Search service to run. The user account must be a member of the Administrators group on the computer that is running the Search service. If you want to use the principle of least privilege and select a unique user account that does not have administrative rights on your front-end servers or on your back-end database servers, see the Known Issues/Readme for Office SharePoint Server 2007 Beta 2. The user name must be in the format DOMAIN\username.
  9. In the Web Front End And Crawling section, do one of the following:
    • If you are configuring the search service on a server that provides Web services and renders Web content, click No dedicated Web front-end computer for crawling
    • If you are configuring the search service on a server that is a standalone search server that does not provide Web services and render Web content, click Use a dedicated web front end computer for crawling, and then, in Select a web front end computer, click the computer you want to use for crawling.
  10. Click Start.
Start the Windows SharePoint Services Web Application service

You must start the Windows SharePoint Services Web Application service on every computer that you want to act as a Web server and was set up using the Complete option during Setup. This service is started by default on servers that were set up using the Web Front End option. To enhance security, you can leave this service turned off on application servers that do not provide Web content to client computers. Also, you do not need to turn this service on to use SharePoint Central Administration on a server.

  1. On the SharePoint Central Administration home page, click the Operations tab on the top navigation bar.
  2. On the Operations page, in Topology and Services, click Servers in farm.
  3. On the Servers in Farm page, click the server on which you want to start the Windows SharePoint Services Web Application service.
  4. Click Start next to Window SharePoint Services Web Application.
Create the Shared Services Provider
  1. On the SharePoint Central Administration home page, click the Application Management tab on the top navigation bar.
  2. On the Application Management page, in the Office SharePoint Server Shared Services section, click Create or configure this farm's shared services.
  3. On the Manage this Farm's Shared Services page, click New SSPImportant: If you have not created a Web application for the SSP administration site, you need to create one before you create the SSP. If you have already created a Web application for the SSP administration site, skip to step 14.
  4. On the New Shared Services Provider page, click Create a new Web application.
  5. On the Create New Web Application page, in the IIS Web Site section, click Create a new IIS web site, and do not modify the default settings in this section.
  6. In the Security Configuration section, under Authentication provider, select the appropriate option for your environment, and do not modify the default settings in the remainder of this section.
  7. In the Load Balanced URL section, do not modify the default settings.
  8. In the Application Pool section, click Create new application pool.
  9. In Application pool name, enter the name of your application pool or use the default name.
  10. Click Configurable, and in User name and Password, type the user name and password for the user account under which you want the application pool to run. The user account does not have to be a member of any particular security group. It is recommended that you use the principle of least privilege and select a unique user account that does not have administrative rights on your front-end servers or on your back-end database servers. You can use the user account that you specified as the Office SharePoint Server 2007 service account; however, if that user account is a member of a security group that has administrative rights on your front-end servers or your back-end database servers, you will not be following the principle of least privilege. The user name must be in the format DOMAIN\username.
  11. In the Database Name and Authentication section, verify the database information and make sure that Windows Authentication (recommended)is selected.
  12. In the Search Server section, do not modify the default settings.
  13. Click OK. Upon successful creation of the Web application, the New Shared Services Provider page appears.
  14. In the SSP Name section, in Web Application, select the Web application that you created for the SSP, and do not modify any of the default settings in this section.
  15. In the My Site Location section, do not modify any of the default settings.
  16. In the SSP Service Credentials section, in User name and Password, type the user name and password for the user account under which you want the SSP to run. The user account does not have to be a member of any particular security group. It is recommended that you use the principle of least privilege and select a unique user account that does not have administrative rights on your front-end servers or on your back-end database servers. You can use the user account that you specified as the Office SharePoint Server 2007 service account; however, if that user account is a member of a security group that has administrative rights on your front-end servers or your back-end database servers, you will not be following the principle of least privilege. The user name must be in the format DOMAIN\username.
  17. In the SSP Database section, you can either accept the default settings (recommended), or specify your own settings for the database server, the database name, or the SQL authentication credentials.
  18. In the Search Database section, you can either accept the default settings (recommended), or specify your own settings for the search database server, the database name, or the SQL Server authentication credentials.
  19. In the Index Server section, in Index Server, click the server on which you configured the Search service.  Note: If there is no index server listed in the Index Server section, then no server in your farm has been assigned the index server role. To assign the index server role to a server in your farm, follow the instructions in the "Configure the Search service" section earlier in this topic.
  20. In the SSL for Web Services section, click No.
  21. Click OK. Upon successful creation of the SSP, the Success page appears.
  22. On the Success page, click OK to return to the Manage this Farm's Core Services page.
Configure indexing settings
  1. On the SharePoint Central Administration home page, click the Application Management tab on the navigation bar.
  2. On the Application Management page, in the Office SharePoint Server Shared Services section, click Create or configure this farm's shared services.
  3. On the Manage this Farm's Shared Services page, click SharedServices1.
  4. On the Shared Services Administration page, in Search, click Search Settings.
  5. On the Configure Search Settings page, in the Crawl Settings section, click Default content access account.
  6. In the Default content access account section, in Account, Password, and Confirm Password, type the user name and password for the user account that you want to use to crawl content on your sites. This account must be a domain user account. It is recommended that you use the principle of least privilege and select a unique user account that cannot modify content and does not have administrative rights on your front-end servers or on your back-end database servers. You can use the user account that you specified as the Office SharePoint Server 2007 service account; however, if that user account is a member of a security group that has administrative rights on your front-end servers or your back-end database servers, you will not be following the principle of least privilege. The user account that you specify will be added to the Web application Full Read policy for your farm. The user name must be in the format DOMAIN\username.
  7. Click OK.
  8. In the Crawl Settings section, click Content sources.
  9. On the Manage Content Sources page, click Local Office SharePoint Server sites.
  10. On the Edit Content Source page, in the Crawl Schedules section, under Full Crawl, click Create schedule.
  11. In the Manage Schedules dialog box, configure schedule settings for full crawls of your content, and then click OK.
  12. In the Crawl Schedules section, under Incremental Crawl, click Create schedule.
  13. In the Manage Schedules dialog box, configure schedule settings for incremental crawls of your content, and then click OK.
  14. In the Start Full Crawl section, select the Start full crawl of this content source check box, and then click OK.


You are done!

 

More Info in this fantastic article.

 

 

 

 


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 10/8/08

The following procedures step you through the process of configuring Office SharePoint Server 2007 search services, creating a Web application for the SSP, creating the SSP, and configuring indexing settings.

 

Start and configure the Search service

  1. On the SharePoint Central Administration home page, click the Operations tab on the top navigation bar.
  2. On the Operations page, in Topology and Services, click Servers in farm.
  3. On the Servers in Farm page, click the server on which you want to configure the search service.
  4. Click Start next to Office SharePoint Server Search.
  5. On the Office SharePoint Server Search Settings page, in the Query and Indexing section, make sure that the Use this server for indexing content and Use this server for serving search queries check boxes are selected.
  6. In the Default Catalog Location section, type a path to a physical folder to store the index files, or use the default location that is specified.
  7. In the Contact E-Mail Address section, specify a valid e-mail address.
  8. In the Service Account section, click Configurable, and in User name and Password, type the user name and password for the user account under which you want the Search service to run. The user account must be a member of the Administrators group on the computer that is running the Search service. If you want to use the principle of least privilege and select a unique user account that does not have administrative rights on your front-end servers or on your back-end database servers, see the Known Issues/Readme for Office SharePoint Server 2007 Beta 2. The user name must be in the format DOMAIN\username.
  9. In the Web Front End And Crawling section, do one of the following:
    • If you are configuring the search service on a server that provides Web services and renders Web content, click No dedicated Web front-end computer for crawling
    • If you are configuring the search service on a server that is a standalone search server that does not provide Web services and render Web content, click Use a dedicated web front end computer for crawling, and then, in Select a web front end computer, click the computer you want to use for crawling.
  10. Click Start.
Start the Windows SharePoint Services Web Application service

You must start the Windows SharePoint Services Web Application service on every computer that you want to act as a Web server and was set up using the Complete option during Setup. This service is started by default on servers that were set up using the Web Front End option. To enhance security, you can leave this service turned off on application servers that do not provide Web content to client computers. Also, you do not need to turn this service on to use SharePoint Central Administration on a server.

  1. On the SharePoint Central Administration home page, click the Operations tab on the top navigation bar.
  2. On the Operations page, in Topology and Services, click Servers in farm.
  3. On the Servers in Farm page, click the server on which you want to start the Windows SharePoint Services Web Application service.
  4. Click Start next to Window SharePoint Services Web Application.
Create the Shared Services Provider
  1. On the SharePoint Central Administration home page, click the Application Management tab on the top navigation bar.
  2. On the Application Management page, in the Office SharePoint Server Shared Services section, click Create or configure this farm's shared services.
  3. On the Manage this Farm's Shared Services page, click New SSPImportant: If you have not created a Web application for the SSP administration site, you need to create one before you create the SSP. If you have already created a Web application for the SSP administration site, skip to step 14.
  4. On the New Shared Services Provider page, click Create a new Web application.
  5. On the Create New Web Application page, in the IIS Web Site section, click Create a new IIS web site, and do not modify the default settings in this section.
  6. In the Security Configuration section, under Authentication provider, select the appropriate option for your environment, and do not modify the default settings in the remainder of this section.
  7. In the Load Balanced URL section, do not modify the default settings.
  8. In the Application Pool section, click Create new application pool.
  9. In Application pool name, enter the name of your application pool or use the default name.
  10. Click Configurable, and in User name and Password, type the user name and password for the user account under which you want the application pool to run. The user account does not have to be a member of any particular security group. It is recommended that you use the principle of least privilege and select a unique user account that does not have administrative rights on your front-end servers or on your back-end database servers. You can use the user account that you specified as the Office SharePoint Server 2007 service account; however, if that user account is a member of a security group that has administrative rights on your front-end servers or your back-end database servers, you will not be following the principle of least privilege. The user name must be in the format DOMAIN\username.
  11. In the Database Name and Authentication section, verify the database information and make sure that Windows Authentication (recommended)is selected.
  12. In the Search Server section, do not modify the default settings.
  13. Click OK. Upon successful creation of the Web application, the New Shared Services Provider page appears.
  14. In the SSP Name section, in Web Application, select the Web application that you created for the SSP, and do not modify any of the default settings in this section.
  15. In the My Site Location section, do not modify any of the default settings.
  16. In the SSP Service Credentials section, in User name and Password, type the user name and password for the user account under which you want the SSP to run. The user account does not have to be a member of any particular security group. It is recommended that you use the principle of least privilege and select a unique user account that does not have administrative rights on your front-end servers or on your back-end database servers. You can use the user account that you specified as the Office SharePoint Server 2007 service account; however, if that user account is a member of a security group that has administrative rights on your front-end servers or your back-end database servers, you will not be following the principle of least privilege. The user name must be in the format DOMAIN\username.
  17. In the SSP Database section, you can either accept the default settings (recommended), or specify your own settings for the database server, the database name, or the SQL authentication credentials.
  18. In the Search Database section, you can either accept the default settings (recommended), or specify your own settings for the search database server, the database name, or the SQL Server authentication credentials.
  19. In the Index Server section, in Index Server, click the server on which you configured the Search service.  Note: If there is no index server listed in the Index Server section, then no server in your farm has been assigned the index server role. To assign the index server role to a server in your farm, follow the instructions in the "Configure the Search service" section earlier in this topic.
  20. In the SSL for Web Services section, click No.
  21. Click OK. Upon successful creation of the SSP, the Success page appears.
  22. On the Success page, click OK to return to the Manage this Farm's Core Services page.
Configure indexing settings
  1. On the SharePoint Central Administration home page, click the Application Management tab on the navigation bar.
  2. On the Application Management page, in the Office SharePoint Server Shared Services section, click Create or configure this farm's shared services.
  3. On the Manage this Farm's Shared Services page, click SharedServices1.
  4. On the Shared Services Administration page, in Search, click Search Settings.
  5. On the Configure Search Settings page, in the Crawl Settings section, click Default content access account.
  6. In the Default content access account section, in Account, Password, and Confirm Password, type the user name and password for the user account that you want to use to crawl content on your sites. This account must be a domain user account. It is recommended that you use the principle of least privilege and select a unique user account that cannot modify content and does not have administrative rights on your front-end servers or on your back-end database servers. You can use the user account that you specified as the Office SharePoint Server 2007 service account; however, if that user account is a member of a security group that has administrative rights on your front-end servers or your back-end database servers, you will not be following the principle of least privilege. The user account that you specify will be added to the Web application Full Read policy for your farm. The user name must be in the format DOMAIN\username.
  7. Click OK.
  8. In the Crawl Settings section, click Content sources.
  9. On the Manage Content Sources page, click Local Office SharePoint Server sites.
  10. On the Edit Content Source page, in the Crawl Schedules section, under Full Crawl, click Create schedule.
  11. In the Manage Schedules dialog box, configure schedule settings for full crawls of your content, and then click OK.
  12. In the Crawl Schedules section, under Incremental Crawl, click Create schedule.
  13. In the Manage Schedules dialog box, configure schedule settings for incremental crawls of your content, and then click OK.
  14. In the Start Full Crawl section, select the Start full crawl of this content source check box, and then click OK.


You are done!

 

More Info in this fantastic article.

 

 

 

 


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 3/31/09

In a SharePoint enviroment, the proper way to execute client side code when the page/body is loaded is to use the following function...

  

_spBodyOnLoadFunctionNames.push("myBodyLoadedFunctionName");


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 6/4/09

This post documents the "Manage Event Handlers" (MEH) project from Codeplex.  The MEH tool allows you rapid deployment of event handlers.  Additionally you can assign the handler to any Site, List, or Content Type.  Note: this works for WSS 3.0 and MOSS 2007.

The .wsp file is located here:

http://www.codeplex.com/SPSCustomAdmin/Release/ProjectReleases.aspx?ReleaseId=3024

To install the MEH tool from command line:

stsadm -o addsolution -filename MOSS.CustomAdminPages.EventHandlers.Deploy.wsp

stsadm -o execadmsvcjobs

stsadm -o deploysolution -name MOSS.CustomAdminPages.EventHandlers.Deploy.wsp -local -force -allowGacDeployment -allowCasPolicies 

stsadm -o execadmsvcjobs

stsadm -o activatefeature -name ManageEventHandlers -url http://foobar.com

stsadm -o execadmsvcjobs 

 

Now you should see your MEH tool in the Site Setting Page:


 
 
  
 
Now build the event handler as you normally would and drop the compiled dll in the GAC.  
 
After the assembly is in the GAC, you can now add it to your SharePoint site and assign it to a Site, List, or Content Type using the "Add" page of the MEH tool:
 
 

 

You can assign the same event handler to many different Site, Lists, or Content types.  You need only click "Add" and set the properties!! 

Awesome! 

Show the AfterProperties snippet:

protected void showAfterProperties(SPItemEventProperties properties)

        { 

            using (SPWeb web = properties.OpenWeb())

            {

                String strTemp = "";  

                /*get the current list*/

                SPList list = web.Lists[properties.ListId];

                string columnName = "";

                foreach (SPField fld in list.Fields)

                {

                    columnName = fld.InternalName;


                    if (properties.AfterProperties[columnName] != null)

                        strTemp += "\n" + columnName + ": " + properties.AfterProperties[columnName].ToString();

                }

                properties.ErrorMessage += strTemp;

                properties.Cancel = true;

            }

        } 

 

Additional Notes:

http://jpy-tech.com/post/2009/02/05/Sharepoint-Unique-Column-(PK)-Using-event-handler.aspx 

http://www.sharepointblogs.com/toth/archive/2008/06/06/workarounds-for-itemadding-itemadded-event-handlers.aspx

http://www.iterasi.net/openviewer.aspx?sqrlitid=-lt435um10as0obb4eq48q

 


by mysharepointblog.nospam@nospam.kevincornwell.com (Kevin) on 12/29/09

Add this line to your td cell.... 

<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

And the xslt parser will insert a blank space in the TD fixing the border for that column.