If you want to send a file to a Records Center, whether it's a sub site or a seperate site collection, you can use the following code:
string additionalInformation = string.Empty;
SPOfficialFileHost ofh = new SPOfficialFileHost();
ofh.Action = SPOfficialFileAction.Move;
ofh.OfficialFileName = item.File.Name;
ofh.OfficialFileUrl = new Uri("http://yourserver/sites/RecordsCenter");
OfficialFileResult returnValue = item.File.SendToOfficialFile("Content-type", ofh, "", SPOfficialFileSubmissionMode.ExpirationPolicy, out additionalInformation);
if (returnValue != OfficialFileResult.Success)
{
throw new Exception("Error sending file to records center: " + additionalInformation);
}
No comments:
Post a Comment