cyberblast.SharePoint.Client 1.0.4

Adapter Library to communicate with SharePoint 2013. CSOM wrapper: will install CSOM NuGet Package as well.

There is a newer version of this package available.
See the version list below for details.
Install-Package cyberblast.SharePoint.Client -Version 1.0.4
dotnet add package cyberblast.SharePoint.Client --version 1.0.4
<PackageReference Include="cyberblast.SharePoint.Client" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add cyberblast.SharePoint.Client --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: cyberblast.SharePoint.Client, 1.0.4"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

cyberblast.SharePoint.Client

Sample usage

using System;
using cyberblast.SharePoint.Client;
namespace ConsoleApp1 {
    class Program {
        static void Main(string[] args) {

            ISPClient client = new SPClient("http://yourSharePointUrl");
            client.Execute(ctx => {
                // now common CSOM
                var web = ctx.Web;
                ctx.Load(web, w => w.Title);
                ctx.ExecuteQuery();
                Console.Write(web.Title);
            });
        }
    }
}

Features

  • Set name/password
ISPClient client = new SPClient(
    "http://yourSharePointUrl", 
    "domain", 
    "loginName", 
    "password");
  • Use different authentication procedures
using cyberblast.SharePoint.Client.Authentication;
[...]
// using TMGAuthenticator (see below for a list of implemented Authenticators)
ISPClient client = new SPClient<TMGAuthenticator>(
    "http://yourSharePointUrl", 
    "domain", 
    "loginName", 
    "password");
client.Authenticate();
  • CAML query builder & iterate list items
using cyberblast.SharePoint.Client;
using cyberblast.SharePoint.Client.Authentication;
using Microsoft.SharePoint.Client;
namespace ConsoleApp1 {
    class Program {
        const int ROW_LIMIT = 100;
        static void Main(string[] args) {

            ISPClient client = new SPClient("http://yourSharePointUrl");

            var filter = QueryBuilder.Equals(
                new QueryBuilder.Field("Id"),
                new QueryBuilder.Value(7, FieldType.Number));
            var query = QueryBuilder.Query(filter, ROW_LIMIT);
			
            // C#7 Syntax. But any fitting delegate will do...
            void Callback(ListItem item) { 
                Console.WriteLine(item.Id);
            }

            client.Execute(ctx => 
                // ClientContext Extension
                ctx.IterateItems("Documents", query, Callback));
        }
    }
}
  • Retrieve and convert field values
void Callback(ListItem item) {
    int number = item.GetValue<int>("numberField");
    string author = item.GetValue<FieldUserValue, string>(
        "Author", 
        (fieldUserValue) => fieldUserValue.LookupValue);
}

Currently implemented Authenticators

  • DefaultAuthentication

    Authenticate using Integrated Windows authentication (NTLM/Kerberos)
    This one is also used when no Authenticator is specified

  • TMGAuthentication

    Form based authentication against a TMG Gateway
    Inherits CookieAuthenticator

  • O365Authenticator

    Opens a browser window requesting for O365 credentials.
    Currently only working when using Windows Forms.
    Contained in separate namespace cyberblast.Claims.WinForm

  • (CookieAuthenticator)

    Abstract for implementing form based Authenticators

cyberblast.SharePoint.Client

Sample usage

using System;
using cyberblast.SharePoint.Client;
namespace ConsoleApp1 {
    class Program {
        static void Main(string[] args) {

            ISPClient client = new SPClient("http://yourSharePointUrl");
            client.Execute(ctx => {
                // now common CSOM
                var web = ctx.Web;
                ctx.Load(web, w => w.Title);
                ctx.ExecuteQuery();
                Console.Write(web.Title);
            });
        }
    }
}

Features

  • Set name/password
ISPClient client = new SPClient(
    "http://yourSharePointUrl", 
    "domain", 
    "loginName", 
    "password");
  • Use different authentication procedures
using cyberblast.SharePoint.Client.Authentication;
[...]
// using TMGAuthenticator (see below for a list of implemented Authenticators)
ISPClient client = new SPClient<TMGAuthenticator>(
    "http://yourSharePointUrl", 
    "domain", 
    "loginName", 
    "password");
client.Authenticate();
  • CAML query builder & iterate list items
using cyberblast.SharePoint.Client;
using cyberblast.SharePoint.Client.Authentication;
using Microsoft.SharePoint.Client;
namespace ConsoleApp1 {
    class Program {
        const int ROW_LIMIT = 100;
        static void Main(string[] args) {

            ISPClient client = new SPClient("http://yourSharePointUrl");

            var filter = QueryBuilder.Equals(
                new QueryBuilder.Field("Id"),
                new QueryBuilder.Value(7, FieldType.Number));
            var query = QueryBuilder.Query(filter, ROW_LIMIT);
			
            // C#7 Syntax. But any fitting delegate will do...
            void Callback(ListItem item) { 
                Console.WriteLine(item.Id);
            }

            client.Execute(ctx => 
                // ClientContext Extension
                ctx.IterateItems("Documents", query, Callback));
        }
    }
}
  • Retrieve and convert field values
void Callback(ListItem item) {
    int number = item.GetValue<int>("numberField");
    string author = item.GetValue<FieldUserValue, string>(
        "Author", 
        (fieldUserValue) => fieldUserValue.LookupValue);
}

Currently implemented Authenticators

  • DefaultAuthentication

    Authenticate using Integrated Windows authentication (NTLM/Kerberos)
    This one is also used when no Authenticator is specified

  • TMGAuthentication

    Form based authentication against a TMG Gateway
    Inherits CookieAuthenticator

  • O365Authenticator

    Opens a browser window requesting for O365 credentials.
    Currently only working when using Windows Forms.
    Contained in separate namespace cyberblast.Claims.WinForm

  • (CookieAuthenticator)

    Abstract for implementing form based Authenticators

Release Notes

Added nuget readme

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.0 530 11/29/2017
1.0.4 495 11/18/2017