通用数据连接 v2.0 引用和架构

上次修改时间: 2015年3月9日

适用范围: SharePoint Server 2010

本文内容
UDC v2.0 示例
UDC v2.0 架构引用
连接类型所需的属性
UDC v2.0 架构

自 Web 部件使用 Office 2003 存储数据连接信息以来,从 FrontPage 开始就采用了通用数据连接 (UDC) 文件格式。Office 2003:XML 引用架构(该链接可能指向英文页面)中介绍了 UDC v1 文件格式。

与其他 Office 应用程序使用的、用于存储数据库连接信息的 UDC 格式不同,这些 UDC 文件可以存储几种不同类型的数据连接信息,并可以扩展为存储任意类型的信息。

Office 2010 应用程序使用了两种版本的 UDC 文件格式。InfoPath 使用此文档中介绍的 v2.0 格式。

UDC v2.0 示例

下面的 UDC v2.0 示例演示 UDC 文件的基本结构与以前版本的类似之处。

<?MicrosoftWindowsSharePointServices ContentTypeID=”0x010100B4CBD48E029A4ad8B62CB0E41868F2B0”?>
<udc:DataSource MajorVersion="2" MinorVersion="0" xmlns:udc="https://schemas.microsoft.com/office/infopath/2006/udc">
    <udc:Name>Submit to HTTP</udc:Name>
    <udc:Description>This UDC file describes an HTTP Submit connection for InfoPath</udc:Description>
    <udc:Type MajorVersion="2" MinorVersion="0" Type="XmlSubmit"/>
    <udc:ConnectionInfo Purpose="WriteOnly">
        <udc:UpdateCommand>
          <udc:Submit>http://www.example.com/postTarget.aspx</udc:Submit>
        </udc:UpdateCommand>
        <udc:Authentication />
    </udc:ConnectionInfo>
</udc:DataSource>

UDC v2.0 架构引用

全局属性

文件扩展名: *.udcx 或 *.xml

**XML 命名空间:**https://schemas.microsoft.com/office/infopath/2006/udc

**内容类型 ID:**0x010100B4CBD48E029A4ad8B62CB0E41868F2B0

处理指令

名称

类型

说明

MicrosoftWindowsSharePointServices

处理指令

MicrosoftWindowsSharePointServices/@ContentTypeID

属性

必须是 0x010100B4CBD48E029A4ad8B62CB0E41868F2B0

DataSource 元素

<udc:DataSource MajorVersion="2" MinorVersion="0" xmlns:udc="https://schemas.microsoft.com/office/infopath/2006/udc">
    <udc:Name/>
    <udc:Description/>
    <udc:Type MajorVersion="2" MinorVersion="0" Type=""/>
<udc:ConnectionInfo/>
</udc:DataSource>

名称

类型

说明

DataSource

元素

Container 元素

DataSource/@MajorVersion

属性

必须是 2

DataSource/@MinorVersion

属性

必须是 0

Name

元素

UDC 文件的显示名称

Description

元素

UDC 文件的说明

Type

元素

连接类型

Type/@MajorVersion

属性

可选:如果使用,应为 2

Type/@MinorVersion

属性

可选:如果使用,应为 0

Type/@Type

属性

数据连接的类型。为以下值之一:

SharePointList

SharePointLibrary

Database

XmlQuery

XmlSubmit

WebService

ConnectionInfo

元素

连接特定信息

ConnectionInfo 元素

<udc:ConnectionInfo Purpose="WriteOnly">
    <udc:WsdlUrl/>
    <udc:SelectCommand/>
    <udc:UpdateCommand/>
    <udc:Authentication/>
</udc:ConnectionInfo>

名称

类型

说明

ConnectionInfo

元素

Container 元素

ConnectionInfo/@Purpose

属性

确定连接是用于查询还是提交。

可能的值:

  • ReadOnly

  • WriteOnly

  • ReadWrite

WsdlUrl

元素

指向 Web 服务的 WSDL 的完全限定 URL

SelectCommand

元素

查询连接的详细信息

UpdateCommand

元素

提交连接的详细信息

Authentication

元素

特定于服务器的身份验证信息

SelectCommand 元素

<udc:SelectCommand>
<udc:ListId/>
    <udc:WebUrl/>
    <udc:ConnectionString/>
    <udc:OperationName/>
    <udc:ServiceUrl UseFormsServiceProxy=""/>
    <udc:SoapAction/>
<udc:Query/>
</udc:SelectCommand>

名称

类型

说明

SelectCommand

元素

Container 元素

ListId

元素

SharePoint 列表连接的 GUID

WebUrl

元素

包含 SharePoint 列表的网站的 URL

ConnectionString

元素

数据库连接字符串

ServiceUrl

元素

Web 服务 URL

ServiceUrl/@UseFormsServiceProxy

