Tag Info

Hot answers tagged

3

Based on your question, i understand that you want to get ID of Department item which is referenced in Article list. Correct me if i am wrong. To get ID of lookup list item, include following in you code(Assuming field name of lookup field from Department is "Department" in article list : var childIdField = listItem["Department"] as FieldLookupValue; if ...


3

One thing you can do is use SP.List.getItems(query) to query the 'Department' list for the item with the Title value you want. Once you get the list item, you can get its ID. (Keep in mind that the getItems(query) method will return a list item collection, even though that collection may only contain one item.) Your CAML query would look something like ...


3

The following example demonstrates how to return web sites sorted by last modified date: function getWebs(success,error) { var ctx = SP.ClientContext.get_current(); var web = ctx.get_web(); var webs = web.getSubwebsForCurrentUser(null); ctx.load(webs); ctx.executeQueryAsync( function(){ var result = []; ...


3

Using SharePoint 2010 JSOM i would suggest the following approach to retrieve list item attachments: determine whether List Item contains attachments or not via ListItem.Attachments property in case if list List Item contains attachments, submit a second request to retrieve attachment files Example function ...


2

Ok, thanks for all the help everyone. It was a good insight into how to go about doing what I wanted. The closest way I could get to 'almost' work was Francoise Becker's idea using SPServices jQuery library, however I think ive discovered that in the DISPFORM.aspx, the code behind is different to other pages as I couldnt get the code to run when the ...


1

You could utilize SP.FieldUserValue.fromUser Method for that purpose, for example: var authorVal = SP.FieldUserValue.fromUser(userName); listItem.set_item('Author', authorVal); Complete example var properties = {}; properties['Title'] = 'Request N#789'; properties['Author'] = ...


1

Updating this field requires the UpdateOverwriteVersion method when working on the server side (see sample). Since this method (or the SystemUpdate method) is not available in the client OM, I am a bit sceptic that you can achieve your goal. It's not clear, what you would like to achieve with this code: var userField = user.get_id() + ";#" + ...


1

The following example demonstrates how to update enterprise wiki page content: function updateWikiPage(pageUrl,pageContent,success,error) { getFileWithProperties(pageUrl, function(file){ var listItem = file.get_listItemAllFields(); var itemProperties = {'PublishingPageContent': pageContent}; ...


1

As Dylan Cristy suggested, you'll need to execute a CAML query to pull back just the items where the Title field is equal to the value you're looking for. Here's the syntax for doing that in the JavaScript client side object model: var title = "My Item Title"; // the title of the item you're looking for var ctx = SP.ClientContext.get_current(); this.web = ...


1

Step 1: If you haven't got SPServices, get it -- it's free and it'll make your life easier. http://spservices.codeplex.com/ Step 2: Here's what I've used to get the ID (assuming Title is unique): // Define a lookup query that will pull only the records where the Title field is the one we are looking for var queryLookup = ...


1

The lookup field in SharePoint internally always looks like ID;#Value example 10;#ItTeam So in field 'Article' You already have ID of target element in 'Department'. So You should parse it using jQuery getter(or see how Your existing JS function does it), and query ListItem element by this Id.


1

You are committing one Cardinal Sin of .NET programming; you are deleting items of a collection in a foreach loop. When you delete an item in a loop like this, you are changing the collection that's being iterated, but the foreach loop still attempts to iterate as if the collection was still in its original state, and eventually the enumerator get out of ...


1

You can do it in Singleline of code var siteCollectionURL = _spPageContextInfo.siteAbsoluteUrl;



Only top voted, non community-wiki answers of a minimum length are eligible