Tagged Questions

API for interacting with SharePoint from .NET, Silverlight, and JavaScript.

learn more… | top users | synonyms (1)

2
votes
2answers
332 views

Clear list data from code

I need to clear the data contained in a list programmatically. I know I can iterate through every single item to delete it, but that takes forever. Any suggestion? (I'm with the client object ...
6
votes
4answers
10k views

Javascript to display sharepoint list items on page load

With Client Object Model API and a bit of javascript, I want to retrieve the items of a sharepoint list and display them into the web page, when the web page loads. I've successfully implemented ...
6
votes
1answer
2k views

Context Menus - Send To not working in IE9

I have a document center with a custom master page. The page is designed with IE9/HTML5/CSS3 in mind. In my other question, I worked out how to fix the IM Presence icons by fixing some core ...
4
votes
2answers
4k views

SharePoint 2010 ClientObjectModel : Find Item by GUID

I have a list of 6000 listitem GUIDs. I need to check if each item still exist on the Web. Previously, I was using the SPWeb.GetFile(GUID) method to check the item. But now I need to convert that ...
9
votes
3answers
13k views

How to get all items in a View using Client Object Model (JavaScript)

To get all the items in a List you use // Setup context & load web context = new SP.ClientContext.get_current(); web = context.get_web(); context.load(web); // Load task list this.List = ...
3
votes
2answers
1k views

Stop deletes via EditForm.aspx using SP.UI.ModalDialog.showModalDialog going to List view page

If you use SP.UI.ModalDialog.showModalDialog to show a Lists standard EditForm.aspx the callback (dialogReturnCallback) is hit for cancels and edits but not deletes which are instead redirected to the ...
4
votes
2answers
2k views

How to get the ID of the list item just inserted using SP.UI.ModalDialog.showModalDialog

If I am using JavaScript Client Object Model and SP.UI.ModalDialog.showModalDialog to display a form to enter a new list item, how can I get the ID of that item after its been added? Example ...
3
votes
1answer
1k views

Client Object Model - retrieve lookup item in same ExecuteQueryAsync?

What I like in SharePoint Client Object model is that you can make batch queries. What I cannot find is if it's possible to get related items (linked by lookup field) in the same query? An example ...
1
vote
3answers
633 views

How do I list all masterpages using client object model

I want to get all masterpages in client object model. For classic lists and libraries, I use context.Web.Lists.GetByTitle(listname) How do I do that to get the masterpage list ...
4
votes
2answers
2k views

How to read a column type SPUser, DateTime, Currency with EcmaScript?

I have a list in SharePoint 2010 with some columns. All are default types. So I have "Single line of text" "Multiple line of text" "Date and Time" "Choice" "Number" "Currency" "Person or Group" ...
3
votes
1answer
5k views

How to programmatically retrieve item version history from client?

Using server-side code I can access List Item version history using SPListItem.Versions. Is there a way to programmatically access the same information from the client? I am happy to use either the ...
6
votes
2answers
2k views

How to retrieve distinct values with JavaScript Client Object Model

How can you get distinct values from a SharePoint List column using JavaScript without a huge performance hit? A simple example would be appreciated :)
1
vote
2answers
7k views

How do get selected item of list?

I have a webpart .I add a listviewbyquary in createchildcontrols and a hyperlink in visualwebpart. i use this http://graegert.com/featured/using-the-editorpart-to-create-a-custom-listview-web-part ...
0
votes
1answer
648 views

Get sub site path with Client object model (Silverlight)

I'm currently building a Silverlight web part on SharePoint 2010. The issue I have, maybe is too trivial for me, is that I have a list, lets say its ...
7
votes
1answer
535 views

JavaScript Client Object Model functionality to get all the non hidden lists of current web and listing them

We have requirement to get all the non hidden lists of current web using JavaScript Client Object Model(JSOM). I have tried the below code but failed to get the desired result. function ...
6
votes
2answers
7k views

Get list by Internal Name using ECMAScript / JavaScript Object Model

How can I load items from a list using its InternalName? As far as I know I can get it using either Id or Title like the following: var clientContext = new SP.ClientContext('/News/'); var web = ...
4
votes
1answer
8k views

How to get all fields of a list using JS Client Object Model

Is it possible to retrieve all fields of a list (or default view) through the JavaScript Client Object Model and filter the fields on type (e.g. I only want the Choice fields). var clientContext ...
0
votes
2answers
254 views

Client object model always returns 0 items from list

I am running a very simple Console Application to test SharePoint 2010 client object model. Here is the code using System; using Microsoft.SharePoint.Client; class Program { static void Main() ...
13
votes
5answers
4k views

WebServices or Client object model?

I am writing a Silverlight control which will display the data from SharePoint list for use in SharePoint 2010 site. I am considering wheather to use Client Object Model or SharePoint web services ...
1
vote
1answer
248 views

Error while downloading Lists in a spweb

Here is the code private void downloadList(SPObjectData objectData) { using (SPWeb currentWeb = objectData.Web) { foreach (SPList list in currentWeb.Lists) ...
1
vote
1answer
125 views

Cannot create site in different web application - Silverlight Client Object Model

I am developing a Silverlight application. It interacts with SharePoint 2010 using SharePoint Silverlight Managed Client Object Model. One of the application functionalities is to create a ...
1
vote
3answers
2k views

ClientContext cannot contact site at specified url

Im doing a simple connection to a sharepoint 2010 site using clientcontext and im getting the error "cannot contact site at specified url". The site (eg Site1) is a host-header site it was ...
2
votes
1answer
3k views

JavaScript object model - using executeQueryAsync with body.onbeforeunload

I am trying to write some code that updates a list item when a list edit form (EditForm.aspx) opens and closes. I have written a function and assigned it to the onload and onbeforeunload events of ...
1
vote
1answer
559 views

Add numbering to a standard list view

We're displaying a SharePoint 2010 list using a Standard View created via the browser. The items are shown in a table and the users would like a number shown for each row. The numbers column would be ...
1
vote
2answers
634 views

Getting the error “The underlying connection was closed: An unexpected error occurred on a receive.” using Client Object Model

I'm trying to connect to a SharePoint 2010 site using the .NET Client Object Model. When I run test code from a windows console app that I have written, I have no problems. When I try to run the same ...
3
votes
2answers
2k views

Getting the GUID of a file with client object model?

Is it possible to get the GUID if I have the path to a file? Any sample code available?
0
votes
2answers
764 views

Is there any way to access a managed meta data service using only javascript in SharePoint 2010?

I am creating custom forms in a SharePoint site. The only thing is most of our Lists contain managed metadata fields. I have been successful in adding new items to Lists having only standard fields ...
1
vote
1answer
288 views

How to access custom properties of a user in SharePoint client object model?

I have a set of users in my SharePoint site with a few custom properties like GUID, LOS, YOS etc. My application needs to access the user custom properties and do CRUD operations on the properties. I ...
6
votes
4answers
17k views

Get Site Collection full URL using javascript

I want to get the URL for my site collection. One way I thought I could do it was using the window.location in javascript and getting it that way. I know that you can use ECMA script and the client ...
6
votes
2answers
3k views

How to create SharePoint list with custom template using Managed Client Object Model?

Creating lists in SharePoint using Managed Client Object Model is rather easy task. Here's how to create a list with SharePoint's custom list template: ListCreationInformation lci; List list; lci = ...
1
vote
1answer
1k views

How to check if current folder in document library has child items via JavaScript client object model?

I have a custom button on ribbon, which performs some action with current folder (download folder content as zip package). I want to disable this button in case if current folder doesn't contain any ...
1
vote
1answer
395 views

Windows Application to access the list in a Sharepoint Site using Client Object Model

I have created a Windows Application, which uses Client object model to access lists in a Sharepoint site(installed and configured on a separate server). I have used the default credentials to access ...
3
votes
3answers
3k views

Javascript to get GUID from SharePoint

I am newbie to SharePoint and I am uploading a file to the server using javascript. Now the task is to get the GUID of that file and display it ({alert(guid); is fine). I don't even know where to ...
4
votes
3answers
4k views

How to get SP.Folder for SP.ListItem in SharePoint 2010 JavaScript Client Object Model?

I have a custom button on ribbon for document library and need to disable it if current SPListItem is an empty folder. To disable button I use EnabledScript attribute of CommandUIHandler. I can get ...
3
votes
2answers
429 views

Publish contenttype after activating feature (Office 365)

I've created a Contenttype and some fields in a visual studio project. They are deployed when activating the "Content types"-feature. But here's the problem: I want them to be deployed to the Content ...
3
votes
2answers
2k views

Programmatically add Event to Sharepoint Calendar using Client OM

I need to programmatically add events to a SharePoint Calendar and make them repeatable using JavaScript Client Object Model (without any c# code). Does anybody have ideas how can I implement this ...
1
vote
1answer
438 views

How to add attachment to new item silverlight client object model

I am trying to add an attachment to new item but I could only succeded to upload the attachment into the list's folder (not to list's attachment folder). How can I achieve uploading the attachment on ...
4
votes
1answer
888 views

How to add rich text content programmatically using Managed Client Object Model?

I am building a Silverlight application that interacts with SharePoint through Managed Client Object Model. One of the functionalities of the app is to update a list item field with rich text content. ...
2
votes
1answer
2k views

How to upload a file larger than 2MB to SharePoint document library using Managed Client Object Model for Silverlight

I can't seem to upload a file to SharePoint if that file exceeds 2MB or so. I am developing a Silverlight application that is interacting with SharePoint via Managed Client Object Model for ...
1
vote
1answer
262 views

How to cancel pending actions in Client Context? (Managed Client Object Model)

I have written a code relying on Managed Client Object Model which performs the following actions: Creates a site Web site Creates a list List list1 Creates a list field FieldText field1 (which is ...
4
votes
2answers
225 views

Is there a way to determine if the SharePoint version is 2007 or 2010 using Managed Client Object Model?

I am building an application that interacts with SharePoint 2010. It is a Silverlight application built on the Managed Client Object Model. The application is set up on SharePoint like this: User ...
3
votes
3answers
10k views

Getting the URLs of the SharePoint sites, lists and list views using Managed Client Object Model

Let's say that I have created: A SharePoint site collection at http://mysharepoint/. A subsite of that site collection titled Team site at http://mysharepoint/teamsite/. A list titled My List ...
8
votes
3answers
3k views

How to add list web part to the SharePoint page using Managed Client Object Model?

I am trying to add new web part to the SharePoint page using Managed Client Object Model that will display a list. I can't seem to be able to figure out the code of the web part's XML that is ...
3
votes
1answer
1k views

REST API + Expand Recurring Calendar Events?

Is there a way using the REST API (through javascript) to expand recurring calendar items? Or is there a helpful client side utility to assist with this?
6
votes
4answers
7k views

SharePoint 2010 Javascript Client Object Model cross site collections?

I've read some unofficial things online that using the Javascript client object model to retrieve content from other site collections is not allowed due to prevent the equivalent of "cross site ...
1
vote
1answer
346 views

Cannot cast to clientContext.CastTo<T> (Managed Client Object Model)

I am writing a method that is supposed to create a SharePoint list field. I want to be able to make my method return the newly created field. The problem that I am facing is that ...
1
vote
1answer
383 views

How can i get entire role assignments from SP 2010 using the COM interface including the users in the AD groups and not the groups names?

I've been trying to get all the RoleAssignments using the COM interface. the problem is that i get the AD user group names instead of the actual users inside the groups. my code looks something like ...
2
votes
2answers
2k views

How to add new item in Links list using Managed Client Object Model?

I have created a standard SharePoint Links list, using Managed Client Object Model (for Silverlight). Here's the code: ClientContext clientContext = new ClientContext(sitePath); ...
2
votes
1answer
412 views

Access My Content using ecmascript client OM

Is is possible to access the current user's "My site" and "My Content" using the ecmascript client OM? Specifically I'm looking to create a custom list, that is specific to each user, and wanted to ...
1
vote
3answers
979 views

upload a file with metadata without creating a new version using the client object model

What I'm trying to do is upload a file with metadata without creating a new version using the client object model. I already have this code: byte[] bytes = ...