Monday, 2 July 2012

Programmatically Create a ‘Send To’ Connection to Send Documents to The Records Center in SharePoint 2010

If you have multiple send to connections to create or prefer to automate the deployment tasks related to your SharePoint environment, the following bit of code will help you create them automatically using the SPOfficialFileHost collection of your current site’s web application:

using (SPSite site = new SPSite(http://sp/))
    SPWebApplication webapp = site.WebApplication;
    SPOfficialFileHost newhost = new SPOfficialFileHost(true);
    newhost.OfficialFileUrl = new Uri(site.Url+"/records/_vti_bin/officialfile.asmx");
    newhost.OfficialFileName = "Records Center";
    newhost.ShowOnSendToMenu = true;
    newhost.Action = SPOfficialFileAction.Move;

The options for the action are the following:
1.       You can move the document from one location to another
2.       You can create a copy of the document and send it to another location
3.       Or you can move the document but leave a link of its new location in its former location

1 comment:

  1. I have a custom button in the ribbon "Send To Record Center" . I would like to click on several documents in the doc library and would like to be able to move it to the Record Center. I am currently using the "Send to" but can only move one file at a time.