SharePoint 보안 그룹을 '복제'하는 것은 무엇보다 먼저 그룹 자체가 아니라 사용 권한에 관한 것입니다.
이러한 사용 권한은 SPWeb 개체에 역할 할당으로 저장됩니다.
SPGroup group = spWeb.Groups["name group"];
는 그런 다음 SPWeb 개체의 roleassignments를 얻기 위해이 검색 그룹을 사용해야합니다 : 첫째로 당신은 당신이 수행하여 복제 할 그룹을 찾아야합니다.
SPRoleAssignment ass = spWeb.RoleAssignments.GetAssignmentByPrincipal(group2);
그럼 당신은 단순히 새로운 SPGroup를 작성하고 roleassignment 및 웹 객체에 roleassignment에 그룹을 추가해야합니다 : 동일한 권한과 함께 새 그룹을 가져야한다이 후
spWeb.SiteGroups.Add(groupName, user, user, groupDescription);
SPGroup newGroup = spWeb.SiteGroups[groupName];
SPRoleAssignment roleAssignment = new SPRoleAssignment(newGroup);
//add role to web
spWeb.RoleAssignments.Add(roleAssignment);
spWeb.Update();
원래 그룹.
공유 기능에서 위와 같은 작업을 수행하지 않는 경우 콘솔 응용 프로그램에서 수행 할 수 있습니다. 그냥 VS에서 콘솔 응용 프로그램을 작성하고이 같은 뭔가 그것을 채우기 : 당신이 그룹을 편집, 변경하거나 추가 할 때
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
using (SPSite spSite = new SPSite("http://yoururl"))
{
using (SPWeb spWeb = spSite.RootWeb)
{
//perform the code to clone the group here
}
}
}
}
}
이것은 어떻게 인증 하는가? ISS 서버에서 간단히 실행한다고 가정합니다. – Codingo
그룹 개체로 무엇을 할 것입니까? 위의 예는 SharePoint에 액세스하는 방법이 아니라 그룹을 복제하는 방법에 관한 것입니다. sharepoint 환경에 액세스하는 콘솔 응용 프로그램을 간단하게 만들 수 있습니다. – Tjassens
죄송합니다, 나는 내 깊이가 부족한 것 같습니다. 그 방법을 배우려면 무엇을 읽어야합니까? – Codingo