Working with the Taxonomy in CSOM

Building on my previous post, once you’re connected to your SharePoint server, you might need to do a few things – like set up Term Groups and Sets in the Taxonomy service. You’ll need your application to reference the Microsoft.SharePoint.Client.Taxonomy assembly. Continue reading “Working with the Taxonomy in CSOM”

Working with the Taxonomy in CSOM

Connect to Office 365 with CSOM

If you’re going to connect to SharePoint Online 2013 in Office 365, you’ll need to reference a few assemblies in your solution:

  • Microsoft.SharePoint.Client
  • Microsoft.SharePoint.Client.Runtime
  • System.Security

You’ll find these in the SharePoint Server 2013 Client Components SDK if you’ve not got them already.

In your code you’ll then need to create a ClientContext for your connection, including creating a SharePointOnlineCredentials object, and then you can start to talk to your SharePoint instance.

string url = "https://example.sharepoint.com/sites/testsite";
string username = "Office365User@example.com";
string userpass = "password";
using (ClientContext clientContext = new ClientContext(url))
{
	Console.WriteLine("Connecting to {0} as {1}", url, username);
	SecureString passWord = new SecureString();
	foreach (char c in userpass.ToCharArray()) passWord.AppendChar(c);
	clientContext.Credentials = new SharePointOnlineCredentials(username, passWord);
	Web web = clientContext.Web;
	clientContext.Load(web);
	clientContext.ExecuteQuery();
	Console.WriteLine("Got Web {0}", web.Url);
}

And this will be the basis of my future examples of doing things in Office 365 SharePoint using CSOM.

Connect to Office 365 with CSOM

Powershell in Office 365 … and why you need CSOM

Edit: It seems Chris O’Brien has been thinking about the same problem, and has a good post about it.

Microsoft claim that Office 365 has PowerShell support. I had assumed that this meant that most, or at least many, of the PowerShell commands I can use in a normal farm would also be available in Office 365.

I was wildly, spectacularly wrong. Continue reading “Powershell in Office 365 … and why you need CSOM”

Powershell in Office 365 … and why you need CSOM

Adding Custom Actions to SharePoint using CSOM

So I’ve been working with Office 365, and deploying site collections and their contents can be … fun. I’ve found that the best approach seems to be to use the Client-side Object Model (CSOM) – the C# API – to deploy and configure my content.

On thing I didn’t think would be easy was adding Custom Actions – but this turned out to be pretty easy, to be honest. Continue reading “Adding Custom Actions to SharePoint using CSOM”

Adding Custom Actions to SharePoint using CSOM