I'm new using Sharepoint and I have a question. When I try to use this code:

var ctx = SP.ClientContext.get_current();
var items = SP.ListOperation.Selection.getSelectedItems(ctx);
var myItems = '';
var i;

for (i in items)
myItems += '|' + items[i].id;

Get this:

the type or namespace ClientContext name does not exist in the namespace (are you missing an assembly reference)

Which reference or using sentence am I missing? Even when I type the SP and dot, there is nothing there that allows me to select a method or something. I use Visual Studio 2013 professional and SharePoint 2010. Thanks


The code snippet above is JavaScript code, you seem to need C# code. That's the root of your issues.

Search for CSOM examples instead of JSOM / JavaScript samples and you should be of to a good start

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.