C# 授予权利

C# 授予权利,c#,sharepoint,C#,Sharepoint,以下代码用于授予用户访问SPListItem的权限 //Add current user tempRoleAssignment = new SPRoleAssignment((SPPrincipal)currentUser); tempRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions.GetByType(SPRoleType.Contributor)); item.RoleAssignments.Add(tempRoleA

以下代码用于授予用户访问SPListItem的权限

//Add current user
tempRoleAssignment = new SPRoleAssignment((SPPrincipal)currentUser);
tempRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions.GetByType(SPRoleType.Contributor));
item.RoleAssignments.Add(tempRoleAssignment);
但是,当当前用户域服务器与sharepoint服务器不同时,它不起作用

更多信息 我的Sharepoint服务器名称是spserver。域服务器名为domainserver。当我尝试将domainserver用户的权限授予sharepoint server SPListItem时,它无法分配,因为我可以将权限授予任何sharepoint组。使用上述代码不会引发任何错误/异常,但用户无权访问相应的SPListItem

//Add current user
tempRoleAssignment = new SPRoleAssignment((SPPrincipal)currentUser);
tempRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions.GetByType(SPRoleType.Contributor));
item.RoleAssignments.Add(tempRoleAssignment);

我想知道是否有人可以帮助我?

因此,当前用户位于SharePoint server之外的另一个域上?您是如何实现这种单向信任还是双向信任的?

您是否对角色分配进行了更新?roleasignment.update&&pricipal.update