Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function RetriveSites()
- {
- currentcontext = new SP.ClientContext(‘/collaboration/KeyWordsDemo’);
- /* to get the current context use this instead -à.get_current();*/
- /*more info http://msdn.microsoft.com/en-us/library/ee658863.aspx*/
- currentweb = currentcontext.get_web();
- this.subsites = currentweb.get_webs();
- currentcontext.load(this.subsites);
- currentcontext.executeQueryAsync(
- Function.createDelegate(this, this.ExecuteOnSuccess),
- Function.createDelegate(this, this.ExecuteOnFailure));
- }
- ExecuteOrDelayUntilScriptLoaded(RetriveSites,’sp.js’);
- }
- <select id=”teamsiteSelect” onchange=”navNow();”>
- <option value=”#”>Select Team Site…</option>
- <option value=”/collaboration/KeyWordsDemo”>Home</option>
- </select>
- function ExecuteOnSuccess(sender, args) {
- var subs =”;
- var Siteenum = this.subsites.getEnumerator();
- while (Siteenum.moveNext())
- {
- var Site = Siteenum.get_current();
- $(‘#teamsiteSelect’).append( $(‘<option></option>’).val(Site.get_serverRelativeUrl).html(Site.get_title));
- }
- }
- function ExecuteOnFailure(sender, args) {
- //alert(“error”);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement