Compartilhar via


Sample BDC Model: Connecting to a Custom File System Connector

Applies to: SharePoint Server 2010

The following example shows how to use a set of LobSystem and LobSystemInstance properties to configure connection to a custom file system connector. For an example of a file system connector, see Code Snippet: Implementing a Custom Connector. Steps to use this model are provided in that topic.

Example

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="https://schemas.microsoft.com/windows/2007/BusinessDataCatalog BDCMetadata.xsd"
       xmlns="https://schemas.microsoft.com/windows/2007/BusinessDataCatalog"
       Name="CustomShim_Model">
  <LobSystems>
    <LobSystem Name="FileSystemLOB" Type="Custom">
      <Properties>
        <Property Name="SystemUtilityTypeName" Type="System.String">MS.Internal.Motif.Office.Lobi.ShimTest.FileSystemShim, MS.Internal.Motif.Office.Lobi.ShimTest,Version=14.0.0.0,Culture=neutral,PublicKeyToken=48e046c834625a88</Property>
        <Property Name="SystemUtilityInstallDate" Type="System.DateTime">2009-08-25 00:00:00Z</Property>
      </Properties>
      <LobSystemInstances>
        <LobSystemInstance Name="TestFileSystemCustomShim">
        <Properties>
       <Property Name="ServerName" Type="System.String">localhost</Property>
       </Properties>
       </LobSystemInstance>
      </LobSystemInstances>
      <Entities>
        <Entity EstimatedInstanceCount="1000" Name="Files" Namespace="Namespace.FileSystem" Version="1.0.0.0">
          <Properties>
            <Property Name="Directory" Type="System.String">C:\TEMP</Property>
            <Property Name="OutlookItemType" Type="System.String">Contact</Property>
          </Properties>
          <Identifiers>
            <Identifier TypeName="System.String" Name="FileName"/>
          </Identifiers>
          <Methods>
            <!-- method to get single file -->
            <Method Name="ReadFile">
              <Parameters>
                <Parameter Direction="In" Name="FileName">
                  <TypeDescriptor TypeName="System.String" IdentifierName="FileName" Name="FileName" />
                </Parameter>
                <Parameter Direction="Return" Name="FileDetails">
                  <TypeDescriptor TypeName="Microsoft.BusinessData.Runtime.DynamicType"
                                  Name="FileDetails">
                    <TypeDescriptors>
                      <TypeDescriptor Name="FileName" TypeName="System.String" IdentifierName="FileName" ReadOnly="true">
 <Properties>
                          <Property Name="OfficeProperty" Type="System.String">LastName</Property>
                        </Properties>
                      </TypeDescriptor>
                      <TypeDescriptor Name="Attributes" TypeName="System.IO.FileAttributes, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                      <TypeDescriptor Name="Date Modified" TypeName="System.DateTime"/>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </Parameter>
              </Parameters>
              <MethodInstances>
                <MethodInstance Type="SpecificFinder"
                                ReturnParameterName="FileDetails"
                                ReturnTypeDescriptorName="FileDetails"
                                ReturnTypeDescriptorLevel="0"
                                Name="FileSystemFinder">
                  <AccessControlList>
                    <AccessControlEntry Principal="redmond\domain users">
                      <Right BdcRight="Execute"/>
                      <Right BdcRight="Edit"/>
                      <Right BdcRight="SetPermissions"/>
                      <Right BdcRight="SelectableInClients"/>
                    </AccessControlEntry>
                  </AccessControlList>
                </MethodInstance>
              </MethodInstances>
            </Method>
            <!-- method to get multiple files -->
            <Method Name="ReadFiles">
              <FilterDescriptors>
                <FilterDescriptor Type="Wildcard" Name="FileFilter" />
              </FilterDescriptors>
              <Parameters>
                <Parameter Direction="In" Name="FileName">
                  <TypeDescriptor TypeName="System.String" IdentifierName="FileName" Name="FileName" AssociatedFilter="FileFilter">
                    <DefaultValues>
                      <DefaultValue MethodInstanceName="FileSystemFinders" Type="System.String">*</DefaultValue>
                    </DefaultValues>
                  </TypeDescriptor>
                </Parameter>
                <Parameter Direction="Return" Name="MultipleFileDetails">
                  <TypeDescriptor TypeName="Microsoft.BusinessData.Runtime.DynamicType[]" Name="FileDetailsInDirectory" IsCollection ="true">
                    <TypeDescriptors>
                      <TypeDescriptor TypeName="Microsoft.BusinessData.Runtime.DynamicType[]" Name="FileDetail">
                        <TypeDescriptors>
                          <TypeDescriptor Name="FileName" TypeName="System.String" IdentifierName="FileName" ReadOnly="true"/>
                          <TypeDescriptor Name="Attributes" TypeName="System.IO.FileAttributes, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                          <TypeDescriptor Name="Date Modified" TypeName="System.DateTime"/>
                        </TypeDescriptors>
                      </TypeDescriptor>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </Parameter>
              </Parameters>
              <MethodInstances>
                <MethodInstance Type="Finder"
                                ReturnParameterName="MultipleFileDetails"
                                ReturnTypeDescriptorName="FileDetailsInDirectory"
                                ReturnTypeDescriptorLevel="0"
                                Name="FileSystemFinders">
                  <AccessControlList>
                    <AccessControlEntry Principal="redmond\domain users">
                      <Right BdcRight="Execute"/>
                      <Right BdcRight="Edit"/>
                      <Right BdcRight="SetPermissions"/>
                      <Right BdcRight="SelectableInClients"/>
                    </AccessControlEntry>
                  </AccessControlList>
                </MethodInstance>
              </MethodInstances>
            </Method>
            <!-- method to create list item -->
            <Method Name="CreateFile">
              <Parameters>
                <Parameter Name="Name" Direction="In">
                  <TypeDescriptor TypeName="System.String" IdentifierName="FileName" Name="FileName" CreatorField="true"/>
                </Parameter>
                <Parameter Name="FileName" Direction="Return">
                  <TypeDescriptor TypeName="System.String" IdentifierName="FileName" Name="FileName" />
                </Parameter>
              </Parameters>
              <MethodInstances>
                <MethodInstance Name="FileCreator"
                                Type="Creator"
                                ReturnParameterName="FileName"
                                ReturnTypeDescriptorName="FileName"
                                ReturnTypeDescriptorLevel="0">
                  <AccessControlList>
                    <AccessControlEntry Principal="redmond\domain users">
                      <Right BdcRight="Execute"/>
                      <Right BdcRight="Edit"/>
                      <Right BdcRight="SetPermissions"/>
                      <Right BdcRight="SelectableInClients"/>
                    </AccessControlEntry>
                  </AccessControlList>
                </MethodInstance>
              </MethodInstances>
            </Method>
            <!-- method to update list item -->
            <Method Name="UpdateFile">
              <Parameters>
                <Parameter Direction="In" Name="FileDetails">
                  <TypeDescriptor TypeName="Microsoft.BusinessData.Runtime.DynamicType"
                                  Name="FileDetails">
                    <TypeDescriptors>
                      <TypeDescriptor Name="FileName" TypeName="System.String" IdentifierName="FileName" UpdaterField="true"/>
                      <TypeDescriptor Name="Attributes" TypeName="System.IO.FileAttributes, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UpdaterField = "true" />
                      <TypeDescriptor Name="Date Modified" TypeName="System.DateTime" UpdaterField = "true"/>
                    </TypeDescriptors>
                  </TypeDescriptor>
                </Parameter>
              </Parameters>
              <MethodInstances>
                <MethodInstance Type="Updater"
                                Name="FileSystemUpdater">
                  <AccessControlList>
                    <AccessControlEntry Principal="redmond\domain users">
                      <Right BdcRight="Execute"/>
                      <Right BdcRight="Edit"/>
                      <Right BdcRight="SetPermissions"/>
                      <Right BdcRight="SelectableInClients"/>
                    </AccessControlEntry>
                  </AccessControlList>
                </MethodInstance>
              </MethodInstances>
            </Method>
            <!-- method to delete list item -->
            <Method Name="DeleteFile">
              <Parameters>
                <Parameter Direction="In" Name="FileName">
                  <TypeDescriptor TypeName="System.String" IdentifierName="FileName" Name="FileName" />
                </Parameter>
              </Parameters>
              <MethodInstances>
                <MethodInstance Type="Deleter"
                                Name="FileSystemDeleter">
                  <AccessControlList>
                    <AccessControlEntry Principal="redmond\domain users">
                      <Right BdcRight="Execute"/>
                      <Right BdcRight="Edit"/>
                      <Right BdcRight="SetPermissions"/>
                      <Right BdcRight="SelectableInClients"/>
                    </AccessControlEntry>
                  </AccessControlList>
                </MethodInstance>
              </MethodInstances>
            </Method>
          </Methods>
        </Entity>
      </Entities>
    </LobSystem>
  </LobSystems>
</Model>