Tag Info

Hot answers tagged

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 = []; ...


2

How to retrieve all web sites under a site collection using SharePoint JSOM The following function demonstrates how to recursively retrieve all sub sites: function getAllWebs(success,error) { var ctx = SP.ClientContext.get_current(); var web = ctx.get_site().get_rootWeb(); var result = []; var level = 0; var getAllWebsInner = ...


2

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

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 ...


2

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 ...


1

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 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