Pages

Programmatically get list of applications added by AppRegNew.aspx in SharePoint Online using CSOM


To look up registration information for an add-in that you have registered, go to http://<SharePointWebsite>/_layouts/15/AppInv.aspx.
 Code Snippet:
using (ClientContext context = new ClientContext("http://weburl/"))
            {
                Web web = context.Web;
                web.Context.Load(web);
                web.Context.ExecuteQuery();

                // Get all Add-ins installed on the web
                var addInInstance = AppCatalog.GetAppInstances(context, web);
                addInInstance.Context.Load(addInInstance);
                addInInstance.Context.ExecuteQuery();

                foreach (var appInstance in addInInstance)
                {

                    //Check whether it is Remote hosted Add-in
                    if (string.IsNullOrEmpty(appInstance.AppWebFullUrl))
                    {
                        Console.WriteLine("This is a remote hosted add-in");
                        // You can now get all the information about your appInstance object
                        Console.WriteLine("Add-in Title: " + appInstance.Title);
                        Console.WriteLine("Status: " + appInstance.Status);
                        Console.WriteLine("Start Page: " + appInstance.StartPage);
                        Console.WriteLine("Add-in Id: " + appInstance.Id);
                    }
                }
            }



Gowtham

Phasellus facilisis convallis metus, ut imperdiet augue auctor nec. Duis at velit id augue lobortis porta. Sed varius, enim accumsan aliquam tincidunt, tortor urna vulputate quam, eget finibus urna est in augue.

No comments:

Post a Comment