cyberblast.SharePoint.Client
1.0.4
Adapter Library to communicate with SharePoint 2013. CSOM wrapper: will install CSOM NuGet Package as well.
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" />
paket add cyberblast.SharePoint.Client --version 1.0.4
#r "nuget: cyberblast.SharePoint.Client, 1.0.4"
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 specifiedTMGAuthentication
Form based authentication against a TMG Gateway
Inherits CookieAuthenticatorO365Authenticator
Opens a browser window requesting for O365 credentials.
Currently only working when using Windows Forms.
Contained in separate namespacecyberblast.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 specifiedTMGAuthentication
Form based authentication against a TMG Gateway
Inherits CookieAuthenticatorO365Authenticator
Opens a browser window requesting for O365 credentials.
Currently only working when using Windows Forms.
Contained in separate namespacecyberblast.Claims.WinForm
(CookieAuthenticator)
Abstract for implementing form based Authenticators
Release Notes
Added nuget readme
Dependencies
-
- Microsoft.SharePoint.Client.Online.CSOM (>= 15.0.4859.1003)
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.