Category Archives: Adapter

How To : Implement Business Data Connectivity in SharePoint 2013

Business Data Connectivity

Business Connectivity Services is a centralized infrastructure in SharePoint 2013 and Office 2013 that supports integrated data solutions. With Business Connectivity Services, you can use SharePoint 2013 and Office 2013 clients as interfaces into data that doesn’t live in SharePoint 2013 itself. For example, this external data may be in a database and it is accessed by using the out-of-the-box Business Connectivity Services connector for that database.


Business Connectivity Services can also connect to data that is available through a web service, or data that is published as an OData source or many other types of external data. Business Connectivity Services does this through out-of-the box or custom connectors.

External Content Types in BCS

External content types are the core of BCS. They enable you to manage and reuse the metadata and behaviors of a business entity, such as Customer or Order, from a central location. They enable users to interact with that external data and process it in a more meaningful way.

For more information about using external content types in BCS, see External content types in SharePoint 2013.

How to Connect With SQL External Data Source

Open the SharePoint Designer 2013 and click on the open site icon:

Input the site URL which we need to open:

Enter your site credentials here:

Now we need to create the new external content type and here we have the options for changing the name of the content type and creating the connection for external data source:

And click on the hyperlink text “Click here to discover the external data source operations, now this window will open:

Click on the “Add Connection “button, we can create a new connection. Here we have the different options to select .NET Type, SQL Server, WCF Service.

Here we selected SQL server, now we need to provide the Server credentials:

Now, we can see all the tables and views from the database.

In this screen, we have the options for creating different types of operations against the database:

Click on the next button:

Parameters Configurations:

Options for Filter parameters Configuration:

Here we need to add new External List, Click on the “External List”:

Select the Site here and click ok button:

Enter the list name here and click ok button:

After that, refresh the SharePoint site, we can see the external list here and click on the list:

Here we have the error message “Access denied by Business Connectivity.”

Solution for this Error

SharePoint central admin, click on the Manage service application:

Click on the Business Data Connectivity Service:

Set the permission for this list:

Click ok after setting the permissions:

After that, refresh the site and hope this will work… but again, it has a problem. The error message like Login failed for user “NT AUTHORITY\ANONYMOUS LOGON”.

Solution for this Error

We need to edit the connection properties, the Authentication mode selects the value ‘BDC Identity’.

Then follow the below mentioned steps.

Open PowerShell and type the following lines:

$bdc = Get-SPServiceApplication | 
where {$_ -match “Business Data Connectivity Service”}
$bdc.RevertToSelfAllowed = $true

Now it’s working fine.

And there is a chance for one more error like:

Database Connector has throttled the response.
The response from database contains more than '2000' rows. 
The maximum number of rows that can be read through Database Connector is '2000'. 
The limit can be changed via the 'Set-SPBusinessDataCatalogThrottleConfig' cmdlet

It’s because it depends on the number of recodes that exist in the table.

Solution for this Error

Follow the below steps:

Open PowerShell and type the following lines and execute:

$bcs = Get-SPServiceApplicationProxy | where{$_.GetType().FullName 
-eq (‘Microsoft.SharePoint.BusinessData.SharedService.’ + ‘BdcServiceApplicationProxy’)}
$BCSThrottle = Get-SPBusinessDataCatalogThrottleConfig -Scope database 
-ThrottleType items -ServiceApplicationProxy $bcs
Set-SPBusinessDataCatalogThrottleConfig -Identity $BCSThrottle -Maximum 1000000 -Default 20000

How To : SAP Integration with .Net 4.0 (SAP Connection Manager) & SharePoint

This is a simple, C# class library project to connect .NET applications with SAP.



This component internally implements SAP .NET Connector 3.0. The SAP .NET Connector is a development environment that enables communication between the Microsoft .NET platform and SAP systems.

This connector supports RFCs and Web services, and allows you to write different applications such as Web form, Windows form, or console applications in the Microsoft Visual Studio .NET.

With the SAP .NET Connector, you can use all common programming languages, such as Visual Basic. NET, C#, or Managed C++.

Using the SAP .NET Connector you can:

Write .NET Windows and Web form applications that have access to SAP business objects (BAPIs).

Develop client applications for the SAP Server.

Write RFC server applications that run in a .NET environment and can be installed starting from the SAP system.

Following are the steps to configure this utility on your project

Download and extract the attached file and place it on your machine. This package contains 3 libraries:


Now go to your project and add the reference of all these four libraries. Sapnco.dll and sapnco_utils.dll are inbuilt libraries used by SAP .NET Connector. SAPConnectionManager.dll is the main component which provides the connection between .NET and SAP.

Once the above steps are complete, you need to make certain entries related to SAP server on your configuration file. Here are the sample entries that you have to maintain on your own project. You need to change only the values which are marked in Bold. Rest remains unchanged.

<add key=”ServerHost” value=”″/>
<add key=”SystemNumber” value=”00″/>
<add key=”User” value=”sample”/>
<add key=”Password” value=”pass”/>
<add key=”Client” value=”50″/>
<add key=”Language” value=”EN”/>
<add key=”PoolSize” value=”5″/>
<add key=”PeakConnectionsLimit” value=”10″/>
<add key=”IdleTimeout” value=”600″/>

To test this component, create one windows application. Add the reference of sapnco.dll, sapnco_utils.dll, andSAPConnectionManager.dll on your project.

Paste the below code on your Form lode event

SAPSystemConnect sapCfg = new SAPSystemConnect();
RfcDestination rfcDest = null;
rfcDest = RfcDestinationManager.GetDestination(“Dev”);

That’s it. Now you are successfully connected with your SAP Server. Next you need to call SAP business objects (BAPIs) and extract the data and stored it in DataSet or list.

Demo Code available on request!!

Duet Enterprise – Creating and Deploying a Mobile Adapter Class for Business Data Action Web Parts

Learn how to create a mobile adapter class to display mobile views for Business Data Action Web Parts.

In Microsoft SharePoint 2010, mobile views are available for both the Business Data Builder Web Part and the Business Data Item Web Part. In the Starter Services site of Duet Enterprise for Microsoft SharePoint and SAP, a mobile view is available for only the Business Data Item Web Part. You must define a mobile adapter class to make mobile views available for other Business Data Web Parts. This topic describes how to write a mobile adapter class for Business Data Action Web Parts.

The procedures in this section describe how to create and deploy a mobile adapter class for displaying Business Data Action Web Parts.

The following are the basic steps to create and deploy a mobile adapter class:

  1. Create a mobile adapter class for Business Data Action Web Parts.
  2. Edit the compat.browser file.
  3. Register your adapter as a safe control.