属性

确定 Web 服务连接是否应使用表单服务代理

SoapAction

元素

Web 服务 SoapAction

Query

元素

由多个连接类型使用的特定查询或 URL

UpdateCommand 元素

<udc:UpdateCommand>
<udc:OperationName/>
    <udc:ServiceUrl/>
    <udc:SoapAction/>
    <udc:Submit/>
    <udc:FileName/>
<udc:FolderName AllowOverwrite="1"/>
</udc:UpdateCommand>

名称

类型

说明

UpdateCommand

元素

Container 元素。

OperationName

元素

Web 服务操作名称。

ServiceUrl

元素

Web 服务 URL。

ServiceUrl/@UseFormsServiceProxy

属性

确定 Web 服务连接是否应使用表单服务代理。

SoapAction

元素

Web 服务 SoapAction。

Submit

元素

由多个连接类型使用的特定查询或 URL。

FileName

元素

备注

已弃用。忽略此值,且应保留为空白。

FolderName

元素

要提交的 SharePoint 库的 URL。

FolderName/@AllowOverwrite

属性

确定是否覆盖 SharePoint 库中已存在的文件。

Authentication 元素

<udc:Authentication>
    <udc:UseExplicit CredentialType="">
        <udc:UserId/>
        <udc:Password/>
    </udc:UseExplicit>
    <udc:SSO AppId="" CredentialType=""/>
</udc:Authentication>

名称

类型

说明

Authentication

元素

Container 元素。

UseExplicit

元素

包含服务器上用于身份验证的纯文本用户名和密码。

UseExplicit/@CredentialType

属性

介绍如何使用所包含的凭据。

可能的值:

  • Sql

  • NTLM

  • Kerberos

  • CD

  • Basic

  • Digest

UserId

元素

要用于身份验证的 UserID。

Password

元素

用于身份验证的纯文本密码。

SSO

元素

指定要用于身份验证的 Office 单一登录应用程序定义。

SSO/@AppId

属性

来自 SSO 的应用程序名称。

SSO/@CredentialType

属性

介绍如何使用所包含的凭据。

可能的值:

  • Sql

  • NTLM

  • Kerberos

  • CD

  • Basic

  • Digest

CredentialType 值

说明

Sql

凭据将嵌入数据库连接字符串以对 SQL Server 进行身份验证。

NTLM

凭据将用于模拟 Windows 用户。

Kerberos

凭据将用于模拟使用 Kerberos 的 Windows 用户。

CD

用户名将用于模拟使用约束委派的 Windows 用户。

Basic

凭据将用于执行 HTTP 基本身份验证。

Digest

凭据将用于执行 HTTP 摘要式身份验证。

连接类型所需的属性

Web 服务

属性

DataSource/type/@type

WebService

ConnectionInfo/@Purpose

ReadOnly

SelectCommand 元素包含 Web 服务查询设置。

WriteOnly

UpdateCommand 元素包含 Web 服务提交设置。

ReadWrite

SelectCommand 和 UpdateCommand 都存在。

ConnectionInfo/WsdlUrl

指向 Web 服务的 WSDL 的完全限定 URL

ServiceUrl

Web 服务 URL

ServiceUrl/@UseFormsServiceProxy

确定 Web 服务连接是否应使用表单服务代理

SoapAction

Web 服务 SoapAction

数据库

属性

DataSource/type/@type

数据库

ConnectionInfo/@Purpose

ReadOnly

InfoPath 在设计时确定数据库连接是否可以支持提交。

SelectCommand/ConnectionString

数据库连接字符串

SelectCommand/Query

要执行的 SQL 查询

SharePoint 列表

属性

DataSource/type/@type

SharePointList

ConnectionInfo/@Purpose

ReadOnly

ListId

SharePoint 列表的 GUID

WebUrl

列表所包含网站的 URL

SharePoint 库提交

属性

DataSource/type/@type

SharePointLibrary

ConnectionInfo/@Purpose

WriteOnly

FileName

备注

已弃用。忽略此值,且应保留为空白。

FolderName

要提交的 SharePoint 库的 URL。

FolderName/@AllowOverwrite

确定是否覆盖 SharePoint 库中已存在的文件。

HTTP Post

属性

DataSource/type/@type

XmlSubmit

ConnectionInfo/@Purpose

WriteOnly

UpdateCommand/Submit

指定发布目标的 URL。

XML 文件

属性

DataSource/type/@type

XmlQuery

ConnectionInfo/@Purpose

ReadOnly

SelectCommand/Query

要查询的 XML 源的 URL。

UDC v2.0 架构

