Camelot .NET Connector is now available in the NuGet Gallery

Having more and more developers wanting to streamline upgrades, starting new projects and so on we decided to add our binaries to the NuGet Gallery.

Installation

You may install it through the command line client or the package manager.

PM> Install-Package Camelot.SharePointConnector

Retrieve a license file

The license key manager is actually shipped with the NuGet package, check your projectroot\packages\Camelot.SharePointConnector.3.5.0\Camelot License Key Manager

Another way to retrieve a license is by manual registration of the MAC or FQDN in our customer portal, http://www.bendsoft.com/customer-portal/licenses/

Implementing the license

Copy the license to your Visual Studio project, when in place ensure to set the “Copy to Output Directory” parameter to “Copy always” or “Copy if newer”.

First code sample

From here on it’s regular .NET development :)

using System;
using System.Data;

namespace NuGetTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Camelot.SharePointConnector.Data.SharePointConnection.ProvideLicenseFile(@"license_signed.xml");
            string conn = "server=sp.bendsoft.com;authentication=NTLM;user=xxx;password=xxx";

            var dt = Camelot.SharePointConnector.Data.Helper.ExecuteDataTable("SHOW TABLES", conn);

            foreach (DataRow row in dt.Rows)
            {
                Console.WriteLine(row["Title"]);
            }

            Console.Read();
        }
    }
}

Q&A at StackOverflow as usual!

Posted in Camelot .NET Connector, SharePoint | Leave a comment

What’s new in Camelot .NET Connector 3.5?

The Camelot .NET Connector 3.5 has been released in October 2013. Version 3.0 was a great step up when it introduced Office 365 support, aggregated functions, NHibernate support and much more. We resist being any worse with the new release. Here are some of the highlights!

Performance

As with every release, we always work hard to improve the performance of the Connector. You will probably see performance improvements in some use cases, in particular on the first query in your application. The new UseDefaultProxy option allows you to modify how the Connector works with your default proxy settings in Windows. Please check this option if you are behind a proxy server and experience any connection issues.

Update ReadOnly columns

Ability to modify ReadOnly fields in SharePoint! Yes, it is now possible to update columns like “Modified” and “Created” through the Camelot .NET Connector. Usually, this is not possible because SharePoint will not allow it. The Connector has solved this problem with two new procedures called SETREADWRITE and SETREADONLY. This is really useful in backup/restore scenarios and similar.

Fetch all versions of list items

Ability to fetch all versions of list items in a list when versioning is enabled. Versioning in SharePoint can be a bit tricky to work with from an integration perspective. The new GETCOLUMNVERSIONS procedure solves this. Through this procedure you may select one or more columns in a statement and receive all versions of an item in the list. You can now show much more details in your external applications!

Greate new lists

The new CREATELISTFROMTEMPLATE procedure makes it possible to create new lists on a site!

SHOW DATABASES

Many of you have been asking for a SHOW DATABASES command. Now it’s here! There are obviously a lot of use cases for this.

Batch INSERT

Now it’s possible to join multiple INSERT statements to one single statement. This may give a significant performance boost in batch scenarios because only one round trip is required to insert all values. Simply add all values to your INSERT statement (as you would with any other SQL database):

INSERT INTO mytable (a, b, c) VALUES (‘v1′, ‘v2′, ‘v3′), (‘v4′, ‘v5′, ‘v6′), ..

Simple license file management

In version 3.5, license files can be provided directly by the application to the Connector. In previous versions, the license file was read from the default installation path. The new methods open up a lot of interesting possibilities, such as bundling license files with your application. It is very useful for all of you who are developing redistributable software. Read more about how to do this here.

Posted in Camelot .NET Connector, SharePoint | Leave a comment

A glimpse of Camelot PHP Tools 2.0

