Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. function RetriveSites()
  2. {
  3. currentcontext = new SP.ClientContext(‘/collaboration/KeyWordsDemo’);
  4. /* to get the current context use this instead -à.get_current();*/
  5. /*more info http://msdn.microsoft.com/en-us/library/ee658863.aspx*/
  6. currentweb = currentcontext.get_web();
  7. this.subsites = currentweb.get_webs();
  8. currentcontext.load(this.subsites);
  9. currentcontext.executeQueryAsync(
  10. Function.createDelegate(this, this.ExecuteOnSuccess),
  11. Function.createDelegate(this, this.ExecuteOnFailure));
  12. }
  13.  
  14. ExecuteOrDelayUntilScriptLoaded(RetriveSites,’sp.js’);
  15.  
  16. }
  17.  
  18. <select id=”teamsiteSelect” onchange=”navNow();”>
  19. <option value=”#”>Select Team Site…</option>
  20. <option value=”/collaboration/KeyWordsDemo”>Home</option>
  21. </select>
  22.  
  23. function ExecuteOnSuccess(sender, args) {
  24. var subs =”;
  25. var Siteenum = this.subsites.getEnumerator();
  26. while (Siteenum.moveNext())
  27. {
  28. var Site = Siteenum.get_current();
  29. $(‘#teamsiteSelect’).append( $(‘<option></option>’).val(Site.get_serverRelativeUrl).html(Site.get_title));
  30. }
  31.  
  32. }
  33.  
  34. function ExecuteOnFailure(sender, args) {
  35. //alert(“error”);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement