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”

Advertisements
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

"Minor" Search limitations in Office 365

If you’re a SharePoint developer like me, you probably find the Query Throttle in SharePoint an absolute pain. This is a feature where, under an unnecessarily complicated set of conditions, if you try to ask for too many list items in one query, SharePoint refuses.

Now, while I understand why such a limit is necessary – albeit I’d rather it was simpler – it is something of a problem. For example, multi-choice columns cannot be indexed. If you want to query such a column, and there are more than 5000 items in the list, we’ll, you’re outta luck.

That situation is surprisingly common in Document Management systems. Continue reading “"Minor" Search limitations in Office 365”

"Minor" Search limitations in Office 365

Content Approval and Large Lists

So I’ve discovered an interesting problem with Content Approval, which is a special issue for Office 365. I have a document library with more than 5000 documents in it. Content Approval is turned on, and the customer would like a view of ‘Unapproved Documents’.

Content Approval Annoyance

For a Document Management System, 5000 documents in one repository is small beer, so this is a bit of a problem. “Okay”, I thought, “this must be a choice column, so I’ll just add an index to the column”. Continue reading “Content Approval and Large Lists”

Content Approval and Large Lists

Content Approval and Office 365 Search

I have found an gotchya with Content Approval and Office 365 Search, specifically around draft item security. Embarrassingly, it did take me a while to work out that this was what was going on.

You can use content approval to allow only certain users – such as editors and approvers – the right to see draft items. However, if you do this, then the Search Crawl Account – which normally only has ‘read’ access – cannot see the draft documents to index them. Thus, draft documents that are visible to editors or approvers only never appear in the search results. Continue reading “Content Approval and Office 365 Search”

Content Approval and Office 365 Search

Fail: Visual Studio 'Verify' for Office 365 in 2010 compatibility mode

Right, so I’m trying to develop some Remote Event Receivers. I’ve been using our company’s tenant. Lets call it https://mytenant.sharepoint.com. That tenant was a SP2010 one, which has been upgraded.

I am trying to test using https://mytenant.sharepoint.com/sites/AWBTest. It’s a SP2013 site collection. Unfortunately, https://mytenant.sharepoint.com is still running in 2010 mode. Continue reading “Fail: Visual Studio 'Verify' for Office 365 in 2010 compatibility mode”

Fail: Visual Studio 'Verify' for Office 365 in 2010 compatibility mode