如何使用CSOM从网站集中删除该应用程序? [英] How to remove the app from the site collection using CSOM?

查看:68
本文介绍了如何使用CSOM从网站集中删除该应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

       如何使用CSOM从网站集中删除该应用?

       How to remove the app from the site collection using CSOM?

谢谢

Mahesh Kumar Chiliveri

Mahesh Kumar Chiliveri

推荐答案

Mahesh,

Hi Mahesh,

以下是使用SharePoint Online客户端对象模型删除应用程序的代码示例:

Here is a code sample to remove app using SharePoint Online Client Object Model:

            string siteCollectionUrl = "your site url";
            string userName = "xxx@xxx.onmicrosoft.com";
            string password = "YourPassword";

            // Namespace: Microsoft.SharePoint.Client  
            ClientContext ctx = new ClientContext(siteCollectionUrl);

            // Namespace: System.Security
            SecureString secureString = new SecureString();
            password.ToList().ForEach(secureString.AppendChar);

            // Namespace: Microsoft.SharePoint.Client  
            ctx.Credentials = new SharePointOnlineCredentials(userName, secureString);

            // Namespace: Microsoft.SharePoint.Client  
            Site site = ctx.Site;

            ctx.Load(site);
            ctx.ExecuteQuery();
            //app guid
            Guid appid = new Guid("889FCC80-F9B0-4003-9A08-86C1451C92A5");
            var appInst = ctx.Web.GetAppInstanceById(appid);
            appInst.Uninstall();
            ctx.ExecuteQuery();

请注意,请替换上面代码段中的用户名,密码,网站网址和应用Guid.

Note, please replace username, password, siteurl and app Guid in the code snippet above.

关于Guid,您可以通过将鼠标悬停在自定义应用上来找到该应用的guid,它将显示包含应用guid的网址,如下所示:

About Guid, you can find the app guid by hover the custom app, it will display the url which contain app guid like capture below:

在我的环境中,我打算删除Access Web应用程序,并且应用程序Guid为"889FCC80-F9B0-4003-9A08-86C1451C92A5".您可以在上面的代码中替换要删除的应用Guid,以使其正常工作.

In my environment, I was going to remove the Access web app, and the app Guid is "889FCC80-F9B0-4003-9A08-86C1451C92A5". You can replace the app Guid you want to remove in the code above to make it work.

更多信息:

https://www.linkedin. com/pulse/remove-app-from-sharepoint-online-powershell-gaurav-goyal

谢谢

最好的问候


这篇关于如何使用CSOM从网站集中删除该应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