Export (0) Print
Expand All

DataConnectionFile Class

Represents a Universal Data Connection (UDC) file located in the central data connection store on a server farm.

Namespace:  Microsoft.Office.InfoPath.Server.Administration
Assembly:  Microsoft.Office.InfoPath.Server (in Microsoft.Office.InfoPath.Server.dll)

[GuidAttribute("09E0DD52-6224-4ccd-9017-74C9FC061282")]
public sealed class DataConnectionFile : SPPersistedObject, 
	IBackupRestoreConfiguration, IBackupRestore

The UDC files that are available on the server farm are listed on the Manage Data Connection Files page of the Central Administration site. A version 2 UDC file with the *.udcx file extension is designed for use by browser-enabled form templates that render in the browser or open in the InfoPath editor. Form templates that are not browser-enabled can also use UDC connection files.

In the following example, the DataConnectionFileCollection collection is used to loop through every UDC file on the server farm and write its display name to the console. Then the total number of UDC files on the server is written to the console.

    FormsService localFormsService;
    SPFarm localFarm = SPFarm.Local;
    int countUdcs = 0;
    try
    {
        localFormsService = localFarm.Services.GetValue<FormsService>(FormsService.ServiceName);
        DataConnectionFileCollection udcCollection = localFormsService.DataConnectionFiles;
        string[] enumUdc = udcCollection.Enumerate("All");
        foreach(DataConnectionFile udcConnection in udcCollection)
        {
            countUdcs++;
            Console.WriteLine("UDC file # " + countUdcs.ToString() + ": " + udcConnection.DisplayName.ToString());
        }
        Console.WriteLine("Total UDC files on server: " + countUdcs.ToString());
        Console.Write("Press Enter to Continue");
        Console.ReadLine();
    }
    catch (Exception ex)
    {
        Console.WriteLine("Error: " + ex.Message);
        Console.Write("Press Enter to Continue");
        Console.ReadLine();
    }

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft