Sharepoint 2010 – External Lists and Content Types + Business Connectivity Service INTEGRATING SugarCRM + PHP + MySQL

Posted in: Blog, SharePoint 2010 |

No comments

Hi everyone,

 

After attending a session at Sharepoint Saturday Perth regarding BCS and External Lists and Content Types, I was actually very-very interested in using it to connect to a non-Microsoft systems.

 

So far I notice that a lot of the integrations project are with other Microsoft apps such as MS CRM, Axapta, etc. But what about with a totally different system such as PHP + MySQL?

 

In this opportunity I want to share with you the walkthrough to represent MySQL data in Sharepoint using BCS and External Lists.

 

First of all let me introduce to you the PHP apps I want to integrate with: Sugar CRM. It’s an open source Customer Relationship Management written in PHP and using MySQL as the database backend. See below:

 

 

So, it’s now time for me to prepare for the integration. First of all I need to use Visual Studio 2010 to create the project. If you open Visual Studio and create new project, under Sharepoint -> 2010 you will see this project template: Business Data Connectivity Model.

 

 

 

Let’s create the project. By default it will look like the following:

 

 

You will also see the BDC Explorer window:

 

 

 

 

– It has a feature that is deployed at Farm level.

– It also has the BDC entity model on it.

 

Now, it’s time to do a bit of class renaming. By default you will get Entity1.cs and Entity1Service.csEntity1.cs is the entity that will be passed through/from BDC and Entity1Service.cs is the “business logic” class that BDC will use to read methods from. There are 2 methods by default: ReadList (used to display ALL items on External Lists) and ReadItem (used to display a particular item). You obviously can add more to this to perform CRUD operations.

 

Let’s now rename Entity1.cs to SugarCRMContact.cs and Entity1Service.cs to SugarCRMContactService.cs. If we now go to the BDC Explorer window, I would actually expect Visual Studio to auto-rename the BDC Entity object but it actually doesn’t. Therefore, we need to rename this as well. Let’s rename Entity1 to SugarCRMContact. We will need to modify the return object as well.

 

I’m hoping that this automation will be fixed in the released version of VS 2010.

 

The project is available for download. Therefore, if you get lost/confused with this step, don’t worry.

 

Once we’ve done all the renaming, it’s now time to create the “repository”/data layer class to connect to MySQL. As we all know, it’s always good to program with DDD/TDD (Domain-Driven-Design/Test Driven Development) methodology in mind so that our code is decoupled and not tight/dependent to each other. There are a lot of posts on the Internet about DDD/TDD so I won’t discuss much about this.

 

Once I’m finished with my data layer class, it’s now time to serve them in Sharepoint using BCS. If I now go back to my SugarCRMContactService.cs class, I can now do the following:

==

public static IEnumerable ReadList()

 

{
List bdcContacts = new List();

IContactRepository contactRepository = new DefaultContactRepository();

List contacts = contactRepository.GetContacts();

 

foreach (ContactEntity contact in contacts)

{

SugarCRMContact bdcContact = new SugarCRMContact();

bdcContact.ContactId = contact.ContactId.ToString();

bdcContact.FirstName = contact.FirstName;

bdcContact.LastName = contact.LastName;

bdcContacts.Add(bdcContact);

}

return bdcContacts;

}

==

 

Once we’ve done that, deploy your WSP to your farm and that’s it! Sharepoint will automatically create the BDC entity for you. Go to Central Admin -> Application Management -> Manage Service Applications then click on Business Data Connectivity then you’ll see the following:

 

 

 

Now we can start creating the External List for it. Open your site in Sharepoint Designer 2010, then go to External Content Types. You will automatically see your custom BDC entity. Double click on it and you’ll be brought to this page:

 

 

 

On the top click Create List & Form. Give your list a name and that’s it! If you now go back to your site and View All Site Content, you’ll see your external list in there. When you click it…

 

 

 

There you go: MySQL data in Sharepoint.

 

Download the project here.

 

Note:

1. You will need to download SugarCRM (http://www.sugarcrm.com/) and WAMPServer. WAMPServer runs PHP + MySQL + Apache at the same time.

2. Add the following connection string in your Sharepoint site web.config:

 

<add key=”ConnectionString” value=”Server=localhost;Database=sugarcrm;User=root;Password=;” />

Written by

A web solution expert who has passion in website technologies. Tommy has been in the web industry for more than 10 years. He started his career as a PHP developer and has now specialized in ASP.NET, SharePoint and MS CRM. During his career he has also been in many roles: system tester, business analyst, deployment and QA manager, team and practice leader and IT manager.

No Comments Yet.

Leave a Reply

You must be logged in to post a comment.

Our Services

We provides you the best Services in our themes.

  • Click on the link below to see a full list of clients which we have developed solutions and provided consultancy for.

    READ MORE

  • We are solution-centered and not application-centered.

    READ MORE

  • Being creative and having fun and yet still delivering a fantastic service is the center of our values.

    READ MORE

  • TFS Consulting Services guarantees delivery that is within budget and deadline or you engage us for free.

    READ MORE

Implementing IT does not have to be difficult.

As long as you have the right methodologies

We have heard a lot of complaints from our clients that IT a lot of the times give them headache. The issues range from over-budget implementation, server is too hard to maintain, application is not user friendly, features not complete and many others. If you have ever experienced similar situations, don’t worry. This is why TFS Consulting Services is here. We exist to help clients implementing a successful IT solution. We have various methodologies which we have proven working in delivering a successful IT implementation. Below is the list of some of our key service offerings:
  • Planning and Methodologies

    Implementing IT solution does not have to be difficult. TFS Consulting Services has a lot of resources on planning and methodologies that will ensure successful delivery of your IT solution. TFS Consulting Services has been around in the web industry for more than 10 years and has experienced all the successes and failures of various type of IT deployment.

    read more

  • Technical Resource

    Do you need a technical resource? TFS Consulting Services can also provide you with technical resource for developing ASP.NET (C# and VB.NET), SharePoint (2003, 2007, 2010, 2013) and MS CRM applications. Our resource is an Microsoft Certified Personnel (MVP) and Microsoft Certified Technology Specialist (MCTS) in all ASP.NET, SharePoint and CRM.

    read more

  • IT Consulting & Advice

    Make sure your IT implementation is robust and scalable. TFS Consulting Services can provide consulting and advice on industry’s best practice on various web-related areas such as website security, design and usability, application-specific (such as SharePoint)’s best practice, Search Engine Optimisation (SEO), coding standards and many others.

    read more

  • Solution Development

    Finally TFS Consulting Services provides you with solution development service. We mainly work with Microsoft technologies (ie. .NET and SQL Server), however we are also capable of developing with PHP and MySQL. If you ever need any business process automation, integration and solution development work,  we are the trusted expert you should go to.

    read more

For more detailed service offerings please visit our Solutions page.

Testimonials

  • I’m happy to recommend Tommy as a knowledgeable and diligent developer.

    Mike Stringfellow, Vivid Group
  • Tommy has a lot of great ideas that can be delivered into great products. It’s a pleasure working with him because he has a broad knowledge about available technologies out there and he knows what’s best for the client’s needs. He just knows how to work effectively and efficiently.

    Teddy Segoro, Student Edge
  • I’ve worked with Tommy over the past 6 months and have found his approach to development (especially SharePoint) absolutely outstanding. Tommy goes beyond the boundries of typical software development with his ability understand what a client requires and then build it into fully fledged software solution. Coupled with his professional “Best Practice” approach, you get Continue Reading

    Michael Bonham, DSC-IT

Contact us

Tommy Segoro
tommy@tfsconsulting.com.au
+61 404 457 754

   

© TFS Consulting Services 2025. All rights reserved.

www.incorporator.com.au