Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // define initial script, needed to render the chrome control
            string script = @"
            function chromeLoaded() {
                $('body').show();
            }

            //function callback to render chrome after SP.UI.Controls.js loads
            function renderSPChrome() {
                //Set the chrome options for launching Help, Account, and Contact pages
                var options = {
                    'appTitle': document.title,
                    'onCssLoaded': 'chromeLoaded()'
                };

                //Load the Chrome Control in the divSPChrome element of the page
                var chromeNavigation = new SP.UI.Controls.Navigation('divSPChrome', options);
                chromeNavigation.setVisible(true);
            }";

            //register script in page
            Page.ClientScript.RegisterClientScriptBlock(typeof(Default), "BasePageScript", script, true);

            if (!Page.IsPostBack)
            {
                lblBasePath.Text = Request["SPHostUrl"] + "/";
                listSites.Items.Add(new System.Web.UI.WebControls.ListItem("Team", "STS#0"));
                listSites.Items.Add(new System.Web.UI.WebControls.ListItem("Super Team", "STS#0"));
                listSites.Items.Add(new System.Web.UI.WebControls.ListItem("Über Team", "STS#0"));
                listSites.SelectedIndex = 0;
            }

            if (!this.IsPostBack)
            {
                // Get existing Yammer groups from the network to associate to them
                List <YammerGroup> groups = YammerUtility.GetYammerGroups(ConfigurationManager.AppSettings["YammerAccessToken"]);
                foreach (var item in groups)
                {
                    // Add items to the list.
                    YammerExistingGroups.Items.Add(new System.Web.UI.WebControls.ListItem(item.full_name, item.full_name));
                }
                YammerExistingGroups.Items.Add("");
                YammerExistingGroups.SelectedValue = "";
            }
        }
Exemplo n.º 2
0
 protected void YammerFeedType_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (YammerFeedType.SelectedValue == "Group")
     {
         YammerGroupAssociationType.Enabled = true;
         // Get existing Yammer groups from the network to associate to them
         List <YammerGroup> groups = YammerUtility.GetYammerGroups(ConfigurationManager.AppSettings["YammerAccessToken"]);
         foreach (var item in groups)
         {
             // Add items to the list.
             YammerExistingGroups.Items.Add(new System.Web.UI.WebControls.ListItem(item.full_name, item.full_name));
         }
         YammerGroupAssociationType.Enabled = true;
         txtYammerGroup.Enabled             = true;
         YammerExistingGroups.Enabled       = true;
     }
     else
     {
         YammerGroupAssociationType.Enabled = false;
         txtYammerGroup.Enabled             = false;
         YammerExistingGroups.Enabled       = false;
     }
 }