简体   繁体   English

在将用户添加到共享点组中时,Sharepoint 2010不会获得任何权限

[英]Sharepoint 2010 when adding user to a sharepoint group, no permissions are taken

I am programatically adding a AD user to some SharePoint groups. 我以编程方式将AD用户添加到某些SharePoint组中。

spWeb.AllowUnsafeUpdates = true;
SPUser lookupUser = spWeb.EnsureUser(username);
if (lookupUser != null)
{
    spGroup.AddUser(lookupUser);
}
spWeb.AllowUnsafeUpdates = false;

Have tried running this, as (logged in with the administrator account) and tried running with elevated privileges. 尝试以此身份运行(使用管理员帐户登录),并尝试以提升的特权运行。

The user is added to the groups as required. 根据需要将用户添加到组中。 The problem is, when I use the SharePoint function "Check Permissions" under "Site Permissions" it shows the user as having no permissions. 问题是,当我在“站点权限”下使用SharePoint函数“检查权限”时,该用户显示为没有权限。

Everywhere I look in the internet simply shows the use of the AddUser method. 我在互联网上看到的每个地方都只是显示了AddUser方法的使用。 Am I missing something? 我想念什么吗?

Your group seems to be missing actual permissions to the site. 您的论坛似乎缺少对该网站的实际权限。 Did you assign the group at least Read permisssions for the site? 您是否为该组至少分配了该站点的“ 读取权限”? If not the Check permissions feature works as expected. 如果不是,则“ 检查权限”功能将按预期工作。 See this answer for code sample for assigning the group some permissions. 有关为组分配一些权限的代码示例,请参见此答案

If the group has permissions assigned maybe the problem lies in a missing call to spGroup.Update() after adding the user to group. 如果为组分配了权限,则问题可能出在将用户添加到组后,缺少对spGroup.Update()调用。 Have you tried calling this method? 您是否尝试过调用此方法?

Check if the WebApplication is using Claims Authentication... if so you probably use the wrong username or there are multiple similar users with different usernames ("i:0#.w|\\" and "") -> check /_catalogs/users/simple.aspx. 检查WebApplication是否正在使用Claims Authentication ...如果是,那么您可能使用了错误的用户名,或者有多个具有不同用户名的相似用户(“ i:0#.w | \\”和“”)->检查/ _catalogs / users /simple.aspx。 Delete the wrong one from the SiteCollection. 从SiteCollection中删除错误的一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用C#在Sharepoint 2010中检查用户或组的权限? - How to check permissions for a user or group in Sharepoint 2010 using C#? 在Sharepoint 2010中以编程方式添加用户控件 - Programmatically adding a user control in Sharepoint 2010 在SharePoint 2010中以编程方式添加新用户 - Adding New User programmatically in SharePoint 2010 Sharepoint 2010-部署时添加组 - Sharepoint 2010 - Add group on deploy SharePoint 2010客户端对象模型以编程方式将Sharepoint用户/组添加到每个文档库文件夹 - SharePoint 2010 Client Object Model Add Sharepoint user/group to every document library folder programatically Sharepoint Provider托管用户权限 - Sharepoint Provider Hosted User Permissions 如何在SharePoint 2010中获取服务应用程序权限 - How to get Service Application Permissions in SharePoint 2010 指定尝试通过LinqToSharepoint连接到SharePoint 2010时要使用的用户 - Specify the user to use when trying to connect to a Sharepoint 2010 through LinqToSharepoint 创建自定义页面以使用Sharepoint 2010中的C#向用户授予工作区权限 - Create custom page to give permissions to a user for workspace using C# in Sharepoint 2010 项目在事件接收器sharepoint 2010中添加 - Item Adding in event receiver sharepoint 2010
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM