摘要: 微软动态CRM专家罗勇 ,回复301或者20190123可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me 。
因为编程时候可能常用到,我这里做个简单汇总,以后若有碰到常用的会继续增加。
1. 用户添加角色
orgSvc.Associate(
"systemuser", userId, new Relationship("systemuserroles_association"), new EntityReferenceCollection(){ new EntityReference("role",roleId) });
2. 用户移除角色
orgSvc.Disassociate( "systemuser", userId, new Relationship("systemuserroles_association"), new EntityReferenceCollection() { new EntityReference("role", roleId) });
3. 负责人类型团队添加角色
orgSvc.Associate( "team", teamId, new Relationship("teamroles_association"), new EntityReferenceCollection() { new EntityReference("role", roleId) });
4.负责人类型团队移除角色
orgSvc.Disassociate( "team", teamId, new Relationship("teamroles_association"), new EntityReferenceCollection() { new EntityReference("role", roleId) });
5.私有队列加入用户
orgSvc.Associate( "queue", queueId, new Relationship("queuemembership_association"), new EntityReferenceCollection() { new EntityReference("systemuser",userid) });
6. 私有队列移除用户
orgSvc.Disassociate( "queue", queueId, new Relationship("queuemembership_association"), new EntityReferenceCollection() { new EntityReference("systemuser",userid) });