To create a mobile adapter class for Business Data Action Web Parts

  1. In Microsoft Visual Studio 2010, create a new class library project named DuetMobileCustomization. Add references to the System.Web assembly and Microsoft.SharePoint.dll assembly.
  2. Add a using statement for the Microsoft.SharePoint.WebPartPages namespace. Depending on the details of your adapter implementation, add using statements for other namespaces. Commonly, mobile adapters make calls to types in the System.Web.UI.MobileControls namespace, Microsoft.SharePoint namespace, and Microsoft.SharePoint.MobileControls namespace.
  3. Add a class named WebPartClassMobileAdapter, where WebPartClass is a placeholder for the name of the Web Part that you are adapting. For example, if you are adapting the BusinessDataActionsWebPart, name the adapter class BusinessDataActionsWebPartMobileAdapter. This class should inherit from the WebPartMobileAdapter class.
  4. Add a namespace named MyCompany.SharePoint.WebPartPages.MobileAdapters. (Replace MyCompany with your company’s name.)
  5. Copy the following code into the new BusinessDataActionsWebPartMobileAdapter class.
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Security.Permissions;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI.MobileControls;
    using Microsoft.BusinessData.MetadataModel;
    using Microsoft.BusinessData.MetadataModel.Collections;
    using Microsoft.BusinessData.Runtime;
    using Microsoft.SharePoint.Portal.MobileControls;
    using Microsoft.SharePoint.MobileControls;
    using Microsoft.SharePoint.Utilities;
    using Microsoft.SharePoint.WebControls;
    using Microsoft.SharePoint.WebPartPages;
    using Microsoft.SharePoint.Portal.WebControls;
    using Microsoft.Office.Server.Diagnostics;
    namespace Microsoft.SharePoint.WebPartPages
        public class BusinessDataActionsWebPartMobileAdapter : WebPartMobileAdapter
  6. Because the WebPartMobileAdapter.Control property cannot be overridden, you might have to create a custom version of it by hiding and replacing it. You can do this by declaring a new Control property in your derived class by using the new keyword, as shown in the following example.
    protected new BusinessDataActionsWebPart Control
    ObjectModel = true)]
                get { return base.Control as BusinessDataActionsWebPart; }

    For more information about how to create a custom version of WebPartMobileAdapter.Control and hiding and replacing it, and why you might have to do this, see the Control property.

  7. If the default implementation of the CreateControlsForSummaryView method of the WebPartMobileAdapter class is not appropriate for mobile access to the Web Part in your specific implementation, override it. An override should create any necessary child controls and add them to the Controls collection in the order in which they should appear on a mobile device. The display should contain at least a small icon and a title for the summary view on a mobile device. If those are the only display elements that that you must have, you do not have to override the CreateControlsForSummaryView method. The WebPartMobileAdapter class contains two helper methods you can use to create your display: CreateWebPartIcon() and CreateWebPartLabel().When you must display more information than what appears in the default summary view (for example, when your adapted Web Part has multiple child items that are the same type), you can add a count of the total number of children to the summary view by placing a Label control after the icon and title. The following code shows how to do this.
    Note Note
    This example assumes that the custom Web Part that you are adapting has a Count property of type String that returns the total number of child items.
    protected override void CreateControlsForSummaryView()
            private void CreateControlsForWebPartHeader()
                Image iconImage = this.CreateWebPartIcon(WebPartIconLink.NoLink);
                iconImage.BreakAfter = false;
            private void CreateControlsForBusinessDataActions()
                    IList<string> result = this.Control.SelectedActions;
                        if (this.Control.BdcEntity != null)
                            IList<IAction> displayActions = GetActionsToDisplay(this.Control.BdcEntity);
                            result = new List<string>();
                            foreach (IAction action in displayActions)
                                Link l = new Link();
                                l.Text = action.Name;
    // This example does not create the Parameter value. 
    // Add logic to set the action of the parameter before storing this value in the Link Navigation URL.
                                l.NavigateUrl = action.Url;
                    catch (MetadataException)
                        // Metadata error. Just default to returning the Web Part's selected Actions.
                        result = this.Control.SelectedActions;
                catch (Exception e)
                    throw e;
    private IList<IAction> GetActionsToDisplay(IEntity entity)
                IList<IAction> result = new List<IAction>();
                INamedActionDictionary namedActionDictionary = entity.GetActions();
                if (namedActionDictionary.Count != 0)
                    // First add all the currently selected actions.
                    foreach (string selectedActionName in this.Control.SelectedActions)
                        if (namedActionDictionary.ContainsKey(selectedActionName))
                        // else
                    // Action may not be in the SelectedActions list,
                    // but the Web Part is configured to display new actions and
                    // this action is not one of the explicitly de-selected ones. Add it to UI.
                    if (this.Control.DisplayNewActions)
                        foreach (IAction action in namedActionDictionary.Values)
                            if (!result.Contains(action)
                                && !this.Control.DeselectedActions.Contains(action.Name))
                return result;
            public void cmd_Click(object sender, EventArgs e)
                string CommandText = ((Command)sender).Text;
  8. If the default implementation of CreateControlsForDetailView is not appropriate for mobile access to the Web Part in your specific implementation, override it. The default implementation renders an icon and title followed by a message that states that there is no detailed view for the Web Part. If you have overridden the CreateControlsForSummaryView method and do not want to provide a detailed view, override CreateControlsForDetailView and have it do nothing, as shown in the following example.
    protected override void CreateControlsForDetailView()
                // No Detail View
  9. To change the icon that appears next to the Web Part title, override one or more of the following properties:
    • SummaryViewTitleIconUrl  The icon that appears next to the title when the Web Part is collapsed.
    • DetailViewTitleIconUrl  The icon that appears next to the title when the Web Part is expanded.
    • TitleIconUrl  The icon that appears next to the title when the mobile device does not support expand or collapse scripting.

    The code in the following example shows how to override the TitleIconUrl property. In this override, if the Web Part displays a list and the list has an icon of its own in its ImageUrl property, that icon is displayed.

    protected override string TitleIconUrl
            SPContext context = SPContext.GetContext(HttpContext.Current);
            if (String.IsNullOrEmpty(context.List.ImageUrl))
                return base.TitleIconUrl;
            return context.List.ImageUrl;
  10. Compile the assembly, give it a strong name, and then deploy it either to the global assembly cache or to the \BIN folder of the Web application on every front-end web server in the farm. To deploy it to the global assembly cache, ensure that GlobalAssemblyCache is selected in the Assembly Deployment Target of the Properties pane of your class library project in Visual Studio 2010. This topic assumes that you are deploying to the global assembly cache.

To edit the compat.browser file

  1. In a text editor, open the compat.browser file that is located at \\Inetpub\wwwroot\wss\VirtualDirectories\port_number\App_Browsers\compat.browser, where port_number is the port of the web application. Scroll to the <browser> element that has the refID attribute value of default. This element will have a child element named <controlAdapters> that looks much like the code in the following example.
      <adapter controlType="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
        adapterType="Microsoft.SharePoint.WebPartPages.XsltListViewWebPartMobileAdapter, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      <adapter controlType="Microsoft.SharePoint.WebPartPages.ListViewWebPart, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
        adapterType="Microsoft.SharePoint.WebPartPages.ListViewWebPartMobileAdapter, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
      <adapter controlType="Microsoft.SharePoint.Applications.GroupBoard.WebPartPages.WhereaboutsWebPart, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
        <adapter controlType="Microsoft.SharePoint.Applications.GroupBoard.WebPartPages.WhereaboutsWebPart, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                         adapterType="Microsoft.SharePoint.Applications.GroupBoard.WebPartPages.WhereaboutsWebPartMobileAdapter, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
                <adapter controlType="Microsoft.SharePoint.WebPartPages.ImageWebPart, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
                         adapterType="Microsoft.SharePoint.WebPartPages.ImageWebPartMobileAdapter, Microsoft.SharePoint, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
  2. Add an <adapter> element as a child of the <controlAdapters> element. This child element maps your adapter class to the custom Web Part that it adapts. Notice that both the controlType attribute and adapterType attribute are required. The value for both should be the fully qualified name of the class and the four-part name of the assembly. To obtain your adapter assembly’s public key token, in Visual Studio 2010 on the Tools menu, click Get Assembly Public Key. For another way to obtain the public key token, see How to: Create a Tool to Get the Public Key of an Assembly ( For more information about this XML markup, see Browser Definition File Schema (browsers Element) ( The following code shows one example of an <adapter> element.
    <adapter controlType="Microsoft.SharePoint.Portal.WebControls.BusinessDataActionsWebPart, 
    Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" 
    adapterType="Microsoft.SharePoint.WebPartPages.BusinessDataActionsWebPartMobileAdapter, MobileCustomization, 
    Version=, Culture=neutral, PublicKeyToken=<assemblyPublic Key>" />
    To deploy your adapter class to a server farm, you must change the compat.browser file as described earlier on every front-end web server. Do not overwrite the existing compat.browser file with a compat.browser file of your own because this might cancel adapter mappings that are made by other Microsoft SharePoint 2010 solution providers. Consider deploying the adapter as part of a SharePoint 2010 Feature. In the FeatureActivated event handler, create a timer job that adds the required <adapter> element to the compat.browser file on every front-end web server. For detailed information about programmatically editing the compat.browser file on all servers by using a timer job, see How to: Run Code on All Web Servers (

To register your adapter as a safe control

  1. In your Visual Studio 2010 project, add an XML file named webconfig.CompanyName.xml, where CompanyName is the name of your company or another name that is not likely to be used by any other SharePoint Foundation 2010 solution providers.
    Tip Tip
    We recommend that you register your adapter by deploying it inside a SharePoint 2010 solution. The steps in this section are required only if your development computer is a single front-end web server. A SharePoint 2010 solution enables you to register controls as safe on all front-end web servers when your solution is deployed. For more information about using solution deployment to register controls as safe, see Solutions Overview (, Manually Creating Solutions in SharePoint Foundation (, and Solution Schema (
  2. Add an <action> element that follows the model in the example below to the file. The TypeName attribute of the <SafeControl> element can be the name of your adapter class, such as UserTasksWebPartMobileAdapter. If you have multiple adapter classes in the same namespace, you can use an asterisk (*) as the value of TypeName.
       <add path="configuration/SharePoint/SafeControls">
          Assembly=" MobileCustomization, Version=, Culture=neutral, PublicKeyToken=<myPublicKeyToken>"
    Caution noteCaution
    Using an asterisk (*) as the value of TypeName makes every class in the namespace a safe control. If you have some classes in the assembly that should not be designated as safe, move them to a different assembly or avoid using the asterisk (*) value.

    For more information about the <SafeControl> element and web.config files, see How to: Create a Supplemental .config File ( and Working with Web.config Files (

  3. Save the file. You must now copy it to the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\CONFIG folder on your development computer. The simplest way to do this on your development computer is to add the following lines to a post-build event command line or to a batch file script.
    xcopy /y webconfig.MyCompany.xml "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG"
    stsadm –o copyappbincontent
    This code assumes that you have followed the recommendations in How to: Add Tool Locations to the PATH Environment Variable (

    The copyappbincontent Stsadm.exe command performs the action defined by the <action> element in your Web configuration .xml file. In this case, it inserts the new <SafeControl> element of your adapter into the web.config file at the root of the web application. It first removes any existing <SafeControl> elements for the adapter. This lets you rerun the Stsadm command with every build without creating duplicate <SafeControl> elements.) For more information about Stsadm, see Stsadm command-line tool (


Enhanced by Zemanta