UploadCtl.SetTreeViewColor Method

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Sets the background color of the tree view used to display the local folders from which to select documents for uploading.




An expression that returns an UploadCtl Control object.


A hexadecimal string value of the form #aabbcc representing the color.


The following example steps through the process of adding an UploadCtl control to an .aspx page for uploading multiple documents to the Shared Documents folder of a specified site. The example adds a hidden UploadCtl control within the page that is displayed when a link is clicked.

The .aspx file, in this example WebForm1.aspx, must be located in the Local_Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS directory, and is opened through the URL http://Server_Name/_layouts/WebForm1.aspx.

  1. Add a page directive that registers the Microsoft.SharePoint.WebControls namespace:

    <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=, Culture=neutral,
    PublicKeyToken=71e9bce111e9429c" %>
  2. Add a LINK element in the HEAD section to apply Windows SharePoint Services styles that are defined in ows.css:

    <LINK REL="stylesheet" TYPE="text/css" 
  3. Add a script block to the HEAD section that includes two methods. One method sets the background color for the tree view and displays the UploadCtl on the page. The other method uploads documents that are selected in the control.

    <SCRIPT LANGUAGE="javascript">
    function MultipleUploadView()
    function DocumentUpload()
  4. Add a form within the BODY section of the .aspx page:

    <FORM NAME="frmUpload" METHOD="post"
       ACTION="WebForm1.aspx?RootFolder=&amp; Source=
  5. To upload documents and thereby modify data within a SharePoint site, you must include a FormDigest server control in the form:

    <SharePoint:FormDigest  />
  6. Include INPUT elements that specify the required parameters of the post:

    <INPUT TYPE="hidden" NAME="Cmd" VALUE="Save">
    <INPUT TYPE="hidden" NAME="NextUsing"
    <INPUT TYPE="hidden" VALUE="New">
    <INPUT TYPE="hidden" NAME="putopts" VALUE="true">
    <INPUT TYPE="hidden" NAME="destination"
       VALUE="http://Server_Name/Shared Documents">
    <INPUT TYPE="hidden" NAME="Confirmation-URL"
    <INPUT TYPE="hidden" NAME="PostURL"
          shtml.dll/_layouts%2fWebForm1%2easpx" />
    <INPUT TYPE="hidden" NAME="VTI-GROUP" VALUE="0">
  7. To complete the form, add a link for calling the MultipleUploadView method and displaying the contents of a DIV section, which includes the <OBJECT> tag that creates the control on the page:

    <P CLASS="ms-toolbar">
       <A HREF="javascript:MultipleUploadView()"
          TARGET="_self">Upload Multiple Files</A>
    <DIV ID=idMultipleView style='display:none'>
    <P CLASS="ms-toolbar">
       <A HREF="javascript:DocumentUpload()"
          TARGET="_self">Save and Close</A>
    <OBJECT id=idUploadCtl name=idUploadCtl
          WIDTH='100%' HEIGHT='350px'>