This is the way we define a connection to a site where we would like to drop our documents.
Now in my case there could be hundreds of target sites created by code as and when required.
For each site created I want to write few lines of code which will do exactly what /_admin/OfficialFileAdmin.aspx page does.
So i want code for what /_admin/OfficialFileAdmin.aspx ( Central Administration>General Application Settings>External Service Connections >Configure Send To Connections) does.
just try out like:
SPWebApplication app = SPWebApplication.Lookup(new Uri("http://hemant1236"));
SPOfficialFileHost host = new SPOfficialFileHost(true);
host.OfficialFileUrl = new Uri("http://hemant1236/testsite1/_vti_bin/officialfile.asmx");
host.OfficialFileName = "hemant1236Test1saurabh";
host.ShowOnSendToMenu = true;
host.Action = SPOfficialFileAction.Move;
host.Explanation = "created at Time" + DateTime.Now.ToString() + " by custom utility.";