Ever since we silently released the Camelot PHP Tools on Codeplex (http://camelotphptools.codeplex.com/) a few days ago we have been working on the upcoming release 2.0 and will so continue to do until everything is implemented as supposed.

What’s new

Major fixes and addons

  • PHP 5.4 strict mode support
  • Lots of new helper classes for standard lists of SharePoint, like the Tasklist and the Calendar. This will enable management of the default list types directly from PHP
  • New procedure class supporting all stored procedures and any overloads they many have, the procedures includes
  • New and configurable exception handling

Minor changes

  • Set document library to preload in the document library helper class
  • New method to store download files in a variable
  • and loads more, check the changelog!

Deprecated functions and classes

  • CamelotUploadFile, functionality moved into the new procedure call
  • CamelotDownloadFile, functionality moved into the new procedure call
  • Append in WcfSettingsList, use appendSettings instead

Roadmap

The roadmap is still open and any good ideas still have a chance to be implemented, contact us at phptools@bendsoft.com or comment this post.

Download beta releases

As soon as we reach a new beta status we will commit the changes to Codeplex and they will be available for public download. To keep track on this check our twitter flow or follow us on Codeplex. The sourcecode is posted at http://camelotphptools.codeplex.com/SourceControl/BrowseLatest

/PHP Tools dev team

Posted in PHP, SharePoint | Tagged | Leave a comment

CamelotSql – the SharePoint SQL Command-Line Tool

Bendsoft has now bundled a new tool called CamelotSql with the Camelot .NET Connector.

CamelotSql is a simple, yet quite powerful command line tool for executing SQL statements into SharePoint 2007 through 2013 including Office 365. It is bundled with the Camelot .NET Connector 3.0 and available for .NET 4.

It supports interactive and noninteractive use enabling scripting and backup/export possibilities to CSV, TSV, XML and HTML formats or binary files from document libraries.

CamelotSql

For more reading see our online document here.

Posted in Camelot .NET Connector, Integrations, Office 365, SharePoint | Leave a comment

Getting started with NHibernate for SharePoint Part 4 – Working with a Links list

« Previous post (Show Lists and Libraries)


So far in this series we have been covering the absolute basics of getting started. We will continue to do so but dig in a bit more in how to work with some of the standard list templates in SharePoint. I will cover the following list templates in the following turorials

  • Links
  • Tasks
  • Announcements
  • Contacts
  • Calendar

Changes since last tutorial (Part 3)

Since we are stepping up a bit here and will introduce several new lists and more complexity I have moved around and refactored a bit in my project to create better separation. I did borrow some of the pattern from a normal MVC project

  • Business, contains business layers and core functionality
  • Content, where we will keep our NHibernate classes and mapping files
  • Models, where we will keep our operational methods for NHibernate

All and all the project now looks like this

Strategy to get started working with a new type of list

The first thing you must decide is which fields to work with. Detailed field information can be acquired by using a tool like SharePoint Manager or the Camelot .NET Connector with Mini SQL Query. I will use the Mini SQL Query in this guides since it will allow us to test some queries and have a really good overview of the fields and their data.

The Links list

If you have connected to a Team-site this list will already be there (as can be seen in the previous tutorial). If the list is missing simply create it using the SharePoint interface. Also add a couple of links here for us to test with.

Download Mini SQL Query and open it on the same computer / server as where you have Camelot .NET Connector installed. Run the query

SELECT * FROM Links.all WHERE ContentType = 'Link'

This should render a result looking like this

If you look around a bit on the result we will find that the following fields are out of interest,  ID, URLwMenu, Created, Modified, Comments. When running a query with those fields we will get a result looking something like this.

Simple enough, lets start to create some classes and mapping files

Content/Links.cs

This list seem simple but there is a small quirk in it. Note the format on the URL field (http://www.bendsoft.com, Bendsoft Website), one could think that the URL and Title should be stored in different fields but this is not the case, this is simply the way SharePoint stores URLs, this format is important to remember when inserting and updating data into URL fields in SharePoint.

We will ignore this small quirk for now but in the SDK this fields is replaced with a specialized URL property type that implements the IUserType interface.

Create the file Content/Links.cs and implement the following code

namespace NHibernateExample.Content
{
    public class Links
    {
        public virtual int ID { get; protected set; }
        public virtual string URL { get; set; }
        public virtual System.DateTime Created { get; protected set; }
        public virtual System.DateTime Modified { get; protected set; }
        public virtual string Comments { get; set; }
    }
}

Content/Links.hbm.xml

Create the file Content/Links.hbm.xml and enter the following mapping into it and remember to set the build action to “Embedded Resource”

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
  <class name="NHibernateExample.Content.Links, NHibernateExample" lazy="true" table="Links">
    <id name="ID">
      <generator class="native" />
    </id>
    <property name="URL" />
    <property name="Created" update="false" insert="false" generated="insert" />
    <property name="Modified" update="false" insert="false" generated="insert" />
    <property name="Comments" />
  </class>
</hibernate-mapping>

The Created and Modified fields are managed by SharePoint, hence we must prevent NHibernate from trying to write any data to such fields.

Models/Links.cs

In the MVC pattern you use Models when communication with your datasources and this is exactly what we do here as well. This is nothing else then a pattern in our scenario but it is recommended to separate classes and communication when doing ORM applications.

We will use this file for our CRUD (Create Read Update Delete) methods. Create the file Models/Links.cs and paste the following code into it

using NHibernate;
using System;
using System.Collections.Generic;
using System.Linq;

namespace NHibernateExample.Models
{
    /// <summary>
    /// The Model class of links
    /// Basic CRUD support is implemented
    /// </summary>
    public class Links
    {
        /// <summary>
        /// Get all data from the links list
        /// </summary>
        /// <param name="session"></param>
        public static void Read(ISession session)
        {
            IQuery query = session.CreateQuery("FROM Links");
            IList<Content.Links> results = query.List<Content.Links>();

            if (results.Any())
            {
                Console.WindowWidth = 90;
                const string header = "{0, -9} {1}";
                foreach (Content.Links item in results)
                {
                    Console.WriteLine(header, "ID", item.ID);
                    Console.WriteLine(header, "URL", item.URL);
                    Console.WriteLine(header, "Created", item.Created.ToShortDateString());
                    Console.WriteLine(header, "Modified", item.Modified.ToShortDateString());
                    Console.WriteLine(header, "Comments", item.Comments);
                    Console.WriteLine(new string('-', 20));
                }
            }
            else
            {
                Console.WriteLine("Could not fetch any lists");
            }
        }

        /// <summary>
        /// Get a single entry from the links list
        /// </summary>
        /// <param name="session"></param>
        /// <param name="itemId"></param>
        /// <returns></returns>
        public static Content.Links Read(ISession session, int itemId)
        {
            IQuery query = session.CreateQuery("FROM Links WHERE ID = :ID").SetParameter("ID", itemId);
            return query.UniqueResult<Content.Links>();
        }

        /// <summary>
        /// Insert new post in the links list
        /// </summary>
        /// <param name="session"></param>
        /// <param name="item"></param>
        /// <returns>The created object</returns>
        public static Content.Links Create(ISession session, Content.Links item)
        {
            using (ITransaction transaction = session.BeginTransaction())
            {
                var ret = session.Save(item);
                transaction.Commit();
            }
            Console.WriteLine("Saved link to SharePoint with ID {0}", item.ID);
            Console.WriteLine(new string('-', 20));

            return item;
        }

        /// <summary>
        /// Update a post in the links list
        /// </summary>
        /// <param name="session"></param>
        /// <param name="item"></param>
        /// <returns>The updated object</returns>
        public static Content.Links Update(ISession session, Content.Links item)
        {
            using (ITransaction transaction = session.BeginTransaction())
            {
                session.Update(item);
                transaction.Commit();
            }
            Console.WriteLine("Updated link with ID {0}", item.ID);
            Console.WriteLine(new string('-', 20));

            return item;
        }

        public static void Delete(ISession session, Content.Links item)
        {
            using (ITransaction transaction = session.BeginTransaction())
            {
                session.Delete(item);
                transaction.Commit();
            }
            Console.WriteLine("Deleted link with ID {0}", item.ID);
            Console.WriteLine(new string('-', 20));
        }
    }
}

That’s pretty much all the coding we need to do. Lets test!

Testing

Use your Main method in the program.cs file and run the code

using (ISession session = SessionFactory.OpenSession())
{
    Models.Links.Read(session);
}


If you didn’t insert any data begin by doing so, the following snippet will insert a new link and read all available when done
using (ISession session = SessionFactory.OpenSession())
{
    Links link = new Links()
    {
        URL = "http://blog.bendsoft.com, Bendsoft Official Blog",
        Comments = "Attempt to insert data using NHibernate"
    };
                
    // Insert
    var newLink = Models.Links.Create(session, link);
                
    // Read
    Models.Links.Read(session);
}


How to use the other methods will speak for it self. Comment this post if this needs clarification!


« Previous post (Show Lists and Libraries)

Posted in NHibernate for SharePoint, Tutorials | Tagged , | 1 Comment

Getting started with NHibernate for SharePoint Part 3 – Show all lists and libraries from a web

« Previous post (Getting started)Next post (Working with a Links List) »


Listing available lists and their properties from a web always brings up some very interesting information. Since the Camelot .NET Connector follows the naming conventions of SQL the command we normally invoke is called “SHOW TABLES”. But to make this a bit more understandable for SharePoint developers we aliased this to “SHOW LISTS” and that’s the command we will use in this tutorial.

To do this using NHibernate for SharePoint we must create a few files in the same project we created earlier

  1. Lists.cs
  2. Lists.hbm.xml

Creating the structure

At this stage we will try to keep things as simple as possible. Simply create the files in your project root. Your project should now be looking something like this

Lists.cs

We will start by trying to fetch a small amount of the available properties of the lists, lets start with ID, Title, Description, Created and ItemCount

using System;

namespace NHibernateExample
{
    public class Lists
    {
        public virtual Guid ID { get; set; }
        public virtual string Title { get; set; }
        public virtual string Description { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual int ItemCount { get; set; }
    }
}

Lists.hbm.xml

The properties of the lists class should be reflected in the hibernate mapping file

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true">
  <class name="NHibernateExample.Lists, NHibernateExample" lazy="true">
    <id name="ID">
      <generator class="native" />
    </id>
    <property name="Title" />
    <property name="Description" />
    <property name="Created" />
    <property name="ItemCount" />
  </class>
</hibernate-mapping>

It is very important to set the build action of the hbm file to “Embedded Resource”. If not NHibernate will not be able to create the mapping since it will not be aware of the file.

Executing the command

So far we have created the essential files to handle the data coming from SharePoint and it’s time to move on to actually fetching the data. We must add a method that connects the previous, this is called a SessionFactory. Add the following method in the same class where you will execute your code, preferably the Program class if you are in a console application.

static ISessionFactory _sessionFactory;
static ISession OpenSession()
{
    if (_sessionFactory == null)
    {
        // Create configuration instance
        var configuration = new Configuration();

        // Fetch the first connectionProvider, if you have several configure them manually and disable this
        var connectionProvider = Assembly.GetExecutingAssembly().GetTypes().First(x => (typeof(IConnectionProvider)).IsAssignableFrom(x));

        if (connectionProvider != null)
        {
            // Register the connection probider
            configuration.SetProperty("connection.provider", connectionProvider.AssemblyQualifiedName);
        }

        configuration.AddAssembly(Assembly.GetCallingAssembly());
        _sessionFactory = configuration.BuildSessionFactory();
    }
    return _sessionFactory.OpenSession();
}

Creating a query

Any normal day we would now implement a CreateQuery command and execute our statement in that but since we are invoking a SHOW command we must instead execute a CreateSQLQuery and add its entity that are of type Lists.

This will look like this

ISQLQuery showListsQuery = session.CreateSQLQuery("SHOW LISTS").AddEntity(typeof(Lists));

What we are doing here is to send a SQL Query and forcing a type (Lists) on the result so NHibernate can know what kind of object we shall cast our result into later on.

Fill in the rest of the code, to start we must forst open a session, execute the query and then put the result in a list and render the result. My main method now looks like this

static void Main(string[] args)
{
    using (ISession session = OpenSession())
    {
        ISQLQuery showListsQuery = session.CreateSQLQuery("SHOW LISTS").AddEntity(typeof(Lists));
        IList<Lists> lists = showListsQuery.List<Lists>();

        if (lists.Any())
        {
            Console.WindowWidth = 90;
            const string header = "{0,-38} {1,-23} {2,-11} {3}";
            Console.WriteLine(header, "ID", "Title", "Created", "ItemCount");
            foreach (Lists list in lists)
            {
                Console.WriteLine(header, list.ID, list.Title, list.Created.ToShortDateString(), list.ItemCount);
            }
        }
        else
        {
            Console.WriteLine("Could not fetch any lists");
        }

    }
    Console.WriteLine("Done");
    Console.Read();
}

And the result of a normal teamsite will look something like this

This is a rather primitive way to show the result but this can easily be used in any .NET application. Supersimple, flexible and you don’t need much previous knowledge of SharePoint!


« Previous post (Getting started)Next post (Working with a Links List) »

Posted in NHibernate for SharePoint, Tutorials | Tagged , | Leave a comment

Getting started with NHibernate for SharePoint Part 2 – Getting started

« Previous post (Introduction)Next post (Show Lists and Libraries) »


To get stated we will need to set up the basics of NHibernate and Camelot .NET Connector, this includes the following actions.

  1. Install and include Camelot .NET Connector in your project
  2. Download and include NHibernate in your project
  3. Configure the configuration files
  4. Create a ConnectionProvider and Driver

Prerequisites

To get started with NHibernate for SharePoint please download and install the latest version of the Camelot .NET Connector for SharePoint.

I will use Visual Studio 2012 in this tutorial but most versions will suffice.

You must have access to a SharePoint server. Compatible versions are 2007, 2010, 2013 and SharePoint Online in Office 365.

Create a new project

I will demonstrate this using a console application. Make sure to select the .NET Framework you prefer.

Reference the Camelot .NET Connector assembly

Include the NHibernate binaries. This can be done by either using NuGet or by downloading the NHibernate binaries from Sourceforge.

Using the NuGet GUI

…or by using the NuGet Packet Manager Console, execute the command Install-Package NHibernate

Configuring NHibernate

Create a new file called hibernate.config and add the following code to it

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
  <session-factory>
    <property name="connection.connection_string">
        Server=serveraddress;Database=;Domain=;User=username;Password=pass;
        Authentication=Ntlm;TimeOut=50;RecursiveMode=RecursiveAll;
        DecodeName=True;NoListFilters=False;
    </property>
    <property name="connection.release_mode">on_close</property>
    <property name="dialect">NHibernate.Dialect.MySQLDialect</property>
    <property name="show_sql">false</property>
  </session-factory>
</hibernate-configuration>
  

Please note the connection string, this is where you specify your SharePoint Server whereabouts and whatabouts. The options stated in this example is a suggestion, please read the full docs on connection string options in the official documentation.

Also ensure that the file is copied to output directory at compile time

And register the file in app.config (or web.config for that matter). In this simple example the app.config now looks like this

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate" />
  </configSections>
  <hibernate-configuration configSource="hibernate.config"/>
</configuration>

Creating the ConnectionProvider and Driver

Create a new file named CamelotSharePointDriver.cs. This will be the driver for the Camelot .NET Connector that tells NHibernate how to query through the Connector.

namespace NHibernateExample
{
    public class CamelotSharePointDriver : NHibernate.Driver.ReflectionBasedDriver
    {
        public CamelotSharePointDriver()
            : base("Camelot.SharePointConnector", "Camelot.SharePointConnector", "Camelot.SharePointConnector.Data.SharePointConnection", "Camelot.SharePointConnector.Data.SharePointCommand")
        { }

        public override string NamedPrefix { get { return "?"; } }

        public override bool SupportsMultipleOpenReaders { get { return false; } }

        public override bool SupportsMultipleQueries { get { return false; } }

        protected override bool SupportsPreparingCommands { get { return false; } }

        public override bool UseNamedPrefixInParameter { get { return true; } }

        public override bool UseNamedPrefixInSql { get { return true; } }
    }
}

Create another file named CamelotSharePointConnectionProvider.cs. This will be the connection provider object for your application and we will apply it in the NHibernate configuration later. In this example, the connection string is read from the NHibernate configuration. You can easily modify this class to read the connection strings from somewhere else, e.g. the application configuration. It is important that the Driver method returns the CamelotSharePointDriver object that we created previously.
namespace NHibernateExample
{
    public class CamelotSharePointConnectionProvider : NHibernate.Connection.IConnectionProvider
    {
        private string _connectionString;

        public void CloseConnection(System.Data.IDbConnection conn)
        {
            conn.Close();
        }

        public void Configure(System.Collections.Generic.IDictionary<string, string> settings)
        {
            _connectionString = settings["connection.connection_string"];
        }

        public NHibernate.Driver.IDriver Driver { get { return new CamelotSharePointDriver(); } }

        public System.Data.IDbConnection GetConnection()
        {
            var conn = new Camelot.SharePointConnector.Data.SharePointConnection(_connectionString);
            conn.Open();
            return conn;
        }

        public void Dispose()
        {
            return;
        }
    }
}


« Previous post (Introduction)Next post (Show Lists and Libraries) »

Posted in NHibernate for SharePoint, SharePoint | Tagged , | Leave a comment

Getting started with NHibernate for SharePoint Part 1 – Introduction

Next post (Getting started) »


The following introduction on NHibernate can be found on Wikipedia

NHibernate is an object-relational mapping (ORM) solution for the Microsoft .NET platform: it provides a framework for mapping an object-oriented domain model to a traditional relational database. Its purpose is to relieve the developer from a significant portion of relational data persistence-related programming tasks.

Spot on.

What are the benefits of working with strongly typed data?

Strong typing is a communication tool for explicit statements of intent backed by the guard of compilation. Method signatures with strong typing tell you exactly what kind of input they expect and what kind of output they return.

  • Predictability with intellisense
  • Catch most mistakes at compile time
  • Testability with methods like unit testing
  • Unambiguous, guaranteed documentation

The quote say that NHibernate require a traditional relational database?

This is true, that’s why you will need an ADO.NET Connector to allow communication with SharePoint in a language that NHibernate can understand. Download the Camelot .NET Connector for SharePoint to get started!

Do I need to install all of this in SharePoint?

No, not unless you are building an application using NHibernate in SharePoint. This solution depends on the Camelot .NET Connector that can be placed on any Windows computer running .NET 2 or newer. This means you can use NHibernate to build external applications that interface towards SharePoint in anyway you like.


Next post (Getting started) »

Posted in NHibernate for SharePoint, Tutorials | Tagged , | Leave a comment

MiniSqlQuery with SharePoint Connector 3.0

Recently I discovered a really nice open source project called Mini SQL Query on CodePlex.  It is a simple, yet quite powerful tool for querying databases via standard ADO.NET drivers, such as with the Camelot .NET Connector 3.0. So first of all, thanks to the authors of this tool!

Mini SQL Query is perfect for all of you who are developing SharePoint apps with the Connector and need verify your SQL’s before getting into it. It is also a great tool for SharePoint administrators and others that work with SharePoint on a daily basis. Tested with SharePoint 2007, 2010, 2013 as well as Office 365.

Requirements

To get started, simply download Mini SQL Query and launch the application. Register your SharePoint connection under connection strings, Edit -> Edit Connection Strings. You can add as many connections as you like.

Then, in the main interface, select your connection string. The left sidebar automatically shows all lists and document libraries on the site. Now you can type any SQL in the query window and see the results! It’s enough to get any SharePoint developer excited!

Happy Query Browsing!

Posted in Camelot .NET Connector, Office 365, SharePoint, Tutorials | Leave a comment

Getting started with Camelot SharePoint Connector and Office 365

In the new version (3.0) of the Camelot .NET SharePoint Connector Office 365 SharePoint Online support was introduced among a lot of new features.

Changes in the Connection String

Any previous application written will still be compatible with the Office 365 version of SharePoint. Simply set the authentication parameter to 365.

string connectionString = "server=mysite.sharepoint.com;site=;user=user@mysite.onmicrosoft.com;password=xxx;Authentication=365";

All connection string options: http://www.bendsoft.com/documentation/camelot-net-connector/latest/reference/connection-string-options/

Getting started with a simple test

To demonstrate this I will write a simple program to view all available lists and libraries in the default site, I will use the connection string written earlier in this post. To view all lists use the SHOW TABLES command, full documentation here.

Available columns

The available columns is listed in the documentation, to view this yourself simply write this

// Retrieve all available lists on the site
DataTable siteTables = Helper.ExecuteDataTable("SHOW TABLES", connectionString);

// List columns
foreach (DataColumn column in siteTables.Columns)
{
    Console.WriteLine(column.ColumnName);
}

View the row data

To list all available lists and libraries lets have a look in the Rows DataRowCollection.

// Retrieve all available lists on the site
DataTable siteTables = Helper.ExecuteDataTable("SHOW TABLES", connectionString);

// Headings
Console.WriteLine("{0,-23} {1,-11} {2} ", "Title", "Item Count", "ID");

// Print the data
foreach (DataRow row in siteTables.Rows)
{
    Console.WriteLine("{0,-23} {1,-11} {2} ", row["Title"], row["ItemCount"], row["ID"]);
}

I’ve selected to display the Title, ItemCount and ID properties from the table

Ending

This was just a simple post to get you started using the Camelot .NET Connector and Office 365. Integrations have never been easier and this is compatible with all our other tools like Camelot PHP Tools for SharePoint.

Posted in Camelot .NET Connector, Office 365, Tutorials | Tagged , , | 2 Comments