Extentrix Developer Network-Extentrix Web Services – Application Edition


Extentrix Web Services – Application Edition integration with Microsoft SharePoint 2007

Contents:

Introduction
Requirements
Application Source Code
How to Deploy Extentrix Smart Access Web Part to SharePoint Site.

Introduction

This sample shows how to build a SharePoint web part that consumes Extentrix Web Services 2.0 – Application Edition and acts as a web interface for the SharePoint sites.


Requirements

 

  1. To run this sample, you need Visual studio 2005, with Framework version 2.0

  2. windows server 2003, with SharePoint server 2007 and any created SharePoint site.
  3. Any web browser

Application Source Code

This sample is a class library project and it has one header file (SmartAccess.cs), which contains all required code.

Open the project on VS2005 and try to go over the following notes:

  1. Change the web reference URL as follow:

  2.  

    a. in solution explorer right click on the web reference which is named (OurWebServices) and click Properties.

     

    Figure 1

    b. in the the Properties pane change the URL and press enter.

     

  3. Change NetworkCredential information :

  4.  

    between line 244 and 248 you find the following code:
    NetworkCredential credentials = new NetworkCredential();

    credentials.UserName = "administrator";

    credentials.passw0rd = "p@ssw0rd";

    This code allows the web part to upload images and files.

    change the username and password with your windows server account.

How to Deploy Extentrix Smart Access Web Part to SharePoint Site.

 

  1. Putting Assembly in GAC Folder:
  2.  

    a. Open the project properties in solution explorer and go to the ‘signing’ section, then create a new key. Now, build the project.

     

    Figure 2

    b. To let SharePoint know that the assembly is safe, we have to add it to the safe control list in the web.config of the SharePoint web. We need the public

        key token from the DLL for this.

     

      i. First drag and drop the compiled assembly (.DLL files in \bin\debug folder) into the GAC (by default c:\windows\assembly).

     

    Figure 3

     

      ii. Open the properties of the dll to get the public key token.

     

    Figure 4

     

      iii. Fill the key in the code below, copy this code and past it in web.config file (by default in C:\Inetpub\wwwroot\wss\VirtualDirectories\MyPortSite ).

    SafeControl Assembly="ExtentrixSmartAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=74e5f216d6256126" Namespace=   " ExtentrixSmartAccess" TypeName="*" Safe="True" />

    Now the safe control is registered in the web.config.
  3. Now in SharePoint 2007 once a dll is registered in the web.config, SharePoint can automatically detect web parts from those dll’s. With the site settings page, we can now automatically populate the web part gallery.
  4.  

    a. In SharePoint site, click ‘Site Actions’, ‘Site Settings’ and then Under ‘Galleries’, click ‘Web Parts’. Then click ‘New’.

     

    Figure 5

     

    b. Now, the Extentrix Smart Access web part will appear in the list. If not, try an IISRESET and refresh the page.

     

    c. Select the web part we’ve just created and click ‘Populate Gallery’.

     

    Figure 6

  5. Now, we can go to the page in SharePoint where we want to add the web part.

     

    a. On the SharePoint site, click ‘Site Actions’ and the ‘Edit Page’.

     

    b. Click on ‘Add a Web Part’ in the zone you want to add the web part.

     

    c. Select the web part to add, and click ‘Add’.

     

    d. If everything goes well, the web part is loaded.

     

    e. The window will be shown to you first. Enter the proper credentials to logon.

     

    Figure 7

     

    e. After logging in, you will see the list of published applications assigned to you.

     

    Figure 8