/// <summary>
        /// Handles app events that occur after the app is installed or upgraded, or when app is being uninstalled.
        /// </summary>
        /// <param name="properties">Holds information about the app event.</param>
        /// <returns>Holds information returned from the app event.</returns>
        public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
        {
            SPRemoteEventResult result = new SPRemoteEventResult();

            using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, useAppWeb: false))
            {
                if (clientContext != null)
                {
                    clientContext.Load(clientContext.Web);
                    clientContext.ExecuteQuery();

                    // setup helper classes
                    HostWebManager hostWebManager = new HostWebManager("ContosoAppPartPropertyUIOverride", clientContext);

                    // now see which app event we are in

                    switch (properties.EventType)
                    {
                    case SPRemoteEventType.AppInstalled:

                        // the app for SharePoint was installed
                        // setup helper class
                        AppPartPropertyUIOverrider overrider = new AppPartPropertyUIOverrider(hostWebManager, properties, "jquery-2.1.0.min.js");

                        // do the actual App Part property UI overrides
                        overrider.OverrideAppPartPropertyUI("Custom Category 1", "Contoso.OverrideExample.js");

                        break;

                    case SPRemoteEventType.AppUninstalling:

                        // the app for SharePoint is uninstalling
                        // uninstall all app-specific assets that were deployed (global assets are left for safety)
                        hostWebManager.UninstallAssets();

                        break;
                    }
                }
            }

            return(result);
        }
 public ActionResult Index()
 {
     HostWebManager hostWebManager = new HostWebManager();
       return View(hostWebManager.GetHostWeb());
 }
Esempio n. 3
0
        public ActionResult Index()
        {
            HostWebManager hostWebManager = new HostWebManager();

            return(View(hostWebManager.GetHostWeb()));
        }