SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to Get the RecordCenterURL from Sharepoint2010,

  1. I have created Connection to Connect RecordCenter or DocumentRepository. I used this LINK

  2. When I try to Retrieve the OfficialFileUrl from Application, Its always return NULL value.

I have used this sample Code , Please help me for this Issue.

 string URL = "http://inblr-iifw8sv03:31521";

                SPSite site = new SPSite(URL);
                string recordCenterUrl = string.Empty;

                if (site.WebApplication.OfficialFileUrl != null)// This is Always NULL
                    recordCenterUrl = site.WebApplication.OfficialFileUrl.ToString().
                        Replace("_vti_bin/officialfile.asmx", string.Empty);

                Console.WriteLine("URL Found " + recordCenterUrl);
share|improve this question

To get an official file host you need to use


This contains an array of filehost. You can easy use powershell to create get and manipulate these hosts

For example to get an official host you can user this function

Function Get-SPOfficialFileHost{
    [Parameter(Mandatory=$true,ValueFromPipeline=$true, Position=0)][Microsoft.SharePoint.PowerShell.SPWebApplicationPipeBind] $WebApplication,
    [Parameter(Mandatory=$true)] [string] $Name

    $WebApp = $WebApplication.Read()
    $officialFileHost =  $webapp.OfficialFileHosts | ? { $_.OfficialFileName -eq $Name }
    return $officialFileHost

or Create

Function New-SPOfficialFileHost{
    [Parameter(Mandatory=$true,ValueFromPipeline=$true, Position=0)][Microsoft.SharePoint.PowerShell.SPWebApplicationPipeBind] $WebApplication,
    [Parameter(Mandatory=$true)] [string] $Name,
    [Parameter(Mandatory=$true)] [string] $Url,
    [Parameter(Mandatory=$true)] [string] $Action,
    [Parameter(Mandatory=$true)] [string] $Explanation,    
    [Parameter(Mandatory=$true)] [switch] $ShowOnSendToMenu

    $WebApp = $WebApplication.Read()

    $officialFileHost = Get-SPOfficialFileHost -WebApplication $WebApplication -Name $Name

    if ($officialFileHost -eq $null) {
        Write-Host "Add new Send To Connections..." -NoNewline
        [Microsoft.SharePoint.SPOfficialFileHost] $officialFileHost = New-Object "Microsoft.SharePoint.SPOfficialFileHost"
        $officialFileHost.Action = [Enum]::Parse([Microsoft.SharePoint.SPOfficialFileAction], $Action)
        $officialFileHost.Explanation = $Explanation
        $officialFileHost.OfficialFileName = $Name
        $officialFileHost.OfficialFileUrl = $Url.TrimEnd("/") + "/_vti_bin/officialfile.asmx" 
        $officialFileHost.ShowOnSendToMenu = [bool]::Parse($true)
        Write-Host -ForegroundColor Green " - Done."   
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.