How to use MS Multiple File Upload ActiveX control to upload multiple files to a document library

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=12.0.0.0, 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" 
       HREF="/_layouts/1033/styles/ows.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()
    {
        document.all.idUploadCtl.SetTreeViewColor("#FF0000");
        document.all("idMultipleView").style.display="inline";
    }
    
    function DocumentUpload()
    {
        document.all.idUploadCtl.MultipleUpload();
    }
    </SCRIPT>
  4. Add a form within the BODY section of the .aspx page:

    <FORM NAME="frmUpload" METHOD="post"
       ACTION="WebForm1.aspx?RootFolder=&amp; Source=
          http%3A%2F%2FServer_Name%2FShared%2520Documents
          %2FForms%2FAllItems%2Easpx">
  5. To upload documents and thereby modify data within a SharePoint site, you must include a FormDigest server control in the form:

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

    <INPUT TYPE="hidden" NAME="Cmd" VALUE="Save">
    <INPUT TYPE="hidden" NAME="NextUsing"
       VALUE="http://Server_Name/
           Shared%20Documents/Forms/AllItems.aspx">
    <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"
       VALUE="http://Server_Name/Shared%20Documents/
          Forms/AllItems.aspx">
    <INPUT TYPE="hidden" NAME="PostURL"
       VALUE="http%3a%2f%2fServer_Name/_vti_bin/
          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>
    </P>
    <DIV ID=idMultipleView style='display:none'>
    <P CLASS="ms-toolbar">
       <A HREF="javascript:DocumentUpload()"
          TARGET="_self">Save and Close</A>
    </P>
    
    
    </DIV>
    </FORM>
    

Approaches of using SharePoint 2007 with multiple forests

1.     Trusted Domains

By default, Office SharePoint Server 2007 can be configured to connect to the directory services in the current domain or forest and import directory service information from those sources. To add connections to multiple forests, you select the custom option and then configure a connection for each forest with directory information that you want to import. This enables you to import user profiles for users across multiple forests, and target and personalize content to any or all of those users.

Import connections to forests might become unnecessary over time, either because users are consolidated into fewer forests, or because there is no longer a business need to connect to certain users. Connections across forests can be removed the same way any import connections are removed

The following steps describe how to configure the People Picker so that people from multiple forests are included:

  • All domains and forests with a two-way trust relationship are available without any additional configuration steps.
  • If the domain for the farm has a one-way trust relationship with one or more other forests or domains, you can configure access to the other domains and forests by using the stsadm command-line tool and selecting an account to use when accessing each forest or domain. You can use a different account for each target domain or forest, or the same account for all domains and forests. If all forests are trusted from the current forest or domain, and the application pool identity account for the current Web application has access to all target forests, no further configuration steps are necessary.
  • The account and password used to access each domain or forest is stored on each front-end Web server in the farm. You must configure an encryption string to use when encrypting the password for each account. This encryption string must be the same for all servers in the farm, and unique for each server farm in a deployment with multiple farms.

Alternatively, you can configure the forests so that the application pool has access to each forest, and establish a two-way trust relationship between the current forest and domain and each of the target forests. However, because this is not possible in every scenario, it is often necessary to use the Stsadm command-line tool.

 2.     Custom Membership Provider

 The second approach is to develop custom membership (authentication) provider that will work with multiple-forests. The disadvantage of this approach is performance as it will require some time to authenticate user from multiple forests and domains.

 3.     ILM with SQL membership provider

 ILM can also be used to propagate user information to SQL-based membership provider database which can easily be configured as MOSS authentication provider. This will be faster approach as compared to previous approach.