如何在SharePoint 2010中获取服务应用程序权限

在SharePoint 2010中读取特定服务应用程序的帐户权限的最佳/最简单方法是什么? 目前我一直在搞乱:

var solution = SPFarm.Local.Solutions["Service App Name.wsp"]; var solutionPermissions = solution. //trying different options here 

我一直在寻找可以遵循“解决方案”的不同选项。 但到目前为止,我感到很茫然。 有任何想法吗?

如何检查服务应用程序的权限? 可能对您有用:

 foreach (SPService service in SPFarm.Local.Services) { if (service.Name.Equals("ServiceName")) { foreach (SPServiceApplication serviceApp in service.Applications) { //This gets the service app administrators SPCentralAdministrationSecurity serviceAppSecurity = serviceApp.GetAdministrationAccessControl(); SPAcl adminAcl = serviceAppSecurity.ToAcl(); foreach (SPAce rights in adminAcl) { //Handle users } //This gets the users that can invoke the service app SPIisWebServiceApplication webServiceApp = (SPIisWebServiceApplication) app; SPIisWebServiceApplicationSecurity webServiceAppSecurity = webServiceApp.GetAccessControl(); SPAcl invokerAcl = webServiceAppSecurity.ToAcl(); foreach (SPAce rights in invokerAcl) { //Handle users } } } } 

你可以通过PowerShell尝试这个。 您可以从代码中运行脚本,并尝试以这种方式与权限进行交互。

请参阅: http : //blogs.technet.com/b/spweb/archive/2011/04/13/configure-service-application-permissions-in-sharepoint-2010-using-powershell.aspx

以及如何从代码中运行PowerShell: http : //www.codeproject.com/Articles/18229/How-to-run-PowerShell-scripts-from-C