无法以编程方式将 SPUser 添加为 LimitedAccess
我正在尝试在 SPWeb 中添加一个新用户,其角色定义为“有限访问”。但它显示错误。但如果我给予“完全控制”、阅读、设计,我就可以添加用户。
这是我的代码 web.SiteUsers.Add(loginName, string.Empty, displayName, string.Empty);
解决方案是什么
I am trying to add a new user in SPWeb with "limited access" as roleDefinition. But it shows error. But if i give "full control", read, design i'm able to add the user.
This is my code web.SiteUsers.Add(loginName, string.Empty, displayName, string.Empty);
What is the solution
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
LimitedAccess 仅由系统管理,据我所知,无法以编程方式设置。此权限的存在仅是为了允许用户遍历站点树以检索他们有权访问的内容。
您可以创建几乎没有任何权限的自定义权限级别,并将其分配给您的用户(如果这是您正在寻找的内容),或者您应该将权限更新为网站集树中的目标位置(项目、网站等)上的相关值,然后 SharePoint 会将此用户标记为根网站中的受限访问用户。
LimitedAccess is only managed by the system and, as far as I know, cannot be set programmatically. This permission only exists to allow user(s) to traverse the site tree to retrieve content on which they have access.
You can create a custom permission level with nearly no right and assign it to your user if it's what you are looking for or you should update the permission to the relevant value on the targeted locations (items, webs, etc) in your site collection tree, SharePoint will then mark this user as a limited access user in the root site.