如何以编程方式重新信任SharePoint应用(C#)? [英] How to retrust an SharePoint app programmatically (c#)?

查看:81
本文介绍了如何以编程方式重新信任SharePoint应用(C#)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了SharePoint应用程序,并将该应用程序以语法方式部署到SharePoint网站.现在,我已由首席经理信任此应用程序,但是它无法正常工作.

I have created SharePoint app and deployed this app to SharePoint site pro grammatically. Now I have retrust this app by principal manager, but its not working.

//load the principal manager
SPAppPrincipalManager manager = SPAppPrincipalManager.GetManager(targetWeb);
//Check if the app principal is registered in this farm using client ID
SPAppPrincipal appPrincipal = manager.LookupAppPrincipal(SPAppPrincipalIdentityProvider.External, SPAppPrincipalName.CreateFromAppPrincipalIdentifier(clientId));
//Trust the app
SPAppPrincipalPermissionsManager sPAppPrincipalPermissionsManager = new SPAppPrincipalPermissionsManager(targetWeb);
sPAppPrincipalPermissionsManager.AddAppPrincipalToWeb(appPrincipal, SPAppPrincipalPermissionKind.Read);  

请帮助

推荐答案

您好,

请尝试在PowerShell中使用Internet Explorer实例来模拟UI中的用户信任.

Please try to use an Internet Explorer instance in PowerShell to simulate user retrust in UI.

这里有一个类似的线程供您参考:

Here is a similar thread for your reference:

如何以编程方式(C#或Powershell)信任应用程序?

https://sharepoint.stackexchange.com /questions/198131/how-to-to-trust-app-programmatically-c-or-powershell

最好的问候,

丹尼斯


这篇关于如何以编程方式重新信任SharePoint应用(C#)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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