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;
webapp.OfficialFileHosts.Add(newhost);
webapp.Update();
}
The
options for the action are the following:
1.
You can move the document from one location to another
SPOfficialFileAction.Move;
SPOfficialFileAction.Move;
2.
You can create a copy of the document and send it to another
location
SPOfficialFileAction.Copy;
SPOfficialFileAction.Copy;
3.
Or you can move the document but leave a link of its new location
in its former location
SPOfficialFileAction.Link;
SPOfficialFileAction.Link;
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.
ReplyDeleteThanks