复制下面的 XML 架构并将其粘贴到文本编辑器(例如记事本)中,然后另存为 UDC20.xsd 以便使用该架构生成、引用 UDC 文件并对其进行自定义验证。在 Visual Studio 2005 中,如果将该架构复制到通常位于 <驱动器>:\Program Files\Microsoft Visual Studio 8\Xml\Schemas 中的 Visual Studio 架构缓存,则该架构可提供 Intellisense 自动完成功能。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema targetNamespace="https://schemas.microsoft.com/office/infopath/2006/udc" xmlns:udc="https://schemas.microsoft.com/office/infopath/2006/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="DataSource">
        <xsd:complexType>
            <xsd:all>
                <xsd:element ref="udc:Name" minOccurs="0" />
                <xsd:element ref="udc:Description" minOccurs="0"/>
                <xsd:element ref="udc:Type" minOccurs="0"/>
                <xsd:element ref="udc:ConnectionInfo" minOccurs="0"/>
            </xsd:all>
            <xsd:attribute name="MajorVersion" type="xsd:integer"/>
            <xsd:attribute name="MinorVersion" type="xsd:integer" />
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="Description" type="xsd:string"/>
    <xsd:element name="Type">
        <xsd:complexType>
            <xsd:attribute name="MajorVersion" type="xsd:integer"/>
            <xsd:attribute name="MinorVersion" type="xsd:integer"/>
            <xsd:attribute name="Type" type="xsd:string"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="ConnectionInfo">
        <xsd:complexType>
            <xsd:all>
                <xsd:element ref="udc:WsdlUrl" minOccurs="0"/>
                <xsd:element ref="udc:SelectCommand" minOccurs="0"/>
                <xsd:element ref="udc:UpdateCommand" minOccurs="0"/>
                <xsd:element ref="udc:Authentication" minOccurs="0"/>
            </xsd:all>
            <xsd:attribute name="Purpose" type="xsd:string"/>
            <xsd:attribute name="AltDataSource" type="xsd:string"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="WsdlUrl" type="xsd:string"/>
    <xsd:element name="FileName" type="xsd:string"/>
    <xsd:element name="FolderName">
        <xsd:complexType>
            <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                    <xsd:attribute name="AllowOverwrite" type="xsd:boolean"/>
                </xsd:extension>
            </xsd:simpleContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="SelectCommand">
        <xsd:complexType>
            <xsd:all>
                <xsd:element ref="udc:ListId" minOccurs="0"/>
                <xsd:element ref="udc:WebUrl" minOccurs="0"/>
                <xsd:element ref="udc:ConnectionString" minOccurs="0"/>
                <xsd:element ref="udc:ServiceUrl" minOccurs="0"/>
                <xsd:element ref="udc:SoapAction" minOccurs="0"/>
                <xsd:element ref="udc:Query" minOccurs="0"/>
            </xsd:all>
            <xsd:attribute name="Type" type="xsd:string"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="ListId" type="xsd:string"/>
    <xsd:element name="WebUrl" type="xsd:string"/>
    <xsd:element name="ConnectionString" type="xsd:string"/>
    <xsd:element name="ServiceUrl">
        <xsd:complexType>
            <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                    <xsd:attribute name="UseFormsServiceProxy" type="xsd:boolean"/>
                </xsd:extension>
            </xsd:simpleContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="SoapAction" type="xsd:string"/>
    <xsd:element name="Query" type="xsd:string"/>
    <xsd:element name="Submit" type="xsd:string"/>
    <xsd:element name="UpdateCommand">
        <xsd:complexType>
            <xsd:all>
                <xsd:element ref="udc:ServiceUrl" minOccurs="0"/>
                <xsd:element ref="udc:SoapAction" minOccurs="0"/>
                <xsd:element ref="udc:Submit" minOccurs="0"/>
                <xsd:element ref="udc:FileName" minOccurs="0"/>
                <xsd:element ref="udc:FolderName" minOccurs="0"/>
            </xsd:all>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="Authentication">
        <xsd:complexType>
            <xsd:all>
                <xsd:element ref="udc:UseExplicit" minOccurs="0"/>
                <xsd:element ref="udc:SSO" minOccurs="0"/>
            </xsd:all>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="UseExplicit">
        <xsd:complexType>
            <xsd:all>
                <xsd:element ref="udc:UserId" minOccurs="0"/>
                <xsd:element ref="udc:Password" minOccurs="0"/>
            </xsd:all>
            <xsd:attribute name="CredentialType" type="xsd:string"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="UserId" type="xsd:string"/>
    <xsd:element name="Password" type="xsd:string"/>
    <xsd:element name="SSO">
        <xsd:complexType>
            <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                    <xsd:attribute name="AppId" type="xsd:string"/>
                    <xsd:attribute name="CredentialType" type="xsd:string"/>
                </xsd:extension>
            </xsd:simpleContent>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

请参阅

概念

如何:创建和使用数据连接库

关于数据连接、身份验证和备用访问映射