Small tip – To add user in space with some specified or custom role
Solution -If you are using PS6, this code will help you doing that.
public void addMemberInSpace(String SpaceName, String userid) throws GroupSpaceWSException {
logger.fine("Entering AddMember");
try {
GroupSpaceWSClient Gsclient = new GroupSpaceWSClient(contextData);
String userRole = "CustomRole"; // You can define default role as admin, viewer, Moderator or some custom role as well
GroupSpaceWSMembers memberData = new GroupSpaceWSMembers(userid, userRole);
//Approval code will be added
List<GroupSpaceWSMembers> addMem = new ArrayList<GroupSpaceWSMembers>();
addMem.add(memberData);
Gsclient.addMember(SpaceName, addMem);
} catch (oracle.webcenter.spaces.ws.client.GroupSpaceWSException gsException) {
throw gsException;
} catch (Exception exception) {
throw new GroupSpaceWSException("Exception caught during addMembership ", null, null, exception, null);
}
}
Happy Coding with techartifact